6 btrfs-restore - try to restore files from a damaged btrfs filesystem image
10 *btrfs restore* [options] <device> <path> | -l <device>
14 *btrfs restore* is used to try to salvage files from a damaged filesystem and
15 restore them into <path> or just list the subvolume tree roots. The filesystem
16 image is not modified.
18 If the filesystem is damaged and cannot be repaired by the other tools
19 (`btrfs-check`(8) or `btrfs-rescue`(8)), *btrfs restore* could be used to
20 retrieve file data, as far as the metadata are readable. The checks done by
21 restore are less strict and the process is usually able to get far enough to
22 retrieve data from the whole filesystem. This comes at a cost that some data
23 might be incomplete or from older versions if they're available.
25 There are several options to attempt restoration of various file metadata type.
26 You can try a dry run first to see how well the process goes and use further
27 options to extend the set of restored metadata.
29 For images with damaged tree structures, there are several options to point the
30 process to some spare copy.
32 NOTE: It is recommended to read the following btrfs wiki page if your data is
33 not salvaged with default option: +
34 https://btrfs.wiki.kernel.org/index.php/Restore
39 get also snapshots that are skippped by default
42 get extended attributes
45 restore owner, mode and times for files and directories
48 restore symbolic links as well as normal files
51 be verbose and print what is being restored
54 ignore errors during restoration and continue
57 overwrite directories/files in <path>, eg. for repeated runs
60 use <bytenr> to read the root tree
63 only restore files that are under specified subvolume root pointed by <bytenr>
66 use given superblock mirror identified by <mirror>, it can be 0,1 or 2
69 only restore files that are under a specified subvolume whose objectid is <rootid>
75 list subvolume tree roots, can be used as argument for '-r'
78 dry run (only list files that would be recovered)
80 --path-regex <regex>::
81 restore only filenames matching a regular expression (`regex`(7)) with a
84 +^/(|home(|/username(|/Desktop(|/.*))))$+
86 The format is not very comfortable and restores all files in the directories
87 in the whole path, so this is not useful for restoring single file in a deep
91 ignore case (--path-regex only)
95 *btrfs restore* returns a zero exit status if it succeeds. Non zero is
96 returned in case of failure.
100 *btrfs* is part of btrfs-progs.
101 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for