Just so your not confused right off the bat, the better one is gddrescue (which has the command name: ddrescue and package name: gddrescue), and the older not as good one isddrescue (which has the command name: dd_rescue, and package name: ddrescue). I used highlights to emphasize the main points.


dd_rescue VS ddrescue (gddrescue BEST)

Side note about both: the log file has to be made not on the source drive and not on the destination drive for obvious reasons.

The syntax of both is always SOURCE then DESTINATION


dd_rescue/ddrescue (the worse one)

(command name: dd_rescue, package name: ddrescue, install command: apt-get install ddrescue)

dd_rescue [options] SOURCE DESTINATION

Simplest way to run this command would be this:

dd_rescue /dev/sda /dev/sdb

Common options:

-l logfile = creates a logfile called logfile for the curious reader displays info of the copy

-r = reverse clone from the back of the disk

-v = verbosity

dd_rescue -v -r -l /root/clone.log /dev/sda /dev/sdb

When the dd_rescue command is done, if there is more than 100 errors I begin a reverse clone so that it can try and get those errors from the back.

dd_rescue -r /dev/sda /dev/sdb

Note that reverse here is little r


* For each operation keep a different log file, save the log file to a location thats not on the destination and not on the source.

If you want a simple log file, note this log file cannot be used to restart the copy where it left off like with the ddrescue log file (you will see this effect below in the other app)

dd_rescue -l /root/logfile /dev/sda /dev/sdb

or logfile with reverse

dd_rescue -r -l /root/logfile /dev/sda /dev/sdb


Read the article below about installing them, as both dd_rescue(the worse one) and ddrescue(the better one) have similar package names.

–my favorite way to run–

I recommend having a screen session running, or being in a dtach. For more info just google screen or dtach, but essentially it just prevents a close of the putty screen from ending the command while its running, in which case you have to start over. In the better one, gddrescue, a crash is okay as it can be restarted because of the log file

Here the copy is from sda to sdb, and log is made on tmp (note that tmp where the log is made is not on sda and its not on sdb)

dd_rescue -v -l /tmp/sda_to_sdb.log /dev/sda /dev/sdb

And if you see alot of errors do the reverse copy

dd_rescue -r -v -l /tmp/sda_to_sdb_rev.log /dev/sda /dev/sdb

Notice the log file here is different from the reverse procedure


 ddrescue/gddrescue (The better one)

DDRESCUE (gddrescue the best one) (command name: ddrescue, package name: gddrescue, install command: apt-get install gddrescue)

Sometimes called the GNU ddrescue

Or with debian:

gddrescue – the GNU data recovery tool


Common options:

-R = reverse clone, from the back of the drive

-r# = retry number, every time an error is encountered how many times it will retry to copy that error

-n = copy the none problematic areas

-f = force (sometimes ddrescue will not let you clone block devices such as /dev/sd* unless you specify force)

log file comes in handy as can be used to restart a failed/canceled/crashed operation, The logfile is optional but its dumb not to include it with this command as it keeps track of the progress of every block and if the ddrescue stops because of a system crash or user initiated stop we can restart the ddrescue process with the SAME COMMAND, no need for extra arguments telling it to start where it left off from what the log says, its smart enough to look at the log and restart where needed.

Make sure the log file is saved to a location thats not on the source and not on the destination.


Simplest way to run the command would be this (-f might be optional):

ddrescue -f /dev/sda /dev/sdb /root/clone.log



Make sure to keep the same logfile between operations, as the logfile keeps track of progress, so unlike the old dd_rescue where the logfile was just sheer information for the curious reader, the logfile here is kept for keeping track of progress for the program, therefor it can restart.

just make sure the logfile is being saved to different location then the source(and preferably the destination, just incase it gets too big, which it wont but who knows)


If copy fails just repeat the command

You can even do this to test the restartability of this app:

ddrescue -r3 /dev/sda /dev/sdb /root/logfile

CONTROL-C to cancel

Repeat the command

ddrescue -r3 /dev/sda /dev/sdb /root/logfile

And it will start where it left off

–reverse clone–

The manual atests to a clone algorithm which is so good that reverse clones are probably no longer necessary (even if errors are encountered, instead use the method in the section below). However if you do need to clone in reverse you use a capital -R (with dd_rescue its a little -r for reverse)

ddrescue -R -r3 /dev/sda /dev/sdb /root/logfilerev.txt

Its probably best to save the reverse log file to another location so that it does the clone from the beginning (it will overwrite ontop of the stuff thats on the destination – /dev/sdb in this case, so whatever -R gets out that the normal forward seeking algorithm couldnt get out, would get overlayed in the correct location)

If you want to reuse your log file from the forward seek, you can. It will just try to go over the areas it wasnt able to recover with the reverse seeking algorithm.

–My favorite way to rescue a regular hard drive—

First lets copy the good none damaged blocks with -n, the logfile will be filled with information of what blocks it skipped because they were problamatic, so the next time you run the command without the -n arguments it will go over the errors

Rescue an entire hard disk /dev/sda to another disk /dev/sdb

copy the error free areas first:

ddrescue -v -n /dev/sda /dev/sdb rescue.log

attempt to recover any bad sectors with 1 retry (as thats whats left over if we copied all of the error free areas already):

ddrescue -v -r1 /dev/sda /dev/sdb rescue.log

Example: I had one situation where the -n copy took very long time, like 2 days for a 2 TB drive, anyways it got down to like 99.999% of the drive was cloned (i calculated the percentage with so I called it good. It speeded for the first part of the drive, but was at a crawl for the last day and a half, it took like 1.5 days to grab the final 15 gigs, anyhow, I called it good and I didnt even get to the -r1 clone. I trusted it was good enough, and it was, either way if it wasnt i would just try again with -r1.

—rescue a cdrom—

If you want to clone a cdrom.

ddrescue -b 2048 /dev/cdrom cdimage /root/logfile




The better one: ddrescue is installed by asking apt-get to install gddrescue

So to install this do

apt-get update

apt-get install gddrescue


The worse one: dd_rescue comes with the installer ddrescue

So to install this do

apt-get update

apt-get install ddrescue

Note you can have both installed on your system like I do on this debian system.

This is how I found that out

apt-get update

apt-cache search ddrescue | egrep ddrescue

Look through all of your command for the keyword rescue: compgen -c | grep rescue


Another confirmation is by running which (which tells me where the app sits) and dpkg -S (which tells me what package a certain file belongs to)


which dd_rescue


dpkg -S /bin/dd_rescue

ddrescue: /bin/dd_rescue


which ddrescue


dpkg -S /sbin/ddrescue

gddrescue: /sbin/ddrescue


So to summarize:

apt-get install gddrescue –> better one (command name: ddrescue)

apt-get install ddrescue –> worse one (command name: dd_rescue)


So why not just use DD or CP or CAT to clone drives?

We could just use one of these commands to clone/copy a drive, but why dont we?

cp /dev/sda /dev/sdb

cat /dev/sda > /dev/sdb

dd if=/dev/sda of=/dev/sdb bs=1M

dd/cat/cp stops after it encounters an error, and doesnt have a smart algorithm about it, it just goes from front to back and might damage the disk more, where as ddrescue & gddrescue are much smarter – they dont quit on errors, and they have better cloning algorithms.

If… the drives were in perfect health than Ideally the following 5 commands would generate the same destination.

cp /dev/sda /dev/sdb

cat /dev/sda > /dev/sdb

dd if=/dev/sda of=/dev/sdb bs=1M

ddrescue /dev/sda /dev/sdb /root/ddlog.txt

dd_rescue /dev/sda /dev/sdb


Final Sidenote:

This whole time we have been cloning drives to drives. you can clone drives to a file instead. Of your can copy other block devices such as filesystems to files or drives. Any block device to another block device or a file.

ex1: Backing up LVM  logical volume b in volume group a to a file on /data (which happens to be a huge mount location so it can hold all of logical volume bs data)

ddrescue -f /dev/a/b /data/volume-c.bak


ex2: Backing up a whole raid to a file

ddrescue -f /dev/md1 /mnt/raid-md1.bak

Leave a Reply

Your email address will not be published. Required fields are marked *