1. Home
  2. Linux
  3. Create disk image clone hard disk partition with ubuntu live usb

Create Disk Image & Clone Hard Disk Partition With Ubuntu Live USB

Earlier, we showed you how to create persistent Ubuntu Live media disk, and use it for resetting and changing Windows 7 administrator and standard user account password. Apart from tweaking with Windows registry hives, Ubuntu Live media disk can be used to create data backup, shrink partitions, clone hard disk, scan system for viruses, imaging disk partitions and more. Although disk imaging or hard disk cloning can be done using data backup and disk copying applications, malware-infected OS often make it hard to perform essential data backup operations. For instance, if a PC is infected with boot sector virus, disk cloning application doesnโ€™t work unless you clean the system from virus and repair boot sector.

Ubuntu Live media disk lets you clone disks and create disk images, so that you can easily restore the data after performing low-level cleaning of the system. In this post, we will look at 2 simple ways for cloning and imaging disks using Ubuntu Live USB.

The first step is to change the system boot priority from BIOS menu. On system startup, press F2, F10, ESC, DEL, or other system defined key for accessing BIOS menu. Now, open Boot menu to set USB Hard disk/Removable Drive as first boost option. Once done, save the changes, plug-in Ubuntu Live USB, and the reboot the system. Once rebooted, it will take you to Ubuntu Live boot menu, select Run Ubuntu from this USB option to load Ubuntu OS.

Create Image of local disk partition to external hard drive

Once Ubuntu 10.10 is loaded, plug-in the external hard disk on which you want to create your primary hard disk image, and then mount the external hard disk from Places menu.

mount disk 1

We will use Ubuntu dd command to create disk image. The command is widely used to perform low-level data copying and disk cloning operations. Using if (input file) and of (output file) operands, we can use dd to create an exact copy of specified disk in IMG format. To begin, click Applications and open Terminal from Accessories menu.

2 terminal

Now navigate to media disk using cd /media command. Open the external hard disk using the cd <disk label> command. You can use cd command to navigate to folder in external hard disk where image is to be created.

3 mount

Since we need to create disk image to external drive, we will use sudo fdisk โ€“l command to list down all the partitions of primary hard disk. This will help us identify the partition whose image is to be created on external hard disk. Once listed, note down the partition identifier under Device column, as it will be used to specify the hard disk partition with dd command to create a disk image.

4 fdisk

The syntax for creating disk image is as follows:

sudo dd if=<disk partition identifier> of=./<name of disk image>

If you for instance want to create a disk image for /dev/sda5. Enter;

sudo dd if=/dev/sda5 of=./BackupDisk.img

The time it takes to create a disk image depends upon the size of specified disk partition.

5 clone local drive to remoable drive

Once the image is created, open external hard drive location in Nautilus (Ubuntu File Explorer) to verify the disk image size. Similarly, you can create disk images for other partitions of primary hard disk in external storage medium.

Screenshot-DISK

The dd command also lets you restore or extract the IMG file to specified location. The syntax of extracting IMG file is as follows.

sudo dd if=.<name of disk image file> of=<output location>

You can specify the local disk where data is to be extracted or specify the folder hierarchy where you want to copy the data from IMG file.

sudo dd if=./BackupDisk.img of=/dev/sda3

6 extract cloned to local.png

It must be noted that when you restore data from IMG file using dd command, it will wipe all the free space of target drive. The screenshot below shows the cloned D drive. To reclaim the free space, copy the data from cloned drive to other disk and then format the cloned drive using Windows built-in Format utility.

cloned

Clone Local Disk Using Ubuntu Live USB

The process of cloning disk is similar to creating disk image. All you need is to mount the primary hard disk and navigate to it in Terminal using cd <disk identifier> command.

15

Once mounted, use sudo fdisk โ€“l to list down hard disk partitions, so that you can note down the Device identifiers of both disks including disk which is to be cloned and target disk where data is to be copied.

Screenshot-5

For instance, if you want to create a clone of /dev/sda5 in /dev/sda3. Enter following command

sudo dd if=/dev/sd5 of=/dev/sd3

It will take /dev/sd5 as input file (if operand) and clone disk at specified location (/dev/sd3).

Clone

6 Comments

  1. I don’t understand. Isn’t it quicker and easier to just press ‘Install Ubuntu’ instead of ‘Try Ubuntu’? Then there won’t be any security or booting problems in the future…

    • Over a decade later… I thought I’d mention that you double posted comment is talking about installing and/or trying ubuntu. This article is about making disk image clones, and not about trying the live ubuntu vs installing it. Anyway, trying it is for people who want to TRY it before they install it, and possibly decide they don’t want to use it and so wasted all that time. If you know you want to install Ubuntu, don’t even download the live bootable ISO, it’s a waste. Just download the ISO to install. Why would you download the live ISO to try Ubuntu if you’re not going to use it? Not that downloading the full live packed dvd/whatever ISO takes like 1 minute and the plain installer takes like 35 seconds.. so do whatever you like. I don’t see the issue. Some people like to try it first, some are just installing what they know they want on their spare partition to boot to as a sort of permanent rescue boot system… You can do anything.. re-write the kernel? Remember when you had to compile the whole kernel every time you installed… but then downloading the 35 3.5″ floppies for the install was a little tedious too.. we got it so easy now..

  2. I don’t understand. Isn’t it quicker and easier to just press ‘Install Ubuntu’ instead of ‘Try Ubuntu’? Then there won’t be any security or booting problems in the future…

    • Actually, it’s the complete opposite of quicker and easier – imagine installing the whole thing, updates, partitioning, wasting all that time when all you wanted to do was try it? Wasting hours of valuable time. No security or booting problems in the future (for real! – if you believe you’ll never have any security or booting problems by installing it, well, you have a lot to learn.. maybe since it’s been a decade, you have learned?) ๐Ÿ˜‰ Try it. Shut it down when done. Guaranteed no security or booting problems. Install and continue to use it regularly and security and booting problems will just be the tip of the iceberg. ๐Ÿ˜‰

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.