btrfs-rescue(8)

SYNOPSIS 概要 

btrfs rescue <subcommand> <args>

DESCRIPTION 描述 

btrfs rescue is used to try to recover a damaged btrfs filesystem.
btrfs rescue 用于尝试恢复损坏的 btrfs 文件系统。

SUBCOMMAND 子命令 

chunk-recover [options] <device>

Recover the chunk tree by scanning the devices
通过扫描设备恢复块树

Options

-y

assume an answer of yes to all questions.
对所有问题假设答案为是。

-h

help. 帮助。

-v

(deprecated) alias for global -v option
(已弃用)全局 -v 选项的别名

Note 注意

Since chunk-recover will scan the whole device, it will be very slow especially executed on a large device.
由于 chunk-recover 将扫描整个设备,特别是在大设备上执行时会非常慢。

fix-device-size <device> 修复设备大小 <device>

fix device size and super block total bytes values that do not match
修复设备大小和超级块总字节数值不匹配

Kernel 4.11 starts to check the device size more strictly and this might mismatch the stored value of total bytes. See the exact error message below. Newer kernel will refuse to mount the filesystem where the values do not match. This error is not fatal and can be fixed. This command will fix the device size values if possible.
内核 4.11 开始更严格地检查设备大小,这可能导致存储的总字节数不匹配。请查看下面的确切错误消息。更新的内核将拒绝挂载值不匹配的文件系统。此错误不是致命的,可以修复。如果可能,此命令将修复设备大小值。

BTRFS error (device sdb): super_total_bytes 92017859088384 mismatch with fs_devices total_rw_bytes 92017859094528

The mismatch may also exhibit as a kernel warning:
不匹配也可能表现为内核警告:

WARNING: CPU: 3 PID: 439 at fs/btrfs/ctree.h:1559 btrfs_update_device+0x1c5/0x1d0 [btrfs]
clear-ino-cache <device>

Remove leftover items pertaining to the deprecated inode cache feature.
删除与已弃用的 inode 缓存功能相关的剩余项目。

The inode cache feature (enabled by mount option “inode_cache”) has been completely removed in 5.11 kernel.
inode 缓存功能(通过挂载选项“inode_cache”启用)已在 5.11 内核中完全删除。

clear-space-cache <v1|v2> <device>
clear-space-cache <v1|v2> <设备>

Completely remove the on-disk data of free space cache of given version.
完全删除给定版本的空闲空间缓存的磁盘数据。

Especially for v1 free space cache, clear_cache mount option would only remove the cache for updated block groups, the remaining would not be removed. Thus this command is provided to manually clear the free space cache.
特别针对 v1 空闲空间缓存,clear_cache 挂载选项仅会删除更新的块组的缓存,其余部分不会被删除。因此提供此命令以手动清除空闲空间缓存。

clear-uuid-tree <device> clear-uuid-tree <设备>

Clear UUID tree, so that kernel can re-generate it at next read-write mount.
清除 UUID 树,以便内核可以在下次读写挂载时重新生成它。

Since kernel v4.16 there are more sanity check performed, and sometimes non-critical trees like UUID tree can cause problems and reject the mount. In such case, clearing UUID tree may make the filesystem to be mountable again without much risk as it’s built from other trees.
自内核 v4.16 开始,执行了更多的健全性检查,有时像 UUID 树这样的非关键树可能会导致问题并拒绝挂载。在这种情况下,清除 UUID 树可能会使文件系统再次可挂载,而风险不大,因为它是由其他树构建的。

super-recover [options] <device>
super-recover [选项] <设备>

Recover bad superblocks from good copies.
从好的副本中恢复坏的超级块。

Options

-y

assume an answer of yes to all questions.
对所有问题假设答案为是。

-v

(deprecated) alias for global -v option
(已弃用)全局 -v 选项的别名

zero-log <device> zero-log <设备>

clear the filesystem log tree
清除文件系统日志树

This command will clear the filesystem log tree. This may fix a specific set of problem when the filesystem mount fails due to the log replay. See below for sample stack traces that may show up in system log.
此命令将清除文件系统日志树。当文件系统挂载失败时,可能会修复一组特定问题,原因是日志重放。请参阅下面可能出现在系统日志中的示例堆栈跟踪。

The common case where this happens was fixed a long time ago, so it is unlikely that you will see this particular problem, but the command is kept around.
这种情况通常很久以前就已经修复,因此您不太可能遇到这个特定问题,但该命令仍然保留。

Note 注意

Clearing the log may lead to loss of changes that were made since the last transaction commit. This may be up to 30 seconds (default commit period) or less if the commit was implied by other filesystem activity.
清除日志可能导致自上次事务提交以来所做更改的丢失。这可能长达 30 秒(默认提交周期),或者如果提交是由其他文件系统活动隐含触发的,则可能更短。

One can determine whether zero-log is needed according to the kernel backtrace:
可以根据内核回溯确定是否需要零日志:

? replay_one_dir_item+0xb5/0xb5 [btrfs]
? walk_log_tree+0x9c/0x19d [btrfs]
? btrfs_read_fs_root_no_radix+0x169/0x1a1 [btrfs]
? btrfs_recover_log_trees+0x195/0x29c [btrfs]
? replay_one_dir_item+0xb5/0xb5 [btrfs]
? btree_read_extent_buffer_pages+0x76/0xbc [btrfs]
? open_ctree+0xff6/0x132c [btrfs]

If the errors are like above, then zero-log should be used to clear the log and the filesystem may be mounted normally again. The keywords to look for are ‘open_ctree’ which says that it’s during mount and function names that contain replay, recover or log_tree.
如果错误如上所述,则应使用零日志来清除日志,然后文件系统可以正常挂载。要查找的关键字是“open_ctree”,表示在挂载期间以及包含 replay、recover 或 log_tree 的函数名称。

EXIT STATUS 退出状态 

btrfs rescue returns a zero exit status if it succeeds. Non zero is returned in case of failure.
如果成功,btrfs rescue 返回零退出状态。如果失败,则返回非零。

AVAILABILITY 可用性 

btrfs is part of btrfs-progs. Please refer to the documentation at https://btrfs.readthedocs.io.
btrfs 是 btrfs-progs 的一部分。请参考 https://btrfs.readthedocs.io 上的文档。

SEE ALSO 参见 

btrfs-check(8), btrfs-scrub(8), mkfs.btrfs(8)