When checking the file system of the root partition, it's not an option to unmount it. So basically we have two solutions: have it checked when booting or mount it read-only.
File system check during the next boot
Linux checks while booting whether the file /forcefsck exists. If it finds this file, a file system check is started.
In order to create this file, you can either shutdown using:
shutdown -For create the file manually e.g. using:
touch /forcefsck
File system check on read-only root partition
First you should get in single user mode:
# init 1Wait until you reach run-level 1. Then remount the partition as read-only:
# mount -n -o remount,ro /dev/sda1(replace /dev/sda1 by the mount device of your root partition)
Now we can check the file system:
# fsck -fp /dev/sda1-f: means that we want to force a check.
-p: means that all errors should be automatically repaired.
After the check we can switch back to read/write mode:
# mount -n -o remount,rw /dev/sda1Now we can switch back to our "normal" run-level:
# init 3(for command line)
# init 5(for GUI)
That's it !
No comments:
Post a Comment