dd_rescue: the usual dd with data recovery functions

Translation of the original in Catalan. Read it in: CatalàCastellano

[ X.Caballé ] A tool called dd_rescue is a tool for copying data from a file or a block device (such as a hard disk or a CD, for example) to another, with the particularity that it tries to recover the data if it detects a read error. Unlike the original dd, it does not truncate the output file, unless we tell it to do so.

That way, every time we run it against the same output file it tries to fill the holes. The dd_rescue algorithm reads the part that is not damaged. Then it reads the damaged parts, dividing them into smaller ones and trying to recover the information. It repeats this operation until it reaches the hardware block size, reaches the indicated limit of attempts or the user interrupts the operation.

How it works algorithm

  • Read the non-damaged part of the disk, skipping the damaged areas.
  • Read a list of bad blocks (damaged areas) from a file.
  • Try to read the damaged areas, splitting them into smaller pieces and reading the non-damaged pieces, until the hardware block size is reached, or until interrupted by the user.
  • Try to read the damaged hardware blocks until the specified number of retries is reached, or until interrupted by the user.
  • Optionally write a list of bad blocks to a file.