Will my system fsck when I reboot?

Posted on

Will my system fsck when I reboot? – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, fsck, , , .

…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?

Solution :

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.

Using tune2fs -l /path/to/device:

  • If “Mount count” will be greater than “Maximum mount counts” then use -c to change the max or -C to change the count
  • If “Last Checked” is not recent enough for the “Check interval” use -i to change the interval or -T to change the last checked

the other option is you can manually make it skip fsck checks at boot by updating the 6th field in your /etc/fstab:

/dev/sda2  /  ext3  defaults,errors=remount-ro 0       1

This is the similar to what most fstabs will have 1 means that it should be checked and is a root file system, 2 means it should be checked but will be done in parallel with other file systems and 0 means skip checking

this is also true no matter the file system

If you don’t want to guess – do this:

touch /fastboot

and you’ll be certain to avoid slow checks (or worse – a total failue if a check fails and the reboot halts)

Leave a Reply

Your email address will not be published.