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 -i|--ignore-errors
51 ignore errors during restoration and continue
52
53 -o|--overwrite
54 overwrite directories/files in <path>, eg. for repeated runs
55
56 -t <bytenr>
57 use <bytenr> to read the root tree
58
59 -f <bytenr>
60 only restore files that are under specified subvolume root pointed
61 by <bytenr>
62
63 -u|--super <mirror>
64 use given superblock mirror identified by <mirror>, it can be 0,1
65 or 2
66
67 -r|--root <rootid>
68 only restore files that are under a specified subvolume whose
69 objectid is <rootid>
70
71 -d
72 find directory
73
74 -l|--list-roots
75 list subvolume tree roots, can be used as argument for -r
76
77 -D|--dry-run
78 dry run (only list files that would be recovered)
79
80 --path-regex <regex>
81 restore only filenames matching a regular expression (regex(7))
82 with a mandatory format
83
84 ^/(|home(|/username(|/Desktop(|/.*))))$
85
86 The format is not very comfortable and restores all files in the
87 directories in the whole path, so this is not useful for restoring
88 single file in a deep hierarchy.
89
90 -c
91 ignore case (--path-regex only)
92
93 -v|--verbose
94 (deprecated) alias for global -v option
95
96 Global options
97
98 -v|--verbose
99 be verbose and print what is being restored
100
102 btrfs restore returns a zero exit status if it succeeds. Non zero is
103 returned in case of failure.
104
106 btrfs is part of btrfs-progs. Please refer to the btrfs wiki
107 http://btrfs.wiki.kernel.org for further details.
108
110 mkfs.btrfs(8), btrfs-rescue(8), btrfs-check(8)
111
112
113
114Btrfs v5.15.1 11/22/2021 BTRFS-RESTORE(8)