Linux fsck.ext2 Command
The Linux fsck.ext2 command is used to check a file system and try to repair errors.
When an ext2 file system has errors, you can use the fsck.ext2 command to try to repair them.
Syntax
fsck.ext2 [-acdfFnprsStvVy][-b <分区第一个磁区地址>][-B <区块大小>][-C <反叙述器>][-I ][-l/L <损坏区块文件>][-P <处理inode大小>][外围设备代号]
Parameters:
- -a Automatically repair the file system without asking any questions.
- -b
Specify the starting address of the partition's first sector, that is, the Super Block. - -B
Set the size of each block in the partition. - -c Check whether the specified file system contains damaged blocks.
- -C
Specify a reverse narrator; the fsck.ext2 command will have its entire execution process narrated in reverse, making it easier to troubleshoot or monitor program execution. - -d Display the command execution process in detail, making it easier to troubleshoot or analyze program execution.
- -f Force a full check of the file system even if it shows no problems in a cursory check.
- -F Before checking the file system, clear the data in the storage device's block area.
- -I
Set the number of blocks in the inode buffer of the file system to be checked. - -l
Treat the blocks listed in the file as bad blocks and mark them so that applications do not use them. - -L
This parameter is similar to specifying the "-l" parameter, but before marking bad blocks based on the file, it clears all previously marked bad blocks, that is, it resets everything rather than merely adding new bad-block marks. - -n Set the file system to be checked as read-only, disable interactive mode, and answer no to all questions.
- -p This parameter has the same effect as specifying "-a".
- -P
Set the inode size that the fsck.ext2 command can handle. - -r This parameter is ignored and only serves for compatibility.
- -s When checking the file system, swap the contents of each pair of bytes.
- -S This parameter is similar to "-s", but swaps the contents of each pair of bytes regardless of whether the file system is already in standard byte order.
- -t Display timing information for the fsck.ext2 command.
- -v Display the command execution process in detail.
- -V Display version information.
- -y Disable interactive mode and answer yes to all questions.
Linux Command Reference