In attempting to recover data from a damaged disk with file system errors that cannot be fixed with fsck, you can run the mke2fs command with the -s option like this (for example, if you are having trouble with the ext2/3 partition on /dev/hda2):
The -s argument writes new superblock information, but does not write new inodes; this might make the missing data salvageable, or it might not depending on the damage. You must run e2fsck on the unmounted partition after using the mke2fs command in this manner.
Because a directory is a file as well, the same techniques for file recovery can be used to recover entire directories. The Ext2fs Undeletion of Directory Structures mini-HOWTO (see "Reference") is written as a companion to the Ext2fs Undeletion mini-HOWTOboth of which should be on everyone's required reading list if you want to successfully undelete any files. The manual technique described in the HOWTOs is too long and complex to be covered in this book.
Was this article helpful?