manpagez: man pages & more
info ddrescue
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. A small tutorial with examples

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.

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 physicaly 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.

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

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

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

IMPORTANT! If you interrupt the rescue and then reboot, any partially copied partitions should be hidden before allowing them to be touched by any operating system that tries to mount and "fix" the partitions it sees.

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

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 lzip 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 --merge -o rescued.tar.lz rescued1.tar.lz rescued2.tar.lz

Example 6: 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 7: 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 -T /dev/hda /dev/hdb logfile
ddrescue -d -f -r3 /dev/hda /dev/hdb logfile

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.