3 min read

Rescuing a hard drive with ddrescue

A while ago, one of my Windows hard drives gave up the ghost. Unfortunately, the last backup I’d done on it was a while ago. Lesson #1: Don’t forget to back things up.

The hard drive had been staring at me on my desk for a while, so I decided to see what I could do about it. My searches led me to CGSecurity and two pages on their website: TestDisk and the Damaged Hard Disk page. They in turn led me to ddrescue.

Here’s what I’ve done so far:

  1. Have a nice server that has a motherboard advanced enough to hot-mount SATA drives. This is very useful if the disk disappears now and then and needs to be remounted.
  2. Mount the drive in a spare slot in the server.
  3. sudo apt-get install lzip because ddrescue is stored in lzip archives
  4. Grab the latest stable build from the ddrescue download directory. (I used version 1.20.)
  5. lzip -d then extract the ddrescue tar file.
  6. cd into the ddrescue directory and configure; make
  7. Next I tried plain ddrescue: sudo ./ddrescue -n /dev/sde /data/sde_rescue sde_map
  8. That seemed to be having trouble, so I reversed direction: sudo ./ddrescue -n -R /dev/sde /data/sde_rescue sde_map
  9. That whirred for a few days. Next I decided to try mounting as a raw device, on the theory that the kernel cache might be obscuring things.
  10. sudo /sbin/modprobe raw
  11. sudo raw /dev/raw/raw1 /dev/sde
  12. sudo ./ddrescue -n -R /dev/raw/raw1 /data/sde_rescue sde_map

So far I’ve theoretically recovered 130M of my 500M disk. When reading the raw device, I don’t get an estimate of time remaining (which was about a year). It will be interesting to see if this actually gets recovered, or if I’m just grabbing random numbers at this point.