1BTRFS-RESTORE(8) Btrfs Manual BTRFS-RESTORE(8)
2
3
4
6 btrfs-restore - try to restore files from a damaged btrfs filesystem
7 image
8
10 btrfs restore [options] <device> <path> | -l <device>
11
13 btrfs restore is used to try to salvage files from a damaged filesystem
14 and restore them into <path> or just list the subvolume tree roots. The
15 filesystem image is not modified.
16
17 If the filesystem is damaged and cannot be repaired by the other tools
18 (btrfs-check(8) or btrfs-rescue(8)), btrfs restore could be used to
19 retrieve file data, as far as the metadata are readable. The checks
20 done by restore are less strict and the process is usually able to get
21 far enough to retrieve data from the whole filesystem. This comes at a
22 cost that some data might be incomplete or from older versions if
23 they’re available.
24
25 There are several options to attempt restoration of various file
26 metadata type. You can try a dry run first to see how well the process
27 goes and use further options to extend the set of restored metadata.
28
29 For images with damaged tree structures, there are several options to
30 point the process to some spare copy.
31
32 Note
33 It is recommended to read the following btrfs wiki page if your
34 data is not salvaged with default option:
35 https://btrfs.wiki.kernel.org/index.php/Restore
36
38 -s|--snapshots
39 get also snapshots that are skipped by default
40
41 -x|--xattr
42 get extended attributes
43
44 -m|--metadata
45 restore owner, mode and times for files and directories
46
47 -S|--symlinks
48 restore symbolic links as well as normal files
49
50 -v|--verbose
51 be verbose and print what is being restored
52
53 -i|--ignore-errors
54 ignore errors during restoration and continue
55
56 -o|--overwrite
57 overwrite directories/files in <path>, eg. for repeated runs
58
59 -t <bytenr>
60 use <bytenr> to read the root tree
61
62 -f <bytenr>
63 only restore files that are under specified subvolume root pointed
64 by <bytenr>
65
66 -u|--super <mirror>
67 use given superblock mirror identified by <mirror>, it can be 0,1
68 or 2
69
70 -r|--root <rootid>
71 only restore files that are under a specified subvolume whose
72 objectid is <rootid>
73
74 -d
75 find directory
76
77 -l|--list-roots
78 list subvolume tree roots, can be used as argument for -r
79
80 -D|--dry-run
81 dry run (only list files that would be recovered)
82
83 --path-regex <regex>
84 restore only filenames matching a regular expression (regex(7))
85 with a mandatory format
86
87 ^/(|home(|/username(|/Desktop(|/.*))))$
88
89 The format is not very comfortable and restores all files in the
90 directories in the whole path, so this is not useful for restoring
91 single file in a deep hierarchy.
92
93 -c
94 ignore case (--path-regex only)
95
97 btrfs restore returns a zero exit status if it succeeds. Non zero is
98 returned in case of failure.
99
101 btrfs is part of btrfs-progs. Please refer to the btrfs wiki
102 http://btrfs.wiki.kernel.org for further details.
103
105 mkfs.btrfs(8), btrfs-rescue(8), btrfs-check(8)
106
107
108
109Btrfs v5.6 04/05/2020 BTRFS-RESTORE(8)