John Thompson wrote:
What do you think checks for the "dirty" bit? That's right; "fsck." IfCan you prove that the system uses fsck to check the filesystem's dirty flag? I can't. I see where it gets called if the filesystem is dirty, but not before that. I did find in IRIX the /etc/bcheckrc file, which calls the fsstat command which checks the dirty bit. I will keep looking for the linux answer. I would love to be enlightened if I am wrong.
it find the dirty bit set, it calls the filesystem-appropriate utility
(eg "fsck.ext3" or whatever) to check and fix any problems. When fsck
finds the dirty bit set on an xfs filesystem, it calls "fsck.xfs" which
simply returns a "successful" signal back to fsck, which then moves on
to the next filesystem.
Something interesting from the tune2fs man page:
If you are using journaling on your filesystem, your filesystem will never
be marked dirty, so it will not normally be checked. A filesys-
tem error detected by the kernel will still force an fsck on the
next reboot, but it may already be too late to prevent data loss
at that point.