How to force file system check (fsck) after system reboot on Linux

The system utility fsck is a tool for checking the consistency of a file system in Unix and Unix-like operating systems such as Linux. Fsck stands for file system consistency check and it can be run automatically at boot time, or manually by the system administrator.

On most systems the tool is run at boot time when certain conditions are detected. Usually, these conditions are:

- a file system is marked as ‘dirty’ - its written state is inconsistent with data that was scheduled to be written; or,
- a file system has been mounted a certain number of times without being checked.

DO NOT RUN fsck on a mounted file system.

If you suspect there may be file system errors, the simplest way to force fsck filesystem check on a root partition is to create an empty file called forcefsck in the partition’s root directory.

touch /forcefsck

The empty file created by the command above will override any other settings for fsck and force fsck to check the filesystem on the next system reboot. Once the filesystem is checked the file will be removed so you do not have to remove the file – it will be deleted by the system after the file system check.

To see the filesystem mounted on / (root), run the df command with -h:


To configure file system check on n number of reboots, run the following:

tune2fs -c 1 /dev/sda5 - (file system check will run after each reboot before the loading the OS).

or alternatively

tune2fs -c 10 /dev/sda5 - will set fsck to run after 10 reboots.

To disable fsck, run:

tune2fs -c 0 /dev/sdb1

Note that file system checks can take from several minutes to days depending on the number and size of the files on your disk.

Shutdown -r 0 or shutdown -r now or shutdown –reboot now to restart your system.

Was this article helpful?
18 out of 22 found this helpful

Have more questions? Contact our support instantly via Live Chat