Next: Direct disc access, Previous: Optical media, Up: Top [Index]
This tutorial is for those already able to use the dd command. If you don’t know what dd is, better search the net for some introductory material about dd and GNU ddrescue first.
A failing drive tends to develop more and more errors as time passes. Because of this, you should rescue the data from a drive as soon as you notice the first error. Be diligent because every time a physically damaged drive powers up and is able to output some data, it may be the very last time that it ever will.
You should make a copy of the failing drive with ddrescue, and then try to repair the copy. If your data is really important, use the first copy as a master for a second copy, and try to repair the second copy. If something goes wrong, you have the master intact to try again.
If you are trying to rescue a whole partition, first repair the copy with e2fsck or some other tool appropriate for the type of partition you are trying to rescue, then mount the repaired copy somewhere and try to recover the files in it.
If the drive is so damaged that the file system in the rescued partition can’t be repaired or mounted, you will have to browse the rescued data with an hex editor and extract the desired parts by hand or use a file recovery tool like photorec.
If the partition table is damaged, you may try to rescue the whole disc, then try to repair the partition table and the partitions on the copy.
If the damaged drive is not listed in /dev, then you cannot rescue it. At least not with ddrescue.
See Optical media, for rescue examples of CD-ROMs and DVDs.
Example 1: Rescue a whole disc with two ext2 partitions in /dev/hda to
/dev/hdb.
Note: you don’t 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 mapfile ddrescue -d -f -r3 /dev/hda /dev/hdb mapfile 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 appropriate type and size.
ddrescue -f -n /dev/hda2 /dev/hdb2 mapfile ddrescue -d -f -r3 /dev/hda2 /dev/hdb2 mapfile 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 mapfile <-- /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 mapfile (then copy backwards down to the troubled sector) ddrescue -f -R /dev/hda /dev/hdb mapfile
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 mapfile1 <-- /dev/hdb fails here ddrescue -f -m mapfile1 /dev/hdb /dev/hdc mapfile2 ddrescue -f -n /dev/hda /dev/hdc mapfile2 ddrescue -d -f -r3 /dev/hda /dev/hdc mapfile2
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 mapfile <-- /dev/hda fails here (restart /dev/hda or reboot computer as many times as needed) ddrescue -f -n -A /dev/hda /dev/hdb mapfile ddrescue -d -f -r3 /dev/hda /dev/hdb mapfile
Next: Direct disc access, Previous: Optical media, Up: Top [Index]