Luciano Miguel Ferreira Rocha wrote:
Yes, I see that fsck gets called if there is a /forcefsck file, or an /.autofsck file, or an /fsckoptions file, but not anywhere else.Can 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.
The last field in /etc/fstab says if a filesystem is to be checked and in what order.
When booting, /etc/rc.d/rc.sysinit calls fsck -A, that parses the
/etc/fstab field and calls for each filesystem to be checked
/sbin/fsck.filesystem_type.
That fsck.filesystem_type is the one that checks the dirty bit on theWhere do you see anything that says fsck checks the dirty bit? And as for fsck.ext3, don't you think it's odd that it's the exact same size as fsck.ext2? Another thing that makes me still think that fsck does not check the dirty bit, is the exit codes from the fsck man page:
filesystem (for fsck.* that do something usefull, like fsck.ext2/3, vfat
and minix). For fsck.ext3, a check is made for a journal to replay, and
if the replay is successful the filesystem is considered clean.
The exit code returned by fsck is the sum of the following conditions:
0 - No errors
1 - File system errors corrected
2 - System should be rebooted
4 - File system errors left uncorrected
8 - Operational error
16 - Usage or syntax error
32 - Fsck canceled by user request
128 - Shared library error
The exit code returned when multiple file systems are checked is the
bit-wise OR of the exit codes for each file system that is checked.
I don't see anything that says "The file system is dirty/not clean ". My guess is that the dirty bit is checked by the kernel or the disk driver before the rc.sysinit script gets run.
From 'man boot':
Kernel Startup
When the kernel is loaded, it initializes the devices (via their
drivers), starts the swapper (it is a "kernel process", called kswapd
in modern Linux kernels), and mounts the root file system (/).
I am not talking about when I boot my machine. I was saying that I did not see fsck being called in the /etc/rc.sysinit script, unless the filesystem was dirty, or there was a /forcefsck, /.autofsck, or /fsckoptions file.A reason you don't see where fsck gets called if the system isn't dirty, could be that you're not noticing the message saying it's clean. :)
At this point, I am looking for a document or source code, or something that states when and what checks the dirty bit.