fsck stands for File System Check and it is a disk repair utility used in Unix and Linux  based operating systems.

Normally fsck is started automatically at boot time if some file system inconsistency is identified. However System Administrators can issue a manual fsck as well if they notice any issues on the running system. It is always performed after unmounting the related server partition and in most cases in single user mode, unless it a partition which can be unmounted on a running system.

This article cover the ways we can set fsck to start automatically at reboot, irrespective of the server detecting a file system inconstancy or not.

First method you can use to achieve this is by creating a file under root file system / , you can do this by using following command :

touch /forcefsck

Then reboot the system :
reboot

or you can use the shutdown command with -r flag , which is what ‘reboot‘ command calls as well in background.

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

shutdown -r now is the normal command used for server reboot and adding -F ensures that a forced file system check ( fsck ) will be performed on the server.

Tags: , , ,

Leave a Reply