Check your ext3 filesystems for unexpected fscks on reboot

Posted by on Nov 8, 2012 in Best practices, Infrastructure, Linux, Unix | No Comments

One “feature” of Linux systems is that ext2/ext3 filesystems can be automatically (and unexpectedly) fsck’d upon reboot. Technically, it’s done at mount time, after a configurable number of mounts or days. In theory, I suppose it makes sense to periodically check flaky filesystems running on low-end hardware. In practice, however, it frequently comes as a nasty surprise after maintenance to a production system. If you have a large filesytem, your outage can be extended significantly by Linux “protecting” your system. As a result, I typically disable these automatic filesystem checks.

To check what settings your filesystems currently have:

for dev in `mount -t ext3|cut -f1 -d' '`; do
  echo $dev;
  /sbin/tune2fs -l $dev | egrep "Maximum|interval";
  echo;
done

If you really want to disable checking and understand the implications, change the settings with tune2fs:

/sbin/tune2fs -c 0 -i 0 <dev>