How can I force fsck on next boot

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

-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.

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

Adjust the maximal time between two filesystem checks. No postfix 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.

# tune2fs -c 1 /dev/hda2

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

# tune2fs -i 1d /dev/hda2

The above command would tell the init scripts to run fsck on hda2 after 1 day.

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

# cd /
# touch forcefsck

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.

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

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.