1

Is there a correct way to reboot a server to avoid FSCK and just avoid getting FSCK in general? I have been using the reboot command to reboot servers.

Tiffany Walker
  • 6,541
  • 13
  • 53
  • 77
  • 1
    You want to have fsck. You want to have your filesystems checked.. believe me. – Bonsi Scott Nov 13 '12 at 22:02
  • Sounds to me that the question is whether the OP is restarting her server the correct way. Not about preventing fsck - but inadvertently causing it to run. – uSlackr Nov 14 '12 at 04:25

3 Answers3

4

The reboot command may reboot the system without shutting down system services or unmounting filesystems cleanly. It's supposed to shutdown the system normally, but apparently this doesn't always happen.

To avoid this problem, use the shutdown command with the appropriate options to have it reboot the system.

An example:

shutdown -r now

So long as the system shuts down cleanly, it will not normally attempt to fsck the drives on next restart (unless the filesystem mount/time count is exceeded, but that's another story).

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
4

The fsck after reboot happens for one of three reasons: when a system shuts down uncleanly (like a crash), when a filesystem hasn't been checked for N mounts, or when a filesystem hasn't been checked in M days. For an ext2/3/4 filesystem you can see the current counters and set the value of N and M with the tune2fs command.

Dennis Kaarsemaker
  • 18,793
  • 2
  • 43
  • 69
2

First fsck is your friend! If you have crashed a system, you WANT it to run automagically and this action should never be disabled in this case.

Now, during the course of normal reboots where everything gets sync'd fine, the periodic invokation of fsck can be annoying and not very timely. Generally, what I do in this case is to inhibit this type of periodic fsck invokation, using tune2fs (as the root user):

 tune2fs -i 0 -c 0 /dev/sda1        ;; change /dev/sda1 with whatever your raw disk is

This operation can be performed at any time during the systems operation, even with the disk being mounted.

After you do this you can then reboot the server and avoid the fsck operation (unless the server has crashed).

mdpc
  • 11,698
  • 28
  • 51
  • 65