Back to Linux page of KG
dd_rescue
Like dd, dd_rescue does copy data from one file or block
device to another. You can specify file positions (called seek and
Skip in dd).
There are several differences:
- dd_rescue does not provide character conversions.
- The command syntax is different. Call dd_rescue -h.
- dd_rescue does not abort on errors on the input file, unless you
specify a maximum error number. Then dd_rescue will abort when
this number is reached.
- dd_rescue does not truncate the output file, unless asked to.
- You can tell dd_rescue to start from the end of a file and move bcakwards.
- It uses two block sizes, a large (soft) block size and a small (hard) block
size. In case of errors, the size falls back to the small one and is
promoted again after a while without errors.
- It does not (yet) support non-seekable in- or output.
Purpose of dd_rescue
The latter three features make it suitable for rescuing data from a medium
with errors, i.e. a hard disk with some bad sectors.
Why?
- Imagine, one of your partitions is crashed, and as there are some hard
errors, you don't want to write to this hard disk any more. Just getting
all the data off it and retiring it seems to be suitable. However, you
can't access the files, as the file system is damaged.
- Now, you want to copy the whole partition into a file. You burn it on
CD-Rom, just to never lose it again.
You can setup a loop device, and repair (fsck) it and hopefully are able
to mount it.
- Copying this partition with normal Un*x tools like cat or dd will fail, as
those tools abort on error. dd_rescue instead will try to read and if it
fails, it will go on with the next sectors. The output file naturally will
have holes in it, of course. You can write a log file, to see, where all
these errors are located.
- The data rate drops very low, when errors are encountered. If you
interrupt the process of copying, you don't lose anything. You can just
continue at any position later. The output file will just be filled in
further and not truncated as with other Un*x tools.
- If you have one spot of bad sectors within the partition, it might be a
good idea, to approach this spot from both sides. Reverse direction copy
is your friend.
- The two block sizes are a performance optimization. Large block sizes
result in superior performance, but in case of errors, you want to try
to salvage every single sector. So hardbs is best be set to the hardware
sector size (most often 512 bytes) and softbs to a large value, such as
the default 16k.
More info can be found in the README file included in the package.
Just one note: It does work. I unfortunately did not just create this
program for fun ...
Download
The current version is 1.24, released 2011-10-05.
Version 1.24 contains a compile fix for Linux versions that contain the splice syscall
but not the other definitions. I also allows for specifying a directory (such as ".")
as output filename in which case dd_rescue just appends the input file basename to
it, just like cp does. Maybe most importantly, the RPM now contains the latest
version of dd_rhelp (0.1.2).
The current version is 1.23, released 2010-10-11.
In version 1.23, the default to not sync every 512 soft blocks is now really
changed to only sync at the end (documented for 1.18, but mostly ineffective,
ouch). More importantly, a short read because of EOF is now not considered
an error any more and thus neither triggers messages (with quiet) nor does
it cause a confusing exit code any more.
Version 1.22 contains a number of little improvements: Display of compiler,
compile time, enabled options, don't repeat copy attempts if hardbs == softbs,
fix FPE in progress bar for non-seekable input reverse copy, and make the code
more digestable for non-GCC compilers, optional fallbacks for strsignal,
pread, pwrite. Last not least, the documentation has a few notes on the
goodies now.
Version 1.21 issues warnings when writing in a sparse mode into existing files
or to block devices.
In version 1.20, there's also a progress estimation if input file size is unknown,
but transfer size is limited with -m.
Version 1.19 brings the support for fallocate.
In version 1.18, we have changed the default to -y0 (no fsync), the avg.
speed is calculated in a meaningful way nevertheless now.
In version 1.17, a progress bar, completion percentage and ETA has been added.
In version 1.16, the work was done to determine and display the total amount of data that will be copied.
Version 1.15 brings support for the Linux splice() mechanism to avoid copying data to a userspace bugffer.
In version 1.14, a bug is fixed that could lead to a target file not
having the correct size when copied in sparse (-a) mode.
In version 1.13, a bug with read-errors and non-seekable output has been
fixed.
In version 1.12, the ability to log bad blocks to a ASCII file has been
added. The option -y can be used to set the fsync frequency which
can speed up the copy significantly.
Since 1.10, it has support for non-seekable input and output (so you can write
to pipes, e.g. stdout). Since 1.04, dd_rescue uses a larger default soft block
size (64k instead of 16k), has support for O_DIRECT, for copying the permissions,
and some minor issues fixed.
RPMs since 1.04 also include dd_rhelp.
Since version 1.03, it includes a patch from LAB Valentin which is
needed to properly support his dd_rhelp script
from his dd_rescue page.
See the RPM change log for a more detailed list
of changes.
You can download
- Version 1.24
- Version 1.23
- Version 1.22
- Version 1.21
- Version 1.20
- Version 1.18
- Version 1.15
- Version 1.14
- Version 1.13
- Version 1.12
- Version 1.11
- Older versions
-
Installation and compilation follows the standard ways. If you use Linux,
using rpm --recompile on the source RPM may be your best option.
Copyright
The program is protected by the GNU
GPL.
(w) by KG, last changed 2007-08-29