btrfs-restore(8)

SYNOPSIS 概要 

btrfs restore [options] <device> <path> | -l <device>

DESCRIPTION 描述 

btrfs restore is used to try to salvage files from a damaged filesystem and restore them into path or just list the subvolume tree roots. The filesystem image is not modified.
btrfs restore 用于尝试从损坏的文件系统中挽救文件,并将它们恢复到路径中,或者仅列出子卷树根。文件系统镜像不会被修改。

If the filesystem is damaged and cannot be repaired by the other tools (btrfs-check(8) or btrfs-rescue(8)), btrfs restore could be used to retrieve file data, as far as the metadata are readable. The checks done by restore are less strict and the process is usually able to get far enough to retrieve data from the whole filesystem. This comes at a cost that some data might be incomplete or from older versions if they’re available.
如果文件系统损坏且无法通过其他工具(btrfs-check(8) 或 btrfs-rescue(8))修复,可以使用 btrfs restore 检索文件数据,只要元数据可读取。恢复所做的检查较不严格,通常能够从整个文件系统中检索数据。这样做的代价是一些数据可能是不完整的,或者来自旧版本(如果可用的话)。

There are several options to attempt restoration of various file metadata type. You can try a dry run first to see how well the process goes and use further options to extend the set of restored metadata.
有几种选项可以尝试恢复各种文件元数据类型。您可以首先尝试干跑,看看过程进行得如何,并使用进一步的选项来扩展恢复的元数据集。

For images with damaged tree structures, there are several options to point the process to some spare copy.
对于具有损坏树结构的图像,有几种选项可以将过程指向某些备用副本。

OPTIONS 选项 

-s|--snapshots -s|--快照

get also snapshots that are skipped by default
获取默认情况下被跳过的快照

-x|--xattr

get extended attributes 获取扩展属性

-m|--metadata -m|--元数据

restore owner, mode and times for files and directories
恢复文件和目录的所有者、模式和时间

-S|--symlinks -S|--符号链接

restore symbolic links as well as normal files
恢复符号链接以及普通文件

-i|--ignore-errors -i|--忽略错误

ignore errors during restoration and continue
在恢复过程中忽略错误并继续

-o|--overwrite -o|--覆盖

overwrite directories/files in path, e.g. for repeated runs
覆盖路径中的目录/文件,例如用于重复运行

-t <bytenr>

use bytenr to read the root tree
使用 bytenr 读取根树

-f <bytenr>

only restore files that are under specified subvolume root pointed by bytenr
仅还原由 bytenr 指向的指定子卷根目录下的文件

-u|--super <mirror>

use given superblock mirror identified by <mirror>, it can be 0,1 or 2
使用由<mirror>标识的给定超级块镜像,可以是 0、1 或 2

-r|--root <rootid>

only restore files that are under a specified subvolume whose objectid is rootid
仅还原位于指定子卷下的文件,其 objectid 为 rootid

-d

find directory 查找目录

-l|--list-roots -l|--列出-根目录

list subvolume tree roots, can be used as argument for -r
列出子卷树的根目录,可用作 -r 的参数

-D|--dry-run -D|--模拟运行

dry run (only list files that would be recovered)
干跑(仅列出将被恢复的文件)

--path-regex <regex>

restore only filenames matching a regular expression (regex(7)) with a mandatory format
仅恢复与正则表达式匹配的文件名(regex(7)),并具有强制格式

^/(|home(|/username(|/Desktop(|/.*))))$

The format is not very comfortable and restores all files in the directories in the whole path, so this is not useful for restoring single file in a deep hierarchy.
格式不太方便,并恢复整个路径中目录中的所有文件,因此对于在深层次结构中恢复单个文件并不有用。

-c

ignore case (--path-regex only)
忽略大小写 (--path-regex 仅)

-v|--verbose -v|--详细

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

Global options

-v|--verbose -v|--详细

be verbose and print what is being restored
详细显示正在恢复的内容

EXIT STATUS 退出状态 

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

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-rescue(8), mkfs.btrfs(8)