My
[[http://www.ideiasverdes.com|girlfriend]] just accidently removed some
files from her ReiserFS home directory using “rm -rf ./path/to/some/dir
*”. Notice the space between dir and *? She didn’t. Oh well, time to
recover that shit back.
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.
0. Unmount the 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 -r /recovery /home
11. Unmount recovered partition
umount /recovery
12. Detach recovered partition device
losetup -d /dev/loop/0
References:
*
[[http://www.antrix.net/journal/techtalk/reiserfs_data_recovery_howto.comments|ReiserFS
undelete/data recovery @ antrix.net]]