ReiserFS undelete/data recovery HOWTO

These steps are only for really bad hard disk muck-ups and accidentally deleted files. For normal filesystem inconsistencies, don't use these steps!

  1. Once you realize that you've lost data, don't do anything else on that partition - you may cause that data to be overwritten by new data.
  2. Unmount that partition. e.g., umount /home
  3. Find out what actual device this partition refers to. You can usually get this information from the file /etc/fstab. We'll assume here that the device is /dev/hda3.
  4. Run the command: reiserfsck --rebuild-tree -S -l /root/recovery.log /dev/hda3

    You need to be root to do this. Read the reiserfsck man page for what these options do and for more options. Some interesting options are '--rebuild-sb, --check'

    After the command finishes, which might be a long time for a big partition, you can take a look at the logfile /root/recovery.log if you wish.

  5. Mount your partition: mount /home
  6. Look for the lost+found directory in the root of the partition. Here, that would be: /home/lost+found
  7. This directory contains all the files that could be recovered. Unfortunately, the filenames are not preserved for a lot of files. You'll find some sub-directories - filenames within those are preserved!
  8. Look through the files and copy back what you need.

Here's a useful link for more advanced tricks.

 

 

     I just want to thank for the tips on recovering deleted files. I've just wrongly deleted some files and been able to recover them by following your steps / steps from pages mentioned herein. Instead of finding deleted files in lost+found directory, I've ended up finding them in the original directories (from where they were deleted). I've compiled the sequence of steps for my specific case (slight changes will suit particular issues regarding unwanted file deletion), which follows:

Recover deleted files (from /home = /dev/hda7)
0. Unmount partition from where to recover deleted files

        umount /home

1. Create partition copy

        dd if=/dev/hda7 conv=noerror > /hda7.img

2. Set up device containing copy of partition (created in 1.)

        losetup /dev/loop/0 /hda7.img

3. Rebuild FS tree, performing a thorough partition scan and logging to /recovery.log file

        reiserfsck --rebuild-tree -S -l /recovery.log /dev/loop/0

(4. Check written log file)

        (less /recovery.log)

5. Create directory for mounting recovered partition

        mkdir /recovery

6. Mount recovered partition in directory created in 5.

        mount /dev/loop/0 /recovery

7. Access recovered partition's lost+found directory and look for files

        cd /recovery/lost+found

8. If not there (7.), then look for in original directory

        cd /recovery/

9. Remount /home partition

        mount /home

10. Copy recovered files from 7./8. to /home/

        cp /recovery// /home//
11. Unmount recovered partition
        umount /recovery
12. Detach recovered partition device
        losetup -d /dev/loop/0

@nT$

 

你可能感兴趣的:(Access,UP)