manpagez: man pages & more
info ddrescue
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Invoking ddrescue

The format for running ddrescue is:

ddrescue [options] infile outfile [logfile]

ddrescue supports the following options:


Print an informative help message describing the options and exit.


Print the version number of ddrescue on the standard output and exit.

-b bytes

Hardware block (sector) size of input device in bytes (usually 512 for hard discs and 3.5" floppies, 1024 for 5.25" floppies, and 2048 for cdroms). Defaults to 512.


Show units with binary prefixes (powers of 1024).
SI prefixes (powers of 1000) are used by default. (See table below).

-c sectors

Number of sectors to copy at a time. Defaults to 64KiB / sector_size. Try smaller values for slow drives. The number of sectors per track (18 or 9) is a good value for floppies.


Limit rescue domain to the blocks listed in the logfile. Do not read new data beyond logfile limits. This is useful when reading from devices of undefined size, like raw devices.


Use direct disc access to read the input file, bypassing the kernel cache. (Open the file with the O_DIRECT flag). Use it only on devices or partitions, not on regular files. Sector size must be correctly set for this to work. Not all systems support this.

If your system does not support direct disc access, ddrescue will warn you. If the sector size is not correctly set, all reads will result in errors, and no data will be rescued.


Use synchronous writes for output file. (Issue a fsync call after every write). May be useful when forcing the drive to remap its bad sectors.

-e n

Maximum number of error areas allowed before giving up. Defaults to infinity.

-F types

Fill the output file blocks specified as any of types in the logfile, with data read from the input file. types contains one or more of the status characters defined in the chapter Logfile Structure (see section Logfile Structure). See the chapter Fill Mode (see section Fill Mode) for a complete description of the fill mode.


Generate an approximate logfile from the input and output files of the original rescue run. Note that you should keep the original offset between ‘--input-position’ and ‘--output-position’ of the original rescue run.

-i pos

Starting position in input file, in bytes. Defaults to 0. In fill mode it refers to the original input file. See the chapter Fill Mode (see section Fill Mode) for details.

-m file

Restrict the rescue domain to the blocks marked as finished in the logfile file. This is useful if the destination drive fails during the rescue.


Stop after the trimming pass. Avoids spending a lot of time trying to rescue the most difficult parts of the file. This option overrides the ‘--max-retries’ option.

-o pos

Starting position in output file, in bytes. Defaults to ‘--input-position’. The bytes below pos aren't touched if they exist and truncation is not requested. Else they are set to 0.


Quiet operation.

-r n

Exit after given number of retry passes. Defaults to 0. -1 means infinity. Every bad sector is tried only one time per pass. To retry bad sectors detected on a previous run, you must specify a non-zero number of retries.


Mark all failed blocks inside the rescue domain as non-trimmed before beginning the rescue. The effect is similar to ‘--max-retries=1’, but the bad sectors are tried in a different order, making perhaps possible to rescue some of them.

-s bytes

Maximum size of the input data to be copied, in bytes. If ddrescue can't determine the size of the input device, you may need to specify it with this option. Note that this option specifies the size of the input data to be copied, not the size of the output file. So, for example, the following command creates an output file 300 bytes long, but only writes data on the last 200 bytes:

ddrescue -i 100 -s 200 infile outfile logfile

Use sparse writes for output file. (The blocks of zeros are not actually allocated on disc). May save a lot of disc space in some cases. Not all systems support this.


Truncate output file to zero size before writing to it. Only works for regular files, not for drives or partitions.


Mark all non-split and non-trimmed blocks inside the rescue domain as non-tried before beginning the rescue. Try this if the drive stops responding and ddrescue immediately starts splitting failed blocks when restarted. If ‘--retrim’ is also specified, mark all failed blocks inside the rescue domain as non-tried.


Verbose mode.

Numbers given as arguments to options (positions, sizes) may be followed by a multiplier and an optional ‘B’ for "byte".

Table of SI and binary prefixes (unit multipliers):








hardware blocks


kilobyte (10^3 = 1000)



kibibyte (2^10 = 1024)


megabyte (10^6)



mebibyte (2^20)


gigabyte (10^9)



gibibyte (2^30)


terabyte (10^12)



tebibyte (2^40)


petabyte (10^15)



pebibyte (2^50)


exabyte (10^18)



exbibyte (2^60)


zettabyte (10^21)



zebibyte (2^70)


yottabyte (10^24)



yobibyte (2^80)

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© 2000-2024
Individual documents may contain additional copyright information.