e2fsck

Used to check the integrity of the second extended file system

Supplementary instructions

e2fsck command is used to check the integrity of the second extended file system and try to fix errors with appropriate options.

The return value and representative meaning of e2fsck after execution are as follows:

grammar

e2fsck(options)(parameters)

Options

-a: Automatically repair the file system without asking the user for feedback;
-b<superblock>: Specify superblock instead of using the default superblock;
-B<block size>: Specify the size of the block in bytes;
-c: Execute badblocks together to mark damaged blocks;
-C: Completely record the information of the inspection process in the file descriptor, so that the entire inspection process can be completely monitored;
-d: Display debugging information;
-f: Forcibly check for correctness even if the file system shows no signs of error;
-F: Clear the device buffer before execution;
-l<file>: Add the specified block in the file to the damaged block list;
-L<file>: First clear the damaged block list, and then add the blocks specified in the file to the damaged block list. Therefore the blocks in the corrupted block list are the same as those specified in the file;
-n: Open the file system in read-only mode and execute it in a non-interactive mode. All question dialogues are set to be answered with "no";
-p: Automatically repair the file system without asking the user for feedback;
-r: This parameter exists only for compatibility and has no actual effect;
-s: If the byte order of the file system is inappropriate, swap the byte order, otherwise no action will be taken;
-S: Regardless of the byte order of the file system, the byte order is always swapped;
-t: Display time information;
-v: Display detailed information during execution;
-V: Display version information;
-y: Execute in non-interactive mode, all questions are set to be answered with "yes".

Parameters

File system or partition: Specify the device file name corresponding to the file system or partition.

Example

Check if there is any problem with /dev/sda1. If any problem is found, it will be automatically repaired:

e2fsck -a -y /dev/sda1

Please umount the partition before executing e2fsck or fsck, otherwise the file system may be damaged. If you need to check and repair the root directory /, you need to enter the singal user mode to execute.