Re: fs corruption recovery?

Andreas Dilger (adilger@turbolabs.com)
Wed, 9 Jan 2002 03:43:46 -0700


On Jan 09, 2002 10:28 +0100, Thomas Capricelli wrote:
> On Wednesday 09 January 2002 04:07, Andreas Dilger wrote:
> > Try "e2fsck -B 4096 -b 32768 <device>" instead.
>
> I thought e2fsck was already trying the different superblocks present on the
> device.

Well, yes and no. Most versions of e2fsck (i.e. every version in existence
unless you have a very recent copy from Ted's BitKeeper repository) will
try possible block sizes, but will not try different block numbers.

> Why isn't e2fsck smart enought to look for then? Is this an intended purpose?

Well, in the most recent versions, it will try a lot harder to try and find
backup superblocks. It will still not run e2fsck automatically on the device.
There are many reasons why e2fsck may think the superblock is corrupted, but
in fact it isn't:

1) superblock has a new feature which an old e2fsck doesn't understand
2) filesystem is no longer ext2, but may still have the backup superblock
(e.g. you mkswap on an old ext2 partition, it leaves the old superblock)

> Why do you use the -B option ? How can it be useful to force the block size?
> Especially if this one is different.

Well, since it is possible to have multiple block sizes for ext2, if you
specify "-b 32768" (i.e. block 32768) for the superblock backup, how does
it know what the blocksize is if you don't tell it that also*. The old
error message (try -b 8193) assumes that you have a 1kB blocksize. All
ext2 filesystems larger than 500MB made in the last couple of years really
have 4kB blocksize** so e2fsck is far more likely to find a superblock
backup at 4kB * 32768 than at 1kB * 32768 (especially since there will
never be a backup at 1kB * 32768, but rather 1kB * 32769, and only on
_really_old_ non-sparse ext2 filesystems).

Cheers, Andreas

*) OK, that is a bit of a lie, e2fsck appears to check all valid blocksizes
when a block number is given, but since one can assume it is a 4kB
block size, you may as well specify it.
**) 4kB blocks provide _much_ better performance than 1kB blocks, even if
they waste more space, and also allow for larger filesystems.

--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/