LINUX - dd_rescue VS ddrescue (gddrescue BEST)


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 is ddrescue (which has the command name: dd_rescue, and package name: ddrescue). I used highlights to emphasize the main points.

LINUX - 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 (command name: dd_rescue, package name: ddrescue, install command: apt-get install ddrescue)
=========
dd_rescue [options] SOURCE DESTINATION
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

AFTER DONE IF MORE THEN 100 errors I DO A REVERSE COPY WHERE IT COPIES FROM THE END OF THE DISK
dd_rescue -r /dev/sda /dev/sdb

NOTE HERE FOR REVERSE IS little r

--logfile--
* For each operation keep a different log file, save the log file to not the destination and not 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

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

--best way to run - in my opinion--
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 -rv -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 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
-n = copy the none problematic areas

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.

ddrescue [options] SOURCE DESTINATION LOGFILE

SIMPLE WAY -r3 SAYS TO RETRY BAD BLOCKS 3 TIMES BEFORE GIVING UP AND CONTINUING TO NEXT BLOCK
ddrescue -r3 /dev/sda /dev/sdb /root/logfile

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)

--restartability--
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
HIT UP ARROW AND ENTER OR JUST RETYPE AND HIT ENTER
ddrescue -r3 /dev/sda /dev/sdb /root/logfile
And it will start where it left off

--reverse clone--
NO NEED FOR REVERSE COPY HERE BUT TO DO REVERSE COPY
ddrescue -R -r3 /dev/sda /dev/sdb /root/logfilerev
SAVE THE REVERSE LOGFILE INTO A DIFFERENT LOCATION THEN FIRST

--another cool way to rescue disk---
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 -n /dev/sda /dev/sdb rescue.log

attempt to recover any bad sectors:
ddrescue -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 wolframalpha.com) 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---
ddrescue -b 2048 /dev/cdrom cdimage /root/logfile

HOW TO INSTALL THE BETTER ONE AND TELL THE DIFFERENCE BETWEEN THEM
##################################################################

Well with debian

The better one: ddrescue comes with the installer 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

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

which dd_rescue
/bin/dd_rescue

dpkg -S /bin/dd_rescue
ddrescue: /bin/dd_rescue

which ddrescue
/sbin/ddrescue

dpkg -S /sbin/ddrescue
gddrescue: /sbin/ddrescue


A NOTE ABOUT WHY WE DONT USE DD
################################

dd 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 is much smarter and dd_Rescue is alittle smarter.
SelectionFile type iconFile nameDescriptionSizeRevisionTimeUser
Comments