Archive for the tag 'Red Hat Enterprise Linux'

Force fsck on next boot on Red Hat Enterprise Linux

If you only want to run fsck on the next boot, execute the following as the root user:

# cd /
# touch forcefsck

The file “forcefsck” will be deleted automatically after fsck is finished.

This will only run the file system check on the next reboot. By touching the file “forcefsck” in the / directory, it will force the system to perform a full file system check.

You can force an automatic full check by changing the check interval using tune2fs (-c and/or -i). For example:

The below command would tell the init scripts to run fsck on hda2 at every boot.

# tune2fs -c 1 /dev/hda2

*tune2fs - adjust tunable filesystem parameters on ext2/ext3 filesystems

-c max-mount-counts

Adjust the number of mounts after which the filesystem will be checked by e2fsck(8). If max-mount-counts is 0 or -1, the number of times the filesystem is mounted will be disregarded by e2fsck(8) and the kernel.

-C mount-count

Set the number of times the filesystem has been mounted. If set to a greater value than the max-mount-counts parameter set by the -c option, e2fsck(8) will check the filesystem at the next reboot.

-i interval-between-checks[d|m|w]

Adjust the maximal time between two filesystem checks. No post fix or d result in days, m in months, and w in weeks. A value of zero will disable the time-dependent checking.

It is strongly recommended that either -c (mount-count-dependent) or -i (time-dependent) checking be enabled to force periodic full e2fsck(8) checking of the filesystem.