btrfs-check(8)
SYNOPSIS 概要
btrfs check [options] <device>
btrfs 检查 [选项] <设备>
DESCRIPTION 描述
The filesystem checker is used to verify structural integrity of a filesystem
and attempt to repair it if requested. It is recommended to unmount the
filesystem prior to running the check, but it is possible to start checking a
mounted filesystem (see --force).
文件系统检查器用于验证文件系统的结构完整性,并在需要时尝试修复它。建议在运行检查之前卸载文件系统,但也可以开始检查已挂载的文件系统(参见 --force)。
By default, btrfs check will not modify the device but you can reaffirm that
by the option --readonly.
默认情况下,btrfs check 不会修改设备,但您可以通过选项 --readonly 来确认。
btrfsck is an alias of btrfs check command and is now deprecated.
btrfsck 是 btrfs check 命令的别名,现在已经不推荐使用。
Warning 警告
Do not use --repair unless you are advised to do so by a developer
or an experienced user, and then only after having accepted that no fsck
successfully repair all types of filesystem corruption. E.g. some other software
or hardware bugs can fatally damage a volume.
除非开发人员或有经验的用户建议您这样做,否则不要使用 --repair,并且只有在接受没有 fsck 可以成功修复所有类型的文件系统损坏之后才这样做。例如,一些其他软件或硬件错误可能会严重损坏卷。
The structural integrity check verifies if internal filesystem objects or
data structures satisfy the constraints, point to the right objects or are
correctly connected together.
结构完整性检查验证内部文件系统对象或数据结构是否满足约束条件,指向正确的对象或正确连接在一起。
There are several cross checks that can detect wrong reference counts of shared
extents, backreferences, missing extents of inodes, directory and inode
connectivity etc.
有几个交叉检查可以检测共享范围的错误引用计数、反向引用、缺失的 inode 范围、目录和 inode 连接等。
The amount of memory required can be high, depending on the size of the
filesystem, similarly the run time. Check the modes that can also affect that.
所需的内存量可能很高,取决于文件系统的大小,同样也取决于运行时间。检查也可能会影响这一点。
SAFE OR ADVISORY OPTIONS
安全或建议选项
- -b|--backup -b|--备份
use the first valid set of backup roots stored in the superblock
使用存储在超级块中的第一个有效备份根集合This can be combined with --super if some of the superblocks are damaged.
这可以与 --super 结合使用,如果一些超级块已损坏。
- --check-data-csum
verify checksums of data blocks
验证数据块的校验和This expects that the filesystem is otherwise OK, and is basically an offline scrub that does not repair data from spare copies.
这期望文件系统在其他方面正常,并且基本上是一种离线擦洗,不会从备用副本修复数据。- --chunk-root <bytenr>
use the given offset bytenr for the chunk tree root
使用给定的偏移字节作为块树根
- -E|--subvol-extents <subvolid>
show extent state for the given subvolume
显示给定子卷的范围状态
- --mode <MODE>
select mode of operation regarding memory and IO
选择内存和 IO 方面的操作模式The MODE can be one of:
MODE 可以是以下之一:- original 原始
The metadata are read into memory and verified, thus the requirements are high on large filesystems and can even lead to out-of-memory conditions. The possible workaround is to export the block device over network to a machine with enough memory.
元数据被读入内存并进行验证,因此对大型文件系统的要求很高,甚至可能导致内存不足的情况。可能的解决方法是将块设备通过网络导出到具有足够内存的机器上。- lowmem 低内存
This mode is supposed to address the high memory consumption at the cost of increased IO when it needs to re-read blocks. This may increase run time.
这种模式旨在解决高内存消耗问题,但会增加 IO,当需要重新读取块时。这可能会增加运行时间。
- -p|--progress -p|--进度
indicate progress at various checking phases
在各个检查阶段指示进度- -Q|--qgroup-report
verify qgroup accounting and compare against filesystem accounting
验证 qgroup 记账并与文件系统记账进行比较- -r|--tree-root <bytenr>
use the given offset ‘bytenr’ for the tree root
使用给定的偏移量 'bytenr' 作为树根
- --readonly
(default) run in read-only mode, this option exists to calm potential panic when users are going to run the checker
(默认)以只读模式运行,此选项存在是为了在用户要运行检查程序时平息潜在的恐慌
- -s|--super <N>
use Nth superblock copy, valid values are 0, 1 or 2 if the respective superblock offset is within the device size
使用第 N 个超级块副本,有效值为 0、1 或 2,如果相应的超级块偏移在设备大小内This can be used to use a different starting point if some of the primary superblock is damaged.
这可以用于在一些主超级块受损时使用不同的起始点。- --clear-space-cache v1|v2
completely remove the free space cache of the given version
完全删除给定版本的空闲空间缓存See also the clear_cache mount option.
另请参阅 clear_cache 挂载选项。Warning 警告
This option is deprecated, please use btrfs rescue clear-space-cache instead, this option would be removed in the future eventually.
此选项已被弃用,请改用 btrfs rescue clear-space-cache,此选项最终将在未来被移除。
DANGEROUS OPTIONS 危险选项
- --repair
enable the repair mode and attempt to fix problems where possible
启用修复模式并尝试在可能的情况下修复问题Note 注意
There’s a warning and 10 second delay when this option is run without --force to give users a chance to think twice before running repair, the warnings in documentation have shown to be insufficient.
当未使用 --force 选项运行此选项时,会出现警告和 10 秒延迟,以便让用户在运行修复之前三思,文档中的警告已被证明不足。- --init-csum-tree
create a new checksum tree and recalculate checksums in all files
创建一个新的校验和树,并重新计算所有文件的校验和Warning 警告
Do not blindly use this option to fix checksum mismatch problems.
不要盲目使用此选项来解决校验和不匹配的问题。- --init-extent-tree
build the extent tree from scratch
从头开始构建扩展树Warning 警告
Do not use unless you know what you’re doing.
除非你知道自己在做什么,否则不要使用。
- --force
allow work on a mounted filesystem and skip mount checks. Note that this should work fine on a quiescent or read-only mounted filesystem but may crash if the device is changed externally, e.g. by the kernel module.
允许在已挂载的文件系统上工作并跳过挂载检查。请注意,这在一个静止或只读挂载的文件系统上应该可以正常工作,但如果设备在外部被更改,例如由内核模块更改,可能会导致崩溃。Note 注意
It is possible to run with --repair but on a mounted filesystem that will most likely lead to a corruption unless the filesystem is in a quiescent state which may not be possible to guarantee.
在挂载的文件系统上运行 --repair 是可能的,但这很可能会导致损坏,除非文件系统处于静止状态,这可能无法保证。This option also skips the delay and warning in the repair mode (see --repair).
此选项还会跳过修复模式中的延迟和警告(请参阅 --repair)。
DEPRECATED OR MOVED OPTIONS
不推荐使用或已移动的选项
- --clear-ino-cache
(removed: 6.7) (已移除: 6.7)
remove leftover items pertaining to the deprecated inode cache feature, please use btrfs rescue clear-ino-cache instead
请使用 btrfs rescue clear-ino-cache 命令来删除与已弃用的 inode 缓存功能相关的剩余项目
EXIT STATUS 退出状态
btrfs check returns a zero exit status if it succeeds. Non zero is
returned in case of failure.
如果 btrfs check 成功,则返回零退出状态。如果失败,则返回非零值。
AVAILABILITY 可用性
btrfs is part of btrfs-progs. Please refer to the documentation at
https://btrfs.readthedocs.io.
btrfs 是 btrfs-progs 的一部分。请参考 https://btrfs.readthedocs.io 上的文档。