I saw the light, I saw the light,
No more darkness, no more night…
- Hank Williams, “I saw the light”
I consider myself a lucky fellow. But not until today it extended to relationships with hard drives. They always failed me. And some of you might know The Cloud wasn’t always around.
Last week I was asked to rescue a couple of computers with soon-to-die HDD’s. I had a thumb drive with Clonezilla Live on it and I tried to clone them. It would go very slow, showing somewhat around 400kb/s (?) and then spur a lot of text in the command line finally freezing the system.

Last friday before calling it a day I tried to boot from one of the original drives and it didn’t go. I had assumed the Clonezilla ruined it somehow and decided not to fiddle with mechanical disk drives again.
Today I found a copy of Ubuntu Live on another thumb drive and decided to give dd a try. I’ve read Using DD for disk cloning a while ago and I have played with copying blocks from a disk or /dev/random to /dev/null, but never had a chance to clone physical hard drives. It really turned out to be as easy as typing in terminal the following command
dd if=/dev/sda of=/dev/sdb
You might need to put sudo in front of it if you’re not root. Most importantly, you have to double check that if (input file) and of (output file) are not misplaced. ALL DATA on sdb will be lost (technically, if sdb is bigger than sda, some of the data will remain, but that’s not what you’re aiming for.) To check which drive is source and which should be target go back to terminal and use hdparm
hdparm -i /dev/sda
hdparm -i /dev/sdb
This should give you enough information to identify the drives. By the way, your disks could be different from sda and sdb. To find out what they are type
fdisk -l
When you finally decide to hit enter and launch dd you might begin to wonder, why there’s no progress indication. Don’t worry. There’s an app for that. Just open another Terminal window and use
ps -a | grep dd
to get an Id of dd’s process. In my case it was 5643. Replace $pid with this value in the next command
watch -n 10 $pid
and you’re good to go. Every ten seconds dd will report on its progress.

There’s more tricks behind the dd’s belt. I used bs=8096 and conv=noerror arguments when I ran it, but I’m not sure how it affected the outcome. Next time I’m going to try to pipe it to itself for a speedup. As an asymmetrical copying program, dd reads first, then writes, then repeats. Supposedly you can gain 100% in performance if copying symmetrically, like this
dd if=/dev/sda | dd of=/dev/sdb
I hope you’re now ready to join the club of dd believers.