[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7 A small tutorial with examples
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 appropiate 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.
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: Rescue a CD-ROM in /dev/cdrom.
ddrescue -n -b2048 /dev/cdrom cdimage logfile ddrescue -d -b2048 /dev/cdrom cdimage logfile (write cdimage to a blank CD-ROM)
Example 4: Rescue a CD-ROM in /dev/cdrom from two copies.
ddrescue -n -b2048 /dev/cdrom cdimage logfile ddrescue -d -b2048 /dev/cdrom cdimage logfile (insert second copy in the CD drive) ddrescue -d -r1 -b2048 /dev/cdrom cdimage logfile (write cdimage to a blank CD-ROM)
Example 5: Rescue a lzip compressed backup from two copies on CD-ROM with error-checked merging of copies (See the lziprecover manual for details about lziprecover).
ddrescue -b2048 /dev/cdrom cdimage1 logfile1 mount -t iso9660 -o loop,ro cdimage1 /mnt/cdimage cp /mnt/cdimage/backup.tar.lz rescued1.tar.lz umount /mnt/cdimage (insert second copy in the CD drive) ddrescue -b2048 /dev/cdrom cdimage2 logfile2 mount -t iso9660 -o loop,ro cdimage2 /mnt/cdimage cp /mnt/cdimage/backup.tar.lz rescued2.tar.lz umount /mnt/cdimage lziprecover -m -v -o backup.tar.lz rescued1.tar.lz rescued2.tar.lz
Example 6: 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 7: 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 8: 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
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 24, 2013 using texi2html 5.0.