Ddrescue

ddrescue is a tool provided by GNU to retrieve data from failing (block) storage devices like hard disk drives, cdrom or memory sticks etc. It uses a similar technique as dd and copies block by block, but has an intelligent algorithm to recover failed data.

Installation
You can install using the following command:

Usage
The general purpose of ddrescue is to recover data from failing block devices. It can be also used as a general disk (or even file) copying tool with quite a good efficiency and a nice progress bar.

Copy data
ddrescue can use block devices or files as input and output. The main difference to other programs to copy files, the destination needs to be specified:

Rescue data
The strategy is to read and copy as much data as possible in the first round, since every access to the storage device could be the last one before it totally fails. Then try to copy the data off the failed/failing areas on drive. Things to check before getting started:
 * the exact device name of the drive to rescue and any other device involved.
 * check the drive' health using smartmontools
 * the drive should not be mounted during the process.
 * enough disk space for recovered data.
 * enough time, the process may take a couple of hours

Disk to Image
In this scenario the hard disk drive is about to fail and we want to create a copy in form of an image.
 * First round, we just copy every block without read error and log the errors into


 * -f - force, this makes ddrescue run, even if the destination file already exists
 * -g - generate a logfile to continue later and do not copy data twice
 * -n - do not look for other parts of a file to reconstruct the data


 * Second round, we copy only the bad blocks and try 3 times to read from source before we give up


 * -d - use direct access to the drive and skip any cache
 * -rN - try N times to rescue the block


 * Now the image could be mounted as loop device and the file system checked for corruption

Disk to Disk
In this scenario the hard disk drive is about to fail and we want to create an exact copy on a new hard disk drive, which should be at least the same size as the source drive.
 * First round, we just copy every block without read error and log the errors into


 * Second round, we copy only the bad blocks and try 3 times to read from source before we give up


 * Now the new drive could be mounted and the file system checked for corruption

External resources

 * gnu.org homepage