I installed Linux Mint 12 KDE, and I would like to check the root partition for any errors.
How do I check the root partition with fsck at boot time?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
You can use shutdown command for this too.
shutdown -rF now
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
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"
On my systems (several x86 notebooks and a Banana Pi Pro), saying
sudo shutdown now brings me to runlevel 1 (aka maintenance mode) where I can safely check my root FS:
mount -o remount,ro /dev/rootpartition fsck /dev/rootpartition reboot
There's no need to alter
/etc/fstab to do this, and I have the opportunity to run
fsck with whatever options that may be needed to fix a tricky case.
tune2fs tricks work on x86, but not on Banana Pi.
On modern linux systems the answers above (with forcefsck) don’t work. You have to do it manually:
Put your root partition into read-only mode by modifying the faulty partition’s line on
/etc/fstab (but remember your old settings):
UUID=fd1d0fad-3a4c-457f-9b5e-eed021cce3d1 / ext4 remount,ro 1 1
Switch to runlevel 1 just to minimize the amount of interfering processes:
Fix your file system (replace /dev/sda2 with your partition’s device), which should now work because the root partition is in read only:
Reboot. (On my Fedora 21 system I had to change to runlevel 1 during boot with Grub2, because otherwise the system was stuck due to not being able to write on the root-partition)
Make your root file system readable/writable:
mount -o remount,rw /dev/sda2
Restore your /etc/fstab to its original state.