android bsd linux unix & open-source world


Linux Tips: How to force fsck on the next reboot or boot sequence

WP Greet Box icon
Hello there! If you are new here, you might want to subscribe to the RSS feed or subscribe via E-mail for updates on this topic.

fsck is a file system consistency check and interactive repair tool.
Here is a quick tip that will show how you can tell your Linux system to perform a fsck on its partitions on the next reboot. Normally this will happen by default, after some time as configured in the filesystem at creation time (or changed later): after a number of days or a number of filesystem mounts.

If for some reason, you want to force the system to run fsck on the next reboot just use one of the following options:

1. Force fsck on a boot using /forcefsck

On boot Linux looks for a file called "forcefsck" in the root "/" directory. If this file exists then the system will invoke a full file system check on boot.

To create the file you first need to be the root user:

su -

Create a the file forcefsck in the root directory:

touch /forcefsck

Reboot the system:

shutdown -r now

During the first reboot the system will run fsck and after completing this it will also remove the /forcefsck file from the system.

2. Force fsck on a boot using shutdown command

The -F option force fsck on reboot, login as root and type the following command to reboot and run fsck:

shutdown -rF now
Print This Post Print This Post
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment


No trackbacks yet.