Linux Force fsck on the Next Reboot or Boot Sequence

By creating /forcefsck file you will force the Linux system (or rc scripts) to perform a full file system check.


touch /forcefsck

[TIP: Force fsck -y remotely
When dealing with a remote server that has gone through a hard shutdown and bgfsck isn't going to be able to deal with all the issues. You can setup fsck on bootup. Grab your editor and let's go.
Okay let's edit As root:

# ee /etc/rc.conf Add these lines. # force fsck -y at boot fsck_flags=-y

This will force a fsck -y at boot before the slices are mounted.

Pay careful attention if your system is really screwed up you can lock yourself out of this. Also it will do this at every boot. This may not be desirable if you have a large amount of disk space.