Linux Reiser File System Data Recovery


I have trouble when I accidently removed my valueable files and folders by executing a script. I did not remember what is exactly the full command (because, the command also deleted my script file. Phew, very bad luck!). But, I learnt something from here. Make sure and be careful when using "rm" command. And, most importantly, do backup regularly.

Here are steps to recover deleted files in ReiserFS system:


1. Before proceed with data recovery, do a backup of /home/emelia file system.
   The command is:

   tar -cvpzf /mnt/floppy/emelia/home.tgz /home

   ** Take note that /mnt/floppy is the mount point for Heong's 4G flash drive.

   To get the estimate size of /home directory:  du -hcs /home

2. After make sure we have a good data backup, unmount the flash drive.
   Then, boot from the Slackware 12.0 CD.

   Boot: hugesmp.s

   Sign in as root

   # cfdisk
        - I have free space on /dev/sda4. The memory size is 5G
        - Format /dev/sda4 as a Linux EXT2 filesystem.

          # mke2fs /dev/sda4

3. Make temporary mount point /tmp/flash. Mount /dev/sda4 at /tmp/flash.

   # mkdir /tmp/flash
   # mount /dev/sda4 /mnt/flash

4. Run this command:

   # reiserfsck --rebuild-tree -S -l /tmp/flash/recovery.log /dev/sda3

  The execution aborted when there are badblocks found.

5. For device with bad blocks, the command is like the following

   # reiserfsck --rebuild tree -S -B /tmp/flash/badblocks -l /tmp/flash/recovery.log /dev/sda3

   the bad block list is kept in /tmp/flash/badblocks file. So, the reiserfsck will
   ignore these badblocks while scanning.

   ** Linux has ability recover deleted filesystem because the advantage of Journaling File System (JFS)

6. After the reiserfsck has finished it execution, reboot and boot from hard disk.
   In root directory, we will find /lost+found directory. In this directory, it contains all the
   previous deleted file from the filesystem. However, the name has been rename for something else.
   So, it it a good idea to have a file in subdirectory since the file name is not modified when
   the whole directory is deleted. Here, I manage to get all my journal back without messing up with
   the file name. Lucky me :-)

   To find for specific word contained in a file(s):
     # grep --include=* -r -i "string" /lost+found


Return to Linux home page

Make your own free website on Tripod.com