Google
 
Showing posts with label file recovery. Show all posts
Showing posts with label file recovery. Show all posts

Tuesday, July 08, 2008

debugfs and rdump

If you have broken ext2/ext3 filesystem, these two commands can be your lifesaver. Atleast it brought my friend Abish's HDD 'out of coma' ;)

He had his important files in an ext3 filesystem which wasnt being mounted. It turned out that it had its journal broken. Did everything from disabling the file system's journal to trying out alternate superblocks. Even tried to convert it to ext2 format. fsck.ext3 didnt seem to repair a thing and hacks using tune2fs also didnt turn out good. We were on verge of finally letting go of data and formatting the hdd.

Then i found debugfs. The man page reads,

debugfs - ext2/ext3 file system debugger. The debugfs program is an interactive file system debugger. It can be used to examine and change the state of an ext2 file system.

Surprisingly debugfs seemed to list the files and folders of the filesystem. Cool enough, it also has a tool called rdump which recursively dumps a folder to another mounted disk.

So after invoking

# debugfs /dev/sda1
debugfs: rdump /home/ /mnt/externalhdd


and all the files were dumped to the external hdd safely. Simple, yet awesome!

PS: Me, Abish and Tushar were together when the recovery happened. Abish was so happy he took us all for a tea party right away. But no shops were open. Can you guess why? It was 2 at night!