How to force a fsck on server reboot

fsck stands for File System Check and it is a disk repair utility used in Linux based operating systems.
Normally fsck is began instantly at start time if some file system problem is recognized. However Server Administrators can run a manual fsck as well if they observe any problems on the working system. It is always performed after unmounting the relevant server partition and in most situations in single user mode.
This article cover the ways we can set fsck to start instantly at reboot.

First way we can use to perform this is by creating a file under root file system / , We can do this by using following command :

touch /forcefsck

Then reboot the system :


The second method is more easy and just requires the use of an additional argument -F to force fsck , we can do this by using below command :

shutdown -rF now

This is the normal command used for server reboot and adding -F make sure that a forced file system check ( fsck ) will be performed on the server.

If you want to skip fsck,you can check our post on Skip or bypass s FSCK.