retitle 768162 e2fsck should check to see if the number of inodes is insanely 
small
thanks

The e2fsck program in general does not exit with a fatal_error after
the first error.  However, there are a certain class of file system
inconsistencies where it simply isn't safe or there simply isn't
anything e2fsck can do.  The set of errors where this is the case is
actually very small compared to the vast majority of errors where
e2fsck -n will in fact keep going.

So in terms of your request, (1) most of the time, we're doing this
already, and (2) in the places where we aren't, there are really good
reasons why we can't proceed.  So it's not something I can do.

> # fsck.ext4 -vn -B 1024 -b 8193 /dev/sde2
> e2fsck 1.42.12 (29-Aug-2014)
> Superblock has an invalid journal (inode 8).
> Clear? no
> 
> fsck.ext4: Illegal inode number while checking ext3 journal for /dev/sde2
> 
> /dev/sde2: ********** WARNING: Filesystem still has errors **********
> 
> #
> 
> User assumes there is only that one little error, so then does the same
> command without the -n,
> and answers y, only to be met with another error that needs an answer,
> so he answer y again. Then another then another, now he wants to quit
> out with ^C ... which leaves filesystem even more wrecked.

In general it's safe to quit using ^C.  In your particular case, the
superblock was clearly corrupted before e2fsck started, and so I see
no justification of your assertion that this left your filesystem
"even more wrecked".

Some thing we can do is to make the test in check_super_block() in
e2fsck/super.c more strict, so if the number of inodes is less than
EXT2_FIRST_INO(), we will declare the superblock hopelessly corrupt.
That will cause e2fsck to try to use the backup superblock if it can,
but in the case where you've specified a superblock explicitly, all
e2fsck will do then is to exit with a fatal error right away,
regardless of whether you are running e2fsck with -n mode or not.

> And of course -n or a new --show-all-questions should show all of what
> he will be getting asked, before he starts runing his disks!

Most of the time -n will do this.  But there will be times where this
is simply impossible, because e2fsck simply can't proceed without
fixing a particular problem.  And also note that in many cases, if you
actually fix a particular file system corruption, this will change the
corruptions reported by e2fsck.  So what you ask is just not possible.

I'll leave this bug open and retitle it because we can do a better job
by changing:

        check_super_value(ctx, "inodes_count", sb->s_inodes_count,
                          MIN_CHECK, 1, 0);

to:

        check_super_value(ctx, "inodes_count", sb->s_inodes_count,
                          MIN_CHECK, EXT2_FIRST_INO(sb), 0);

in check_super_block().  But that's really all I can really do with
your request.

I would suggest that you try to figure out what might have happened to
cause this kind of file system corruption in the first place.  Based
on your comment about the mke2fs -c vs mke2fs -c -c, I'm going to
guess you're trying to use some really crappy disk drives or flash
devices?

Regards,

                                                - Ted


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to