
I didn’t fancy reinstalling my OSes again so decided to clone the older disk onto the new one. Here, as always, Linux came to my rescue, this time with the dd command.
dd does one thing: copy. It copies things from one place to another, whether that’s standard input to standard output, or the contents of an entire disk, as in my case.
The beauty of dd is that it doesn’t see the world as a series of files, like other shell commands such as cp. It sees the world in terms of bits and bytes. This makes it excellent for cloning. When cloning a hard disk, it can copy the boot sector, partition table, and so on, all on one fell-swoop.
Using it to clone my hard disk was easy. Noting that the new disk was identified as /dev/sda, and that the old disc was identified as /dev/hda, I issued the following command:
dd if=/dev/hda of=/dev/sda
if=input file, of=output file. Simple, eh?
Then I sat back and relaxed, because the process took around two hours. I could probably have speeded-up the cloning by specifying a larger block size (the default is 512 bytes), but I was in no rush.
Of course, I did all this from a live distro CD. It’s not a good idea to clone a disk that’s in use. It’s like trying to hit a moving target.
Now all I have to do is expand the partitions, probably using GParted. Once again, I’ll do this from a live distro CD.
I’ve barely scratched the surface of what dd can do here. It’s capable of much more, so take a look at its man page.