← 返回命令列表

Linux command

btrfs-check 命令

安全

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

常用示例

Check

sudo btrfs check [path/to/partition]

Example

sudo btrfs check --repair [path/to/partition]

Example

sudo btrfs check -p [path/to/partition]

Example

sudo btrfs check --check-data-csum [path/to/partition]

Example

sudo btrfs check -s [n] [path/to/partition]

Rebuild

sudo btrfs check --repair --init-csum-tree [path/to/partition]

Rebuild

sudo btrfs check --repair --init-extent-tree [path/to/partition]

说明

btrfs check examines btrfs filesystem structures for consistency errors and can optionally repair certain types of damage. It operates on unmounted filesystems only. The check mode is non-destructive and reports issues. The repair mode attempts fixes but carries risk of data loss if used incorrectly.

参数

--repair
Attempt to fix detected errors (dangerous, backup first)
-p, --progress
Show progress during the check
--check-data-csum
Verify data block checksums
-s, --super _num_
Use the specified superblock copy (0, 1, or 2)
--init-csum-tree
Rebuild the checksum tree from scratch
--init-extent-tree
Rebuild the extent tree from scratch
--readonly
Run in read-only mode (default)

FAQ

What is the btrfs-check command used for?

btrfs check examines btrfs filesystem structures for consistency errors and can optionally repair certain types of damage. It operates on unmounted filesystems only. The check mode is non-destructive and reports issues. The repair mode attempts fixes but carries risk of data loss if used incorrectly.

How do I run a basic btrfs-check example?

Run `sudo btrfs check [path/to/partition]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --repair do in btrfs-check?

Attempt to fix detected errors (dangerous, backup first)