Linux – fsck on shutdown instead of startup

debianfscklinuxscientific-linux

Usually, fsck is executed automatically at startup after every 30th reboot or so. Sometimes, it can be really slow, and can delay bootup by more than half an hour.

Is there any way to run fsck at shutdown instead? (I don't mind if shutdown is delayed. Bootup time is more important.)

I would like this for the Debian or Scientific Linux distros.

Best Answer

While you can check some things during shutdown, you cannot effectively run fsck on your root filesystem. You see, fsck requires that the filesystem is not mounted before it can attempt repair. This is only possible during boot, while still running from initramfs.