ddrescue data recovery tool

GNU ddrescue is a data recovery tool in Linux. It copies data from one file or block device (hard disc, cdrom, etc) to another, trying hard to rescue data in case of read errors. The basic operation of ddrescue is fully automatic. That is, you don’t have to wait for an error, stop the program, read the log, restart it from a new position, etc.

If you use the logfile feature of ddrescue, the data is rescued very efficiently, (only the needed blocks are read). Also you can interrupt the rescue at any time and resume it later at the same point.

ddrescue data recovery tool in Linux

Ddrescue is like any other power tool. You need to understand what it does, and you need to understand some things about the machines it does those things to, in order to use it safely.

Always use a logfile unless you know you won’t need it. Without a logfile, ddrescue can’t resume a rescue, only reinitiate it.

Never try to rescue a r/w mounted partition. The resulting copy may be useless.

Never try to repair a file system on a drive with I/O errors; you will probably lose even more data.

If you use a device or a partition as destination, any data stored there will be overwritten.

Some systems may change device names on reboot (eg. udev enabled systems). If you reboot, check the device names before restarting ddrescue.

Download latest version

#cd /usr/local/src
#wget http://infinity.kmeacollege.ac.in/gnu/ddrescue/ddrescue-1.16.tar.gz
#tar -zxvf ddrescue-1.16.tar.gz
#cd ddrescue-1.16
#./configure
#make
#make install

The format for running ddrescue is:

ddrescue [options] infile outfile [logfile]

ddrecovery tool in linux

 

Example 1:

Rescue a whole disc with two ext2 partitions in /dev/hda to /dev/hdb.
Note: you do not need to partition /dev/hdb beforehand, but if the partition table on /dev/hda is damaged, you’ll need to recreate it somehow on /dev/hdb.

ddrescue -f -n /dev/hda /dev/hdb logfile
ddrescue -d -f -r3 /dev/hda /dev/hdb logfile
fdisk /dev/hdb
e2fsck -v -f /dev/hdb1
e2fsck -v -f /dev/hdb2

Example 2:

Rescue an ext2 partition in /dev/hda2 to /dev/hdb2.
Note: you need to create the hdb2 partition with fdisk first. hdb2 should be of appropiate type and size.

ddrescue -f -n /dev/hda2 /dev/hdb2 logfile
ddrescue -d -f -r3 /dev/hda2 /dev/hdb2 logfile
e2fsck -v -f /dev/hdb2
mount -t ext2 -o ro /dev/hdb2 /mnt
(read rescued files from /mnt)

Example 3:

While rescuing the whole drive /dev/hda to /dev/hdb, /dev/hda freezes up at position 12345678.

ddrescue -f /dev/hda /dev/hdb logfile       <– /dev/hda freezes here
(restart /dev/hda or reboot computer)
(restart copy at a safe distance from the troubled sector)
ddrescue -f -i 12350000 /dev/hda /dev/hdb logfile
(copy backwards down to the troubled sector)
ddrescue -f -R /dev/hda /dev/hdb logfile

Example 4:

While rescuing the whole drive /dev/hda to /dev/hdb, /dev/hdb fails and you have to rescue data to a third drive, /dev/hdc.

ddrescue -f -n /dev/hda /dev/hdb logfile1     <– /dev/hdb fails here
ddrescue -f -m logfile1 /dev/hdb /dev/hdc logfile2
ddrescue -f -n /dev/hda /dev/hdc logfile2
ddrescue -d -f -r3 /dev/hda /dev/hdc logfile2

Example 5:

While rescuing the whole drive /dev/hda to /dev/hdb, /dev/hda stops responding and disappears from /dev.

ddrescue -f -n /dev/hda /dev/hdb logfile      <– /dev/hda fails here
(restart /dev/hda or reboot computer as many times as needed)
ddrescue -f -n -A /dev/hda /dev/hdb logfile
ddrescue -d -f -r3 /dev/hda /dev/hdb logfile