Linux fsck.ext2 Command
The Linux fsck.ext2 command is used to check and attempt to repair file system errors.
When the ext2 file system encounters errors, the fsck.ext2 command can be used to attempt repairs.
Syntax
fsck.ext2 [-acdfFnprsStvVy][-b <first sector address of partition>][-B <block size>][-C <reverse narrator>][-I <inode buffer block count>][-l/L <damaged block file>][-P <process inode size>][peripheral device code]
Parameters:
-a Automatically repair the file system without asking any questions.
-b<first sector address of partition> Specifies the starting address of the first sector of the partition, which is the Super Block.
-B<block size> Sets the size of each block on the partition.
-c Checks if there are any damaged blocks within the specified file system.
-C<reverse narrator> Specifies the reverse narrator, fsck.ext2 command will reverse narrate the entire execution process, useful for debugging or monitoring program execution.
-d Displays detailed execution process of the command, useful for debugging or analyzing program execution.
-f Forces a thorough check on the file system, even if it appears to be fine during a preliminary check.
-F Clears the data in the storage device block area before checking the file system.
-I<inode buffer block count> Sets the number of inode buffer blocks to be checked for the file system.
-l<damaged block file> Marks the blocks listed in the file as damaged and avoids using them in applications.
-L<damaged block file> This parameter is similar to the "-l" parameter, but before referring to the damaged block file to mark damaged blocks, it will first clear all previously marked damaged blocks, resetting them entirely, not just adding new damaged block markings.
-n Sets the file system to read-only and turns off interactive mode, denying all questions asked.
-p This parameter has the same effect as the "-a" parameter.
-P<process inode size> Sets the inode size that the fsck.ext2 command can process.
-r This parameter is ignored and only handles compatibility issues.
-s Swaps the content of every pair of bytes when checking the file system.
-S This parameter is similar to the "-s" parameter, but regardless of whether the file system is already in standard bit order, it will swap the content of every pair of bytes.
-t Displays timing information for the fsck.ext2 command.
-v Displays detailed execution process of the command.
-V Displays version information.
-y Turns off interactive mode and agrees to all questions asked.