The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  





The fsck command checks and repairs file systems. To execute fsck for checking and repairing file systems, you need root privileges. Additionally, if a file system is already mounted, you cannot use fsck to check and repair it.

Example:
# fsck /dev/sdb ←Check "/dev/sdb"
fsck from util-linux 2.23.2
e2fsck 1.42.9 (28-Dec-2013)
/dev/sdb is mounted. ←Report that it's mounted, preventing fsck from proceeding
e2fsck: Cannot continue, aborting.
# umount /dev/sdb ←Unmount "/dev/sdb"
# fsck /dev/sdb ←Once unmounted, use fsck to check "/dev/sdb" and attempt repairs if errors are found

In some distributions, it's possible to configure fsck to run automatically during boot by modifying the "etc/fstab" file.

For more operation examples, explanations, and options, please refer to the provided link.