How to check root partition with fsck?

sudo touch /forcefsck

Then reboot.


You can use shutdown command for this too.

shutdown -rF now

From man:

The -F flag means 'force fsck'.
This only creates an advisory file /forcefsck which can be tested by the system when it comes up again. The boot rc file can test if this file is present, and decide to run fsck(1) with a special `force' flag so that even properly unmounted file systems get checked. After that, the boot process should remove /forcefsck.


Here is another way to do this:

tune2fs -C 2 -c 1 /dev/THEDEVTHATROOTIS

reboot

then the filesystem will be checked, and once all is good you should do

tune2fs -c 60 /dev/THEDEVTHATROOTIS

I have assumed that the max-mount-count was set to 60, you should find out before issuing the first command with

dumpe2fs /dev/THEDEVTHATROOTIS |grep "Maximum mount count"