Show and Adjust ext3 Mount Counts With tune2fs

The folks over at Ubuntu Geek have a post about installing showfsck, a utility that will show you the number of mounts left before you’ll get an fsck.

You can do the same thing with /sbin/tune2fs:

$ sudo /sbin/tune2fs -l /dev/datavg/www_lv
tune2fs 1.35 (28-Feb-2004)
Filesystem volume name:
Last mounted on:
Filesystem UUID: 18c4cf33-9dc5-4230-9eea-17eed1060f46
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr filetype sparse_super
Mount count: 14
Maximum mount count: 39

Last checked: Sat Dec 2 13:46:24 2006
Check interval: 15552000 (6 months)
Next check after: Thu May 31 14:46:24 2007

When your mount count reaches the maximum mount count you’ll get an fsck on the next reboot. You can adjust this with tune2fs, if you don’t like the frequency of the checks (like on a laptop):

$ sudo /sbin/tune2fs -c 100 /dev/datavg/lvol6
tune2fs 1.35 (28-Feb-2004)
Setting maximal mount count to 100

I use this from time to time to make sure that I’m not going to get an fsck at an inconvenient time. Like on a multi-terabyte filesystem, on a slow, old array, in the middle of a time-sensitive upgrade…