## 1 Introduction ¶

GNU ddrescue is a data recovery tool. It copies data from one file or block device (hard disc, cdrom, etc) to another, trying to rescue the good parts first in case of read errors.

The basic operation of ddrescue is fully automatic. That is, you don’t have to wait for an error, stop the program, restart it from a new position, etc.

If you use the mapfile feature of ddrescue, the data are rescued efficiently, (only the blocks needed are read). Also you may interrupt the rescue at any time and resume it later at the same point. The mapfile is an essential part of ddrescue’s effectiveness. Use it unless you know what you are doing.

Ddrescue does not write zeros to the output when it finds bad sectors in the input, and does not truncate the output file if not asked to. So, every time you run it on the same output file, it tries to fill in the gaps without wiping out the data already rescued.

Automatic merging of backups: If you have two or more damaged copies of a file, cdrom, etc, and run ddrescue on all of them, one at a time, with the same output file, you will probably obtain a complete and error-free file. This is so because the probability of having the same area damaged in all copies is low (if the errors are randomly located). Using the mapfile, only the blocks needed are read from the second and successive copies.

Ddrescue recommends lzip for compression of backups because the lzip format is designed for long-term archiving and provides data recovery capabilities which nicely complement those of ddrescue. (Ddrescue reads as many sectors as it can, while lziprecover uses other data to repair the sectors that ddrescue was not able to read). If the cause of file corruption is a damaged medium, the combination ddrescue + lziprecover is the recommended option for recovering data from damaged files. See lziprecover-example, lziprecover-example2, and lziprecover-example3, for examples. See the lziprecover manual for details about lziprecover.

Because ddrescue needs to read and write at random places, it only works on seekable (random access) input and output files. Therefore, the only way of creating a compressed image with ddrescue is to create a normal (uncompressed) image first, and then compress that image.

If your system supports it, ddrescue can use direct disc access to read the input file, bypassing the kernel cache.

One of the strengths of ddrescue is that it is interface-agnostic, and so can be used for any kind of device supported by your kernel (ATA, SATA, SCSI, old MFM drives, floppy discs, or even flash media cards like SD).

Ddrescue also features a ’fill mode’ able to selectively overwrite parts of the output file, which has a number of interesting uses like wiping data, marking bad areas, or even, in some cases, "repair" damaged sectors.