fsck

The fsck (English spelling: file system check) command checks and attempts to repair errors in the file system

Supplementary instructions

The fsck command is used to check and attempt to repair errors in the file system. When an error occurs in the file system, you can use the fsck command to try to repair it.

grammar

fsck(options)(parameters)

Options

-a: Automatically repair the file system without asking any questions;
-A: Check all file systems listed in the file according to the contents of the /etc/fstab configuration file;
-N: Do not execute the instruction, only list the actions that will be performed during the actual execution;
-P: When used with the "-A" parameter, all file systems will be checked at the same time;
-r: Use interactive mode to ask questions when performing repairs, allowing users to confirm and decide how to handle them;
-R: When used with the "-A" parameter, the file system of the / directory will be skipped and not checked;
-s: Execute check operations sequentially instead of simultaneously;
-t<file system type>: Specifies the file system type to be checked;
-T: When executing the fsck command, no title information is displayed;
-V: Display the instruction execution process.

Parameters

File system: Specify the file system for which you want to view information.

Example

Damage to the Linux file system will cause Linux to shut down abnormally. When an error occurs, if the system tells you which hard disk partition has the problem, such as /dev/hda2, then use the following command to deal with it:

fsck -y /dev/hda2

After that, use the reboot command to restart the system and that’s it!

If you don’t know where the problem is, you can directly:

fsck

Enter :y in the subsequent confirmation dialog boxes

After that, use the reboot command to restart the system and that's it!