Ddrescue: Data Recovery tool for Ubuntu Linux (CLI)


“Ddrescue” is  command-line based (easy to use) data recover tool for the GNU/Linux platform, that lets you recover data from devices such optical discs Hard disk drives. If your default file copy tool gives you read-errors and cannot copy files, then “Ddrescue” might be able to help you out.

But please be aware that, depending on the size of the damage (say that you have a disc with lots of scratches etc), it might or might not be able to fully recover the data. But one advantages of using such a tool is that, it lets you “skip” the sectors with read-errors and copy the rest of the file.

This however, is not always useful while recovering highly sensitive data (such as a software utility for instance), as in those cases, there shouldn’t be any corrupted data whatsoever.

But, for other file types such as videos for example, lacking few sectors (data) wouldn’t hurt at all (most of the time). Though you will have few glitches while playing those sectors, but assuming the damage is small, then it should be watchable. But, it’s impossible with the file copy tool that comes with your OS, as it just stops copying the file as soon as a read-error is detected.

An output that “ddrescue” gives you when running …

Now, I have this somewhat, troublesome video disk with few bad sectors and decided to put it to the test using “Ddrescue”, in Ubuntu :). Did it recover it? Not completely (it failed to read few sectors and skipped few Megabytes as a result), and the video even lacked few minutes in the middle. Still, I was able to watch it, where it was impossible before (other than manually skipping those frames in “mplayer”).

But, if your media is not heavily damaged, then who knows, “Ddrescue” might even be able to recover data completely.

Few main features …

*. Supports both fixed disks (such as Hard disk drives and partitions) and optical discs.

*. Attempts to read the discs, even if they’re not mountable.

*. Copy the whole partition/disc into a disc image or, you can recover individual files as well.

*. “Resuming” is supported: if you cancel the data recovery process at one point, then the next time you try to recover the same file, “Ddrescue” will resume from that last position!, saving both time and hassle (a lot of it :D).

*. As you can see from the above screenshot, it outputs some info while recovering such as: rescued data (in “Kilobytes”), amount of errors, size of the total errors, current and average read speed etc.

*. You can change the buffer-size, direct device access, enable/disable data “filling” (unless you enable this feature, it won’t fill bad sectors with “zero bytes” and only marks them as bad-sectors), maximum amount of read-attempts and few other options which are intended towards advanced users.

You can install “Ddrescue” in Ubuntu 12.04 Precise Pangolin, 11.10 Oneiric Ocelot, 11.04, 10.10 and 10.04 (already has a package for 12.10 too) by using the below command in your Terminal window.

sudo apt-get install gddrescue

Few simple examples …

The basic usage of “ddrescue” is as follows.

ddrescue input-file-path output-file-path logfile

But to clear few things, let me give you an example.

Say that I have an optical disc mounted as “my_disc” (by default in the “/media” folder) and need to recover a file called “my_video.mp4″ inside it. Then to attempt a recovery with “ddrescue” and to save it in my Home folder, I’ll use the below command in the Terminal window.

ddrescue /media/my_disc/my_video.mp4 /home/gayan/recovered_video.mp4 logfile

You can cancel the rescuing process anytime by pressing the “Ctrl” + “c” keys. And if you want to resume later, then make sure to always use the “logfile” argument, as shown.

If you’re trying to recover a partition on a HDD, USB etc, then make sure to mount it with read-only permissions.

It has an excellently written manual which explains a lot (changing the “buffer-size”, maximum error count etc) and I highly recommend that you read it. For that, use the below command.

info ddrecsue

Though it won’t always work out, but if you’re looking for an easy to use data recovery tool that you can use in Ubuntu (or GNU/Linux), then “Ddrescues” is a pretty powerful tool that will come in handy at times. Good luck.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>