Linux fsck Command
The Linux fsck (short for file system check) command is used to check and repair Linux file systems. It can check one or multiple Linux file systems simultaneously.
Syntax
fsck [-sACVRP] [-t fstype] [--] [fsck-options] filesys [...]
Parameters:
filesys: device name (e.g., /dev/sda1), mount point (e.g., / or /usr)
-t: Specifies the type of the file system. This parameter is not needed if it is already defined in /etc/fstab or if the kernel supports it.
-s: Executes the fsck commands one by one in sequence.
-A: Checks all partitions listed in /etc/fstab.
-C: Displays the complete progress of the check.
-d: Prints the debug results of e2fsck.
-p: Executes multiple fsck checks simultaneously when combined with the -A condition.
-R: Omits the root directory (/) from the check when combined with the -A condition.
-V: Enables verbose mode.
-a: Automatically repairs the file system if errors are found.
-r: Prompts the user to decide whether to repair the file system if errors are found.
Example
To check if the msdos file system at /dev/hda5 is functioning correctly and automatically repair it if there are any anomalies:
fsck -t msdos -a /dev/hda5
Note: This command can be understood better by referring to /etc/fstab.