[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Fsck after expiration of mount limit
hey I found it somewhere on the NEt
and thought that someone was asking for it a long time ago
so here it is
After an ext2 file system has been mounted n number of times, an fsck
is forced on the next mount. Typically n is set to 20.
If you only mount at each reboot, it is typical to have a situation
where for 20 reboots the fsck is skipped, but then at the 21st
all the file systems are checked. The long wait on this 21st reboot
# dumpe2fs /dev/hda7 | grep '[mM]ount count'
dumpe2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
Mount count: 7
Maximum mount count: 20
This says that /dev/hda7 has been mounted seven times since the last
fsck, and the fsck will be skipped for 20 mounts.
If all your file systems have the same `Mount count' then they will
all fsck together at the 20th reboot. It's easy to fix that. Say:
# umount /dev/hda6
# tune2fs -C 9 /dev/hda6
tune2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
Setting current mount count to 9
# mount /dev/hda6
This changes the `Mount count' to 9.
WARNING WARNING: ONLY RUN tune2fs ON AN UNMOUNTED FILESYSTEM. tune2fs
goes ahead and does it's job even if the file system is mounted. I
suspect this is dangerous, so it's up to YOU to be careful.
Suppose you have four file systems. Then set the mount count to
and 15. This evenly spaces out the fsck for each of them.
By doing this, the expected cost of reboot remains the same. It's
the variance of boot time that's brought down. Hence this only helps.
The extent to which you like this better depends on how impatient you
are; but it is strictly superior to the default arrangement.
If you're paranoid and like to have lots of fscks, or if you have
than 20 file systems, the `Maximum mount count' can also be changed
saying tune2fs -c N. The value N=-1 disables this feature. You should
also know that tune2fs -i 2 says "check every two days". This may be
useful for machines such as notebooks.
Jaswinder Singh Kohli
The Universe is a figment of its own imagination.