Friday, September 25, 2009

ddrescue dd_rescue gddrescue gnuddrescue myrescue ... which to choose?

I hadn't done a recovery in a while that needed special attention, and ended up wasting a bunch of time fiddling the the ddrescue variants before I found the one I had used in the past.

I fumbled around with dd_rescue for a while thinking that it was the one that I had wanted, since I thought I had remembered using the one that had a dash or underscore in the name previously. Unfortunately after having left it running over night, I found that it was not the one I was expecting, since I cancelled (CTRL-C) the command in the morning, and then tried to continue by simply entering in the same command again, only to find it repeated copying the same areas it had already done, so it wasn't being "smart" ... even though I had told it to use a logfile, and a bad block bbfile. This sent me on a search trying to see if I was running it wrong, or was missing something. Then I ran across a comment on the digg article talking about dd_rescue (2006), that happened to mention

"Dave Burton Says:
February 3rd, 2007 at 9:56 am

Rakesh,

Here’s a better link:
http://freshmeat.net/search/?q=ddrescue
(That link finds both ddrescue and dd_rescue.)

The program described in this article is Garloff’s original dd_rescue.

The program which I very much prefer is Diaz’s newer GNU ddrescue."

This twigged my memory, as well as reading the rest of the comment, it pointed out that gddrescue (diaz's) provided for "remembering" what blocks it had recovered so it doesn't try to go over the same area twice.

I promptly installed gddrescue using "apt-get install gddrescue" and then tried to view the man pages, of course using "man gddrescue" ... however, this is where some of the ddrescue confusion comes in, "gddrescue" simply uses ddrescue for its binary and for its man pages... (confusing), since "dd_rescue" actually uses a package name of "ddrescue" (apt-get install ddrescue), while using dd_rescue for its binary and man pages (once again, confusing).

gddrescue (package name=gddrescue, binary=ddrescue, man=ddrescue) is the one I wanted all along (hence why I'm now writing a blog post so I don't forget in the future).

I had also tryed "myrescue", it has a really good concept, however, its execution leaves a little to be desired... I tried using it on a 200MB partition (that had no errors), and then used dd, dd_rescue, gddrescue on the same partition, all to different output files. After "rescuing" the partition 4 times, I compared all the output files to each other, the first obvious difference is the file size of the myrescue image was 1024 bytes smaller than the other 3 files. The "other 3" files are the same as each other according to diff, while the 4th (myrescue) file is tagged as being different from the others (obviously, if its size isn't even the same). I also noticed that if I used a different block size (larger generally), that when myrescue reached the "end" of the partition, it never "completed" while still using a bunch of cpu processing time, and just never letting go, or saying it was "done". I'm guessing there's a bug in there somewhere regarding end position or something like that.

Thats the end of the post for now.

edit:
Some useful links:
- Ubuntu DataRecovery Howto, do it yourself
- Comment regarding which ddrescue to use, reminding me that it is GNU ddrescue (the gddrescue package, but 'ddrescue' binary) that I found most useful in the past
- A nifty looking ubuntu image (iso or memory stick) already setup for data recovery (removing the need for internet to download most tools you would need for recovery work), and providing a lower over-head environment (command line only, no GUI), but also offers a repository that you can use to add the same recovery tools to an already installed or live copy of ubuntu, which you might have a GUI on already.

notes:
- for first run of gddrescue, it may be wise to add the --no-split (or -n) option, as described in the texinfo manual, it says:
--no-split: Do not try to split error areas. Allows a fast recovery of the non-damaged part of the file.


- after the first run, or if the first run is having issues, you may want to try the following:
hdparm -a0 -A0 /dev/bad-device
and then re-running ddrescue using the logfile you hopefully told it to use on the first (and any successive) runs of ddrescue, this command will disable any read-ahead that the hard-drive tries to do on your behalf, but also brings your copying rate to a dismally slow speed (100k-200k/sec in my case of recovery on an 80gb laptop drive attached directly by ide), so you may want to try your luck without disabling it at first

- check the texinfo manual for some data recovery execution examples as well