From: sct@dcs.ed.ac.uk (Stephen Tweedie) Subject: [ANSWER] Re: Ext2 fs strangeness Date: 14 Jun 1993 18:25:25 GMT
On 13 Jun 93 04:08:56 GMT, stempien@cs.wmich.edu (Brian Stempien) said:
> I noticed something odd today. With the new version of the kernel
> pl10, the clean bit on a filesystem seems to be ignored. In other
> words, I do a proper shutdown which should set the clean bit on
> umount. We I reboot, e2fsck goes right to work checking then event
> though I should see a note about being clean. I figure, ok I may I
> didn't shutdown right, but when mount mounts the file systems I get
> the message that unchecked filesystem is mounted and should be check
> with e2fsck. This shouldn't happen since fsck just got done.
There are two issues here: the shutdown/umount applications and the
kernel itself.
The way that the kernel originally handled the valid (clean) bit was
to unset it when the partition was used, and to set it on umount.
This was incorrect, because if the partition was not clean when it was
mounted originally then it should not be marked clean on umount!
Then, prior to 0.99pl10, this was changed so that the clean bit is
recorded on mount and is restored to that value on umount, rather than
being unconditionally set on umount.
However, it was still impossible to unmount the root partition. As of
0.99pl10, there is extra kernel code to allow root to be unmounted
during shutdown (the kernel manages this by keeping root open but
readonly after the umount() request).
Now, there's also the problem of the umount program itself. If you
reboot without unmounting an ext2fs partition, then that partition
won't be seen to be clean on bootup. Since in old kernels you just
can't unmount root, the umount program was changed to explicitly
prevent root from being unmounted. With the new 0.99pl10, this
behaviour is incorrect; so to correctly manage the valid flags, you
*should* now try to umount(root) at shutdown.
Finally, there's the question of e2fsck itself. Firstly, you need to
use the "-a" or "-r" option to set the valid flag on an unclean ext2fs
partition; just running e2fsck on a partition and getting no errors
back won't guarantee to set the clean flag. Secondly, if you run
e2fsck at boot time you should really do it before mounting any of the
partitions. This also applies to the root partition; you should mount
root readonly (a kernel/LILO option enables this), fsck all partitions
and then (if that worked) remount root read-write and mount the
remaining partitions.
There was an update to mount posted recently which has the ability to
remount root in this manner, and I have also changed umount and
shutdown to try to unmount the root partition. As soon as these
changes are stable, I hope that there will be a release of these
utilities.
Cheers,
Stephen.