Thursday, November 28, 2013

tune2fs: to fsck, or not to fsck?

The questions of whether to run fsck on the root filesystem at boot, and how often, are important ones for administrators. Here's some minimal information to get started:
Read the fine manual:
# man tune2fs

Look at currently mounted filesystems:
# df -h 

Check status of root filesystem (two important quantities
are "Maximum mount count" and "Check interval")
# tune2fs -l /dev/sda2

Set the maximum mount count to 30
# tune2fs -c 30 /dev/sda2
tune2fs 1.42.6 (21-Sep-2012)
Setting maximal mount count to 30

Set the check interval to 3 weeks:
# tune2fs -i 3m /dev/sda2
tune2fs 1.42.6 (21-Sep-2012)
Setting interval between checks to 1814400 seconds

See that the changes have taken effect:
# tune2fs -l /dev/sda2 | grep -i 'maximum\|interval'
Maximum mount count:      30
Check interval:           1814400 (3 weeks)

1 comment: