How do I save (recover) data from crashed disks with dd and ddrescue command?

by on May 3, 2006 · 24 comments· LAST UPDATED September 27, 2007

in , ,

dd_rescue (also known as ddrescue) is a program that copies data from one file or block device to another, it is a tool to help you to save data from crashed partition.

It tries to read and if it fails it will go on with the next sectors, where tools like dd will fail. If the copying process is interrupted by the user it is possible to continue at any position later. It can copy backwards.

Install dd_rescue or ddrescue

If you are using Debian / Ubuntu Linux, type the following command to install ddrescue:
# apt-get install ddrescue

If you are using RedHat /Fedora /CentOS Linux, type the following command:
# yum -y install ddrescue

Or directly download ddrescue from official GNU web site.

Please note that Debian install ddrescue binary as /bin/dd_rescue and other distribution as /usr/bin/ddrescue

How do I use dd_rescue (ddrescue)?

To make exact copy of /dev/sda (damaged) to /dev/sdb (make sure sdb is empty) you need to type following command:
# ddrescue /dev/hda /dev/hdb

Naturally next step is to run fsck on /dev/sdb partition to recover/save data. Remember do not touch originally damaged /dev/sda. If this procedure fails you can send your disk to professional data recovery service. For example if /home (user data) is on /dev/sda2, you need to run a command on /dev/sdb2:
# fsck /dev/sdb2

Once fsck run, mount /dev/sdb2 somewhere and see if you can access data:
# mount /dev/sdb2 /mnt/data

Next take backup using tar or any other command of your own choice.

ddrescue command supports tons of options, read man page for more information:
# man ddrescue
OR
# man dd_rescue
This program is useful to rescue data in case of I/O errors, because it does not necessarily abort or truncate the output. This is why you need to use this program and not dd command.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!
1 billy May 15, 2006 at 2:49 pm

Fantastic post!!! a massive help. Thanks for saving my ass.

2 Anonymous May 23, 2006 at 12:04 am

Very helpul thanks!

3 htc May 18, 2006 at 9:02 pm

Thanks, excellent article.

I have a couple of doubts, though. I haven’t able to install it using apt-get command :( Any hint?

4 nixCraft May 19, 2006 at 1:13 pm

@htc,

Hmm…

Try to update apt database and again run same command:

apt-get update
apt-get install ddrescue

HTH.

5 John June 1, 2006 at 8:23 am

Simple and effective :D good pice of work,IMPO

6 chadrick June 13, 2006 at 6:00 pm

My personal experience is dd is slow and dd will never display any progress (which makes me more nervous about my data … LOL). I love ddrescue – one perfect tool for data recovery.

7 alt August 21, 2006 at 10:05 pm

I have on hd with NTFS file system which has important data to backed up and I have one more computer which has Readhat linux installed on it. How I can use dd_rescue to retrive data out from that hd having NTFS file system.

8 Dad September 14, 2006 at 1:47 pm

Does anyone have a link to a ddrescue man page that is something more than that the program itself puts on screen when the user enters parameters incorrectly? It would be nice to know more about ddrescue than just what the options list is!

9 nixCraft September 14, 2006 at 2:43 pm
10 Scottux October 2, 2006 at 11:25 pm

Is there any other tool to recover files? I have a hard drive with bad sectors. It is an NTFS filesystem and has some importnat data on it. I have tried dd and now ddrescue, to no avail. I was trying to use autopsy/sleuthkit – but it requires an image. I am pulling my hair out trying to recover the files from this thing. I don’t care about the drive, just the data. All RAID from now on.

11 Udit January 20, 2007 at 9:34 am

You guys might want to look at dd_rhelp also
http://www.kalysto.org/utilities/dd_rhelp/index.en.html

I haven’t used it but it seems to shorten the amount of time dd_rescue takes.

12 nixCraft January 22, 2007 at 3:16 pm

Udit,

Thanks for sharing link :)

13 cuvtixo October 2, 2007 at 1:55 am

The Linux tool called GNU ddrescue written by Antonio Diaz Diaz should not be confused with dd_rescue written by Kurt Garloff
They are two different utilities.

14 Anonymous December 23, 2007 at 6:35 pm

Actually, the command on Ubuntu should be
apt-get install gddrescue.

Not ddrescue. You have to have the g there.

15 nixCraft December 23, 2007 at 6:44 pm

On my Ubuntu 7.10, I can install the tool ddrescue
sudo apt-get install ddrescue

And it got installed:
[sudo] password for vivek:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
ddrescue
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 17.6kB of archives.
After unpacking 77.8kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com gutsy/universe ddrescue 1.13-3 [17.6kB]
Fetched 17.6kB in 2s (8220B/s)
Selecting previously deselected package ddrescue.
(Reading database ... 123654 files and directories currently installed.)
Unpacking ddrescue (from .../ddrescue_1.13-3_i386.deb) ...
Setting up ddrescue (1.13-3) ...

16 fd February 12, 2008 at 10:39 am

you write: “dd_rescue (also known as ddrescue)”. they are not at all the same software.

ddrescue and dd_rescue are completely different programs which share no development between them. the two projects are not related in any way except that they both attempt to enhance the standard dd tool and coincidentally chose similar names for their new programs.

ddrescue is the one to get.

17 noodle January 14, 2009 at 10:40 am

actually gddrescue is the one you want, its updated more frequently and incorporates the functions of the original dd_rescue and dd_rhelp.

18 webmaster screenshotscores July 14, 2009 at 1:08 pm

nice one, very helpful!

19 Rich August 16, 2009 at 1:23 pm

for clarity,
* the PACKAGE “gddrescue” provides the COMMAND ddrescue
* the PACKAGE “ddrescue” provides the COMMAND dd_rescue

GNU ddrescue is the first one, and seems IMHO better/more flexible than dd_rescue.

20 wav August 13, 2010 at 11:34 am

Damn, i can’t get it to work!!

when I use the given command to start copying the img file, i get told that the destination is not a directory!

I created a directory called backup.img but still get the stupid error

so do you all are so very happy that it works

21 brain October 6, 2010 at 2:38 am

well said wav…

Look forward to a resolution posting.

Thanks in advance to all.

B

22 nodonttakethose January 18, 2011 at 9:02 am

Correction:
ddrescue dose not equal dd_rescue!!! The apt database is confusing in this regard.
“ddrescue” (gddrescue in apt) is a GNU app that is _far_ superior to dd_rescue (ddrescue in apt). Check synaptic. Check man page and info for GNU ddrescue at the linked site below. As I said it’s far superior to dd_rescue (faster, more sensible output).

http://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html#Fill-Mode

23 nathan December 6, 2011 at 1:26 pm

hai there. befpre i run these commands, do need to download any software? if yes, how to do it?? im a newbie:-)

24 gardenman April 5, 2012 at 1:28 am

just start the terminal and type sudo apt-get install gddrescue and hit enter

Comments on this FAQ are closed. If you'd like to continue the discussion on this topic, you can do so at our forum.

Tagged as: , , , , , , , , , , , , ,

Previous post:

Next post: