Create a hard disk clone in linux

Recently I bought a new hard drive for my ubuntu box to use it as a primary disk. I didnt want to re-install every piece of software, so I created a clone of my old disk to the new.

This is the linux command I used:

dd if=/dev/hdb of=/dev/hda bs=1M

What this command does, is to tell the system to copy every byte of data in 1MB increments from the /dev/hdb drive to the /dev/hda drive. In order to do this, you will have to boot from a live cd.

My system used the secondary hard drive as the main drive.

The old disk was an 80gb seagate drive, while the new is an 250gb, also seagate. The process completed around 40 minutes later. The next step was to change the grub menu.lst and replace every occurrence of hdb to hda. I could avoid this step if I made the new drive a secondary drive instead of primary. I also had to change the occurences of hdb to hda in the /etc/fstab file.

Then, I unplugged the power cable from the old hard drive, changed the boot drive bios setting and rebooted the system. Everything worked perfect.

When I used the ‘Gnome Partition Editor’ application to view the partitions of the new hard drive, I saw that all partitions were duplicated from the old drive to the new. The remaining space was unallocated, so I formatted as a new ext3 partition.

Leave a Reply

You must be logged in to post a comment.