1BTRFS-RESTORE(8) BTRFS BTRFS-RESTORE(8)
2
3
4
6 btrfs-restore - try to restore files from a damaged filesystem image
7
9 btrfs restore [options] <device> <path> | -l <device>
10
12 btrfs restore is used to try to salvage files from a damaged filesystem
13 and restore them into path or just list the subvolume tree roots. The
14 filesystem image is not modified.
15
16 If the filesystem is damaged and cannot be repaired by the other tools
17 (btrfs-check(8) or btrfs-rescue(8)), btrfs restore could be used to re‐
18 trieve file data, as far as the metadata are readable. The checks done
19 by restore are less strict and the process is usually able to get far
20 enough to retrieve data from the whole filesystem. This comes at a cost
21 that some data might be incomplete or from older versions if they're
22 available.
23
24 There are several options to attempt restoration of various file meta‐
25 data type. You can try a dry run first to see how well the process
26 goes and use further options to extend the set of restored metadata.
27
28 For images with damaged tree structures, there are several options to
29 point the process to some spare copy.
30
31 NOTE:
32 It is recommended to read the following btrfs wiki page if your data
33 is not salvaged with default option:
34
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
61 pointed by bytenr
62
63 -u|--super <mirror>
64 use given superblock mirror identified by <mirror>, it can be
65 0,1 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 find directory
72
73 -l|--list-roots
74 list subvolume tree roots, can be used as argument for -r
75
76 -D|--dry-run
77 dry run (only list files that would be recovered)
78
79 --path-regex <regex>
80 restore only filenames matching a regular expression (regex(7))
81 with a mandatory format
82
83 ^/(|home(|/username(|/Desktop(|/.*))))$
84
85 The format is not very comfortable and restores all files in the
86 directories in the whole path, so this is not useful for restor‐
87 ing single file in a deep hierarchy.
88
89 -c ignore case (--path-regex only)
90
91 -v|--verbose
92 (deprecated) alias for global -v option
93
94 Global options
95
96 -v|--verbose
97 be verbose and print what is being restored
98
100 btrfs restore returns a zero exit status if it succeeds. Non zero is
101 returned in case of failure.
102
104 btrfs is part of btrfs-progs. Please refer to the btrfs wiki
105 http://btrfs.wiki.kernel.org for further details.
106
108 mkfs.btrfs(8), btrfs-rescue(8), btrfs-check(8)
109
111 2022
112
113
114
115
1165.18 May 25, 2022 BTRFS-RESTORE(8)