ReiserFS: how to recover deleted files

root's picture

0. umount the target partition (in this example /home)
egg:/mnt/a# umount /home

1. make a dd copy of your target partition

egg:/mnt/a# dd if=/dev/mapper/rootvg-home of=home.dd bs=4096 conv=noerror
653312+0 records in
653312+0 records out
2675965952 bytes (2.7 GB) copied, 119.87 s, 22.3 MB/s

2. scan the whole partition with the reiserfs command:

egg:/mnt/a# reiserfsck --rebuild-tree --scan-whole-partition home.dd 
reiserfsck 3.6.21 (2009 www.namesys.com)

Will rebuild the filesystem (home.dd) tree
Will put log info to 'stdout'

Do you want to run this program?[N/Yes] (note need to type Yes if you do):Yes
[...a bunch of useless output deleted...]
Flushing..finished
	Objects without names 6611
	Empty lost dirs removed 3060
	Dirs linked to /lost+found: 807
		Dirs without stat data found 23
	Files linked to /lost+found 5804
	Objects having used objectids: 5641
		files fixed 4912
		dirs fixed 729
Pass 4 - finished       done 0, 0 /sec
	Deleted unreachable items 3145
Flushing..finished
Syncing..finished
###########
reiserfsck finished at Mon Oct 28 15:20:48 2013
###########

3. create mount point for home.dd and mount it:

egg:/mnt/a# mkdir /mnt/recovery
egg:/mnt/a# mount -o loop home.dd /mnt/recovery/

4. Your undeleted files should be in /mnt/recovery/lost+found

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root