In Debian and Ubuntu, an automatic check of mounted filesystems runs during system boot. Not on every boot - only when the system decides it hasn't been checked in a while.
By default, the check kicks in every 25th mount, or on the next one if a check was skipped. And here's the fun part - you reboot the server for something minor, install updates and boot the new kernel... and it doesn't come back up for several minutes... turns out it's checking a 500GB drive with a hundred thousand files at the worst possible moment.
Over SSH, of course, the server is still unreachable at that point.
So how do we disable the automatic fsck check, or adjust its timing?
The tune2fs utility is used for this. To disable the check, run:
# tune2fs -c 0 /dev/sdXY
Instead of sdXY, specify the partition you want to configure. For example, sda1.
You can change the settings to something else, and man tune2fs will help you with that.
For example, the command
# tune2fs -c 100 /dev/sda1
will set the check to run after 100 mounts, while the command
# tune2fs -i 2w /dev/sda1
will set the check to run every 2 weeks regardless of the number of mounts during that time.
Comments