Thursday, November 6, 2008

finding backup superblocks on ext2 and ext3 filesystems

If you have a situation where your ext2 or ext3 filesystem's primary superblock is corrupted, you need to pass one of the backup superblocks to fsck program. In this case you can find the backup superblocks by using mkfs program. All you have to do is, run mkfs with "-n" option, where mkfs is run in dry mode. It will not destroy your filesystem, it only prints out what it will do on real mkfs procedure.By the way, you have to add the parameters if you have used when your filesystem originally created to get correct values.

eg. mke2fs -n /dev/sda1

and now you can pass your backup superblock number to fsck (fsck.ext2,fsck.ext3) with "-b" parameter.

No comments: