Registered: May 2005
ReiserFS data recovery
I have two reiserfs partitions - /, and another one that contains /home, /usr/local, and /tmp. The / partition is a 5.5G primary partition at the beginning of my HD. The rest of the space is an extended parititon chain composed of ~23G for the second reiserfs partition (which is mounted at /mnt/prsnldata, and bound mounted for /home, and symllinked for /usr/local and /tmp), and ~130M swap.
Yesterday night I wanted to shrink /mnt/prsnldata to create a 3G ext2 partition to install Debian GNU/Hurd. I rebooted using the Ultimate Boot CD and ran the live distro on that cd. I then made sure none of my partitions were mounted, and ran 'resize_reiserfs' to shrink /mnt/prsnldata by 4.5G. I then used QTParted to resize the actual partition (/dev/hda5) but I did it in a complicated way. I first shrunk /dev/hda5 by 100M, planning to delete the swap partition and create a bigger swap. After committing changes, QTParted wasn't allowing me to change any of the partitions' data, so I had to reboot back into the live distro. Anyway, after rebooting, I deleted the swap, created a bigger swap, and then shrunk /dev/hda5 by 3.2G, which I then used to create an ext2 partition. After committing the changes, I tried to run 'resize_reiserfs /dev/hda5' to expand /dev/hda5 back to its current physical size. For some reason resize_reiserfs reported that nothing needed to be done.
I then rebooted, and this time booted into Debian Linux, but into the recovery mode (single ro). About part way through the regular boot up for the recovery mode it reported that fsck failed, and gave me the login screen, but showed none as the user. Anyway, I logged in as root (but none was still showing as the user even though I used the root passwd and the login directory was /root). I then tried to run 'resize_reiserfs /dev/hda5' and was told to run 'reiserfsck', so I ran 'reiserfsck --check /dev/hda5'. It reported that I had corruptions that could be fixed with the --rebuild-tree option. I then ran reiserfsck with that option (and the -S option). After it was done I mounted /dev/hda5, and found that the correct total size was being reported but the used space was only at 5G (and before all this it had been 11G) and the only folder on there was lost+found. So I umnounted /dev/hda5, and ran 'resize_reiserfs /dev/hda5' and then 'reiserfsck --rebuild-tree -S /dev/hda5' again. After mounting /mnt/prsnldata, the correct total size and used space was showed, but the only folder was lost+found, and that folder was the 11G of used space (actually it was reported as 12G, but I'm not sure why).
I decided to then reboot back into the live distro, and using QTParted delete the ext2 and swap partitions, and resize /dev/hda5 to include that space. I then rebooted back into Debian recovery mode, and ran 'resize_reiserfs /dev/hda5' which apparently seemed to work fine, and then 'reiserfsck --rebuild-tree -S /dev/hda5' for a third time. The results were the same: the correct used space and total size are reported, but the used space all comes from one folder - lost+found. I also tried 'reiserfsck --rebuild-sb /dev/hda5' twice and 'reiserfsck --clean-attributes /dev/hda5' once and both essentially reported that nothing needed to be done (this was after had already rebuilt the tree once at least).
I apologize that this post is so long, and I hope all of that made sense, but I was just trying to detail my steps. Anyway, right now I'm running on Ubuntu's live cd, and I have two partitions - /dev/hda1 (/) and /dev/hda5 (/mnt/prsnldata). My /dev/hda1 partition is intact, but my /dev/hda5 partition still only shows a lost+found folder that is being reported as 12G (both by 'df' and 'du').
My main question is what do I do now? I just ran 'ls -l | wc -l' in the lost+found folder and there's 2,144 files/directories. Do I have to go through all of them? If so, how? I tried to 'view' some of them, and I realized that while some of them show up as blank data, even the ones that do show up with ASCII data (ie, the scripts, etc) just show the file contents. I have no idea of what the filename should be, nor where the file should go. How am I supposed to use all these lost+found chunks and rebuild my partition?
The other alternative is to reinstall Debian (since I also lost /usr/local). I've only been running Debian since April, and before I did that I burned all my personal data to backup cds, so in terms of my personal data, I would only lose any changes/additions in the last few months. If I have to do a fresh install, I don't mind since I can slowly go through and figure out what apps I had installed, and set them back up.
What do you think? Is it possible to go through the lost+found folder and try and rebuild /dev/hda5? If so, would it be more of a hassle than installing from scratch?
Thank you so much for all your help.