Forcing a file system check on the next system reboot

Symptom:

You suspect that the file system of the device contains errors.

Problem:

Performing a file system check using the fsck utility can be a tedious manual process requiring the user to reboot the system to a minimal run level and then issue an fsck on each file system listed in the /etc/mtab file. This method requires direct access to the system in order to access and run the fsck utility. The fsck utility is used to scan the file system for errors, and to correct those errors if possible. In order to correct errors, the file systems must be unmounted.

Solution:

A more convenient method is to force a file system check on the next system reboot. This method removes the tedious manual process, and allows the system to check all of the available file systems.
Important: F5 Networks recommends that you have direct access to the system during a forcefsck so that you are able to observe any errors or information that may be reported during the fsck process. While this method removes the manual process of specifying the various file systems, the system reboots into a minimal run level to perform the necessary tasks.

Comments:

The following two methods can be used to force a file system check on the next reboot:

  • Creating a forcefsck file in the root directory

This method allows you to schedule a file system check at the next reboot by creating a blank file called forcefsck that resides in the / directory. When the system is rebooted, it will read this file and begin checking the file systems.

  • Forcing a file system check using the shutdown command

This method allows you to reboot the system immediately and perform a forced file system check using the shutdown command. When the command is issued, the system reboots and begins checking the file systems.

Creating a forcefsck file in the root directory

To create a forcefsck file in the root directory, perform the following procedure:

  1. Log in to the command line.
  2. To create the forcefsck file, type the following command:

touch /forcefsck

  1. Leave the file in place. A file system check is automatically run the next time the system reboots.

Forcing a file system check using the shutdown command

  1. Log in to the command line.
  2. To restart the BIG-IP and force a file system check, type the following command:
    shutdown -rF now

Once the fsck has finished checking the finished checking the file systems, the system will continue to boot normally into the proper run levels.

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.