Being a linux noob, I panicked when I found out that all my important work has been lost due to the press of a stupid (dell media center) button. I had some solace when I found out that it has not been entirely “lost” but simply my partition table has been altered. It also seems that there is a superblock for the resierfs partition (which had my data) which has been erased. The superblock is a small area where information about the filesystem is written. The device corresponding to this partition could not even be mounted because of this.

After some googling, I found that there is neat utility called reiserfsck, which could recover lost data from this partition. I tried it with no luck. Also, I could not find any information on reconstructing the superblock in an easy manner.

As most of my important work is in a single text (.tex) file, intially I just wanted a text recovery software. It turns out that grep can do this very easily. This was the command I used to extract my tex file from this partition (/dev/sda4) (from http://www.linuxquestions.org/linux/answers/Hardware/ReiserFS_Data_Recovery_Tips)

(unmount /dev/sda4 first)

grep -a -A1000   ‘\\begin{document}’ /dev/sda4 | strings > recovered_text.

man grep to find out more.

There is another nifty command line utility which helped me recover my lost pictures – PhotoRec (http://www.cgsecurity.org/wiki/PhotoRec). Even though it did not recover all my images, it did a fairly good job.

Finally, to make the dell button harmless, just write a zero in every possible nook and corner of the hard drive:

dd if=/dev/null of=/dev/sda

Ofcourse, this would delete all data on the hard drive so it might be a good idea to back it all up!

Advertisements