Linux: Recover data from the crash disk

November 28, 2006 / General Discussion

If you have Linux flavor OS installed and if your disk is crashed then try the following steps if you want to retrieve data from ddrescue commands.

Ddrescue is a program that copies data from one file or blocks the 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 backward.
Install dd_rescue or ddrescue

If you are using RedHat/Fedora Core Linux, type the following command:
# yum -y install ddrescue
If you are using Debian Linux:# apt-get install ddrescue
Or directly download rescue from the official GNU Web site. www.gnu.org/software/ddrescue/ddrescue.html

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

To make an exact copy of /dev/sda (damaged) to /dev/sdb (make sure sdb is empty) you need to type the following command:

# ddrescue /dev/hda /dev/hdb
Naturally next step is to run fsck on the/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 a 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

It is time to take backup using tar command.

ddrescue command supports tons of options. Don’t forget to read the man page:

# man ddrescue OR # man dd_rescue