Wednesday, June 9, 2010

Clone a Hard Drive Using an Ubuntu Live CD

Clone a Hard Drive Using an Ubuntu Live CD: "
Whether you’re setting up multiple computers or doing a full backup, cloning hard drives is a common maintenance task. Don’t bother burning a new boot CD or paying for new software – you can do it easily with your Ubuntu Live CD.

Not only can you do this with your Ubuntu Live CD, you can do it right out of the box – no additional software needed! The program we’ll use is called dd, and it’s included with pretty much all Linux distributions. dd is a utility used to do low-level copying – rather than working with files, it works directly on the raw data on a storage device.

sshot-1

Note: dd gets a bad rap, because like many other Linux utilities, if misused it can be very destructive. If you’re not sure what you’re doing, you can easily wipe out an entire hard drive, in an unrecoverable way.

Of course, the flip side of that is that dd is extremely powerful, and can do very complex tasks with little user effort. If you’re careful, and follow these instructions closely, you can clone your hard drive with one command.

We’re going to take a small hard drive that we’ve been using and copy it to a new hard drive, which hasn’t been formatted yet.

To make sure that we’re working with the right drives, we’ll open up a terminal (Applications > Accessories > Terminal) and enter in the following command

sudo fdisk –l


screenshot_001

We have two small drives, /dev/sda, which has two partitions, and /dev/sdc, which is completely unformatted. We want to copy the data from /dev/sda to /dev/sdc.

Note: while you can copy a smaller drive to a larger one, you can’t copy a larger drive to a smaller one with the method described below.

Now the fun part: using dd. The invocation we’ll use is:

sudo dd if=/dev/sda of=/dev/sdc


In this case, we’re telling dd that the input file (“if”) is /dev/sda, and the output file (“of”) is /dev/sdc. If your drives are quite large, this can take some time, but in our case it took just less than a minute.

screenshot_002

If we do sudo fdisk –l again, we can see that, despite not formatting /dev/sdc at all, it now has the same partitions as /dev/sda.

screenshot_003
Additionally, if we mount all of the partitions, we can see that all of the data on /dev/sdc is now the same as on /dev/sda.

screenshot_004

Note: you may have to restart your computer to be able to mount the newly cloned drive.

And that’s it…If you exercise caution and make sure that you’re using the right drives as the input file and output file, dd isn’t anything to be scared of. Unlike other utilities, dd copies absolutely everything from one drive to another – that means that you can even recover files deleted from the original drive in the clone!


Got an opinion to share? Click here to join the discussion


















Similar Articles Productive Geek Tips
Latest Software Reviews Tinyhacker Random Tips

"

No comments:

Post a Comment