Useful Tools

Debian package names are listed here. Things in quotes are taken directly from the package description and probably indicates that no one has tried using them yet.

General Procedure

It is typically a good idea to copy the damaged partition to another disk and work on that so that any accidental damage done while attempting to recover data isn't permanent (and also in case the damaged partition doesn't somehow develop more problems in the time it takes to recover everything). Say the damaged partition is mounted as /dev/sdc5. If the gddrescue package is installed, the following command will copy /dev/sdc5 to the partition image file sdc5.img:

ddrescue /dev/sdc5 sdc5.img

Note: This takes a long time to run. Depending on the size of and amount of damage to the partition, this could take > 24 hours.

You can use gpart to fix partition tables if that is the problem. Detailed instructions are here. To summarize, first run gpart /dev/sdc (or whatever the correct device is) to have it scan the device and guess what the partitions are. If it says the check is ok and the partitions look correct, you can write the partition table to the device with gpart -W /dev/sdc /dev/sdc. You may also want to use the -b option to backup the original partition table.

TestDisk seems to be a useful tool that can do what gpart can do plus more. It has not been extensively tested by this troper.

Magic Rescue will let you recover files of certain types. It works by looking for "magic numbers" that identify file types. To use it, you have to specify a "recipe" which specifies what types of files to look for and how to rescue them. The default recipes are in /usr/share/magicrescue/recipes/. For example, say you are trying to recover Excel files for a colleague who uses Windows. In that case, you would use the msoffice recipe like so:

magicrescue -d recovered -r msoffice disk.img

where -d specifies the directory to put recovered files in, -r gives the recipe to use, and disk.img is the partition to look at. This troper considers Magic Rescue somewhat of a last resort since it preserves neither directory structure nor file names. It's better than losing everything, though.

DebianNotes/DataRecovery (last edited 2010-10-18 16:34:47 by phys33065)