← 返回命令列表

Linux command

fsck 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Check

sudo fsck /dev/sdXN

Example

sudo fsck -r /dev/sdXN

Automatically

sudo fsck -a /dev/sdXN

Example

sudo fsck -A

Force

sudo fsck -f /dev/sdXN

Example

sudo fsck -C /dev/sdXN

说明

fsck checks and repairs Linux filesystems. It is a front-end that calls filesystem-specific checking utilities (fsck.ext4, fsck.xfs, etc.). The filesystem should be unmounted when running fsck.

参数

-a
Automatically repair without prompting
-A
Check all filesystems listed in /etc/fstab
-C FD
Show progress bar
-f
Force check even if filesystem seems clean
-M
Do not check mounted filesystems
-N
Dry run - show what would be done
-P
Check filesystems in parallel (with -A)
-R
Skip root filesystem (with -A)
-r _fd_
Report statistics for each fsck upon completion (exit status, time, memory)
-l
Lock the whole-disk device with an exclusive flock. Can only be used with one device (mutually exclusive with -A).
-s
Serialize fsck operations
-T
Do not show title on startup
-t TYPE
Specify filesystem type
-V
Verbose output
-y
Answer "yes" to all questions
-n
Answer "no" to all questions (read-only check)

FAQ

What is the fsck command used for?

fsck checks and repairs Linux filesystems. It is a front-end that calls filesystem-specific checking utilities (fsck.ext4, fsck.xfs, etc.). The filesystem should be unmounted when running fsck.

How do I run a basic fsck example?

Run `sudo fsck /dev/sdXN` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a do in fsck?

Automatically repair without prompting