Sunday, December 16, 2012

Recover a dead hard drive with ddrescue

I use Ubuntu, so this is geared towards using that OS, but gddrescue (ddrescue) should be available on most Linux distributions.

I got most of this info from:

Install with:
sudo apt-get install gddrescue

Find the disk to rescue with:
sudo fdisk -l

Then run the command using a command like this:
sudo ddrescue -r 5 /dev/sdf /tank/Backup/image /tank/Backup/logfile

In this case 5 is the number of retries attempted to read the data before giving up, /dev/sdf is the path to the device that you found via fdisk -l /tank/Backup/image is the image file that will be written. /tank/Backup/logfile is a logfile that is kept of the recovery.

If the backup is interrupted or you want to run it for another pass with hopes of recovering more information use a command like this:
sudo ddrescue -r 5 -C /dev/sdf /tank/Backup/image /tank/Backup/logfile

Note the -C which tells ddrescue to pickup where it left off, or try to fill in the blocks that are missing