Linux fsck – Will My System Run fsck on Reboot?

fscklinux

…and how do I find out?

Say I am about to reboot a server. I would like to minimize downtime, so thinking about wrapping reboot in an alias that says "hang on buddy, you're going to hit a fsck on boot".

Next question.. what's the best way to say "lets do it next time?" set the last check date?

I know tune2fs can set a bunch of parameters, but how would I get em?

Best Answer

If all you want to do is avoid an fsck, adding the -f option to shutdown should help with that. shutdown -F to force fsck.

tune2fs -l /dev/foo will tell you the interesting bits of information.

Here's a start at extracting just what you need:

mount -l -t ext3,ext2 | cut -d' ' -f1 | xargs -n1 tune2fs -l | egrep -i 'state|mount|check'

If the "Next check after" date is in the past, there will be an fsck.

If the filesystem state is not clean, there will be an fsck. (this could also happen if there's a problem with the system during reboot/shutdown that prevents a clean unmount)

If the mount count has reached the maximum mount count, there will be an fsck.

Related Topic