ddrescue
Recover data from failing storage devices
TLDR
Take an image of a device, creating a log file
Clone Disk A to Disk B, creating a log file
SYNOPSIS
ddrescue [options] infile outfile [logfile]
PARAMETERS
-a, --ask
ask before overwriting existing data in outfile
-b, --block-size=bytes
set data block size to bytes; default 1024
-B, --binary-prefixes
use binary (KiB, MiB, GiB) instead of decimal prefixes
-c, --cluster-size=n
read forward n blocks then backward 1 block
-C, --compare
compare trial copies to final copies in third pass
-d, --direct
use direct disk access for infile and outfile
-D, --retrim
trim areas of outfile before writing
-e, --skip-errors
continue after all read errors (same as --force)
-f, --force
overwrite outfile and ignore its size
-F, --fill-mode
fill with filltype: zero, zeroes, zeros, nul, nuls, nul-fill, nulls, 0x00
-g, --max-error-granularity=n
exit if average bad sector length is n blocks or more
-G, --generate-badblocks
output bad blocks list to stdout
-h, --help
print this help
-i, --ignore-ipcs
do not abort on SIGINT and SIGPIPE if IPCS is full
-I, --iterative
do multiple passes over bad areas until all are rescued
-J, --jpeg
try to repair damaged JPEG files
-K, --keep-size
do not truncate outfile
-L, --color-level=n
control use of ANSI color codes; 0=none, 1=err, 2=warn, 3=all
-m, --match-blocksizes
match block sizes in mapfile
-M, --do-mapfile-checksums
compute and check mapfile checksums
-n, --no-scrape
skip the scraping phase
-N, --no-trim
do not trim trailing zeros
-o, --overwrite
overwrite existing data; same as --force
-O, --no-overwrite-errors
continue after write errors
-P, --compare-process=n
compare n blocks in parallel
-Q, --use-pcache-size=bytes
set persistent cache size
-r, --retry-passes=n
do n scraping passes; default 0
-R, --reverse
read blocks in reverse order
-s, --size=bytes
copy only bytes starting from 0
-S, --sparse
use sparse writes for outfile
-t, --truncate
truncate outfile to zero length
-T, --timeout=n
wait n seconds for read requests
-u, --unbuffered-input
use unbuffered input
-U, --unbuffered-output
use unbuffered output
-v, --verbose
be more verbose
-V, --version
print version info
-w, --wait-retry=n
wait n ms before retrying read
-W, --no-warnings
suppress warnings
-x, --ignore-checksums
do not check mapfile checksums
-X, --extend-outfile
extend outfile if it is shorter than infile
-y, --retry-mapfile
retry reading mapfile on error
-Z, --debug
set debug level (0-10)
DESCRIPTION
ddrescue is a powerful GNU utility for recovering data from damaged storage media like hard drives, SSDs, CDs, or DVDs. Unlike dd, which stops or retries indefinitely on errors, ddrescue intelligently skips bad sectors, marks them in a log file, and retries in later passes using sophisticated algorithms. It performs multiple passes: first a direct copy of good data, then scraping bad areas with reduced speed, and finally intensive retrying.
It supports huge files (terabytes), direct I/O for speed, cluster reads, and splitting large jobs. A mapfile (logfile) tracks progress, domains (good/bad/non-tried), and allows safe resumption after interruptions. This makes it essential for disk cloning or imaging failing drives.
Key advantages include non-contiguous copying, reverse direction scraping (-R), and options for sparse files or truncation. Always run as root for block devices and test on copies first to avoid data loss.
CAVEATS
Requires root for raw devices; test on images first to avoid data loss; logfiles essential for resumability; can take days/weeks for large failing drives; no write support to source.
BASIC USAGE EXAMPLE
ddrescue -d -r3 /dev/sdX image.img rescue.log
Starts fast copy with direct I/O, 3 retries, log for resume.
PHASED APPROACH
1. Fast copy: ddrescue -n /dev/sdX image.img mapfile
2. Scrape: ddrescue -d -r3 /dev/sdX image.img mapfile
3. Intensive: ddrescue /dev/sdX image.img mapfile
HISTORY
Developed by Antonio Díaz Díaz since 2000; GNU ddrescue 1.0 released 2004; latest 1.11.1 (2024). Evolved from dd_rescue, now standard for data recovery, with improvements in multi-pass algorithms, speed, and large disk support.
SEE ALSO
dd(1), dd_rescue(1), ddrescueview(1), gnu-parted(8)


