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
32 -s|--snapshots
33 get also snapshots that are skipped by default
34
35 -x|--xattr
36 get extended attributes
37
38 -m|--metadata
39 restore owner, mode and times for files and directories
40
41 -S|--symlinks
42 restore symbolic links as well as normal files
43
44 -i|--ignore-errors
45 ignore errors during restoration and continue
46
47 -o|--overwrite
48 overwrite directories/files in path, e.g. for repeated runs
49
50 -t <bytenr>
51 use bytenr to read the root tree
52
53 -f <bytenr>
54 only restore files that are under specified subvolume root
55 pointed by bytenr
56
57 -u|--super <mirror>
58 use given superblock mirror identified by <mirror>, it can be
59 0,1 or 2
60
61 -r|--root <rootid>
62 only restore files that are under a specified subvolume whose
63 objectid is rootid
64
65 -d find directory
66
67 -l|--list-roots
68 list subvolume tree roots, can be used as argument for -r
69
70 -D|--dry-run
71 dry run (only list files that would be recovered)
72
73 --path-regex <regex>
74 restore only filenames matching a regular expression (regex(7))
75 with a mandatory format
76
77 ^/(|home(|/username(|/Desktop(|/.*))))$
78
79 The format is not very comfortable and restores all files in the
80 directories in the whole path, so this is not useful for restor‐
81 ing single file in a deep hierarchy.
82
83 -c ignore case (--path-regex only)
84
85 -v|--verbose
86 (deprecated) alias for global -v option
87
88 Global options
89
90 -v|--verbose
91 be verbose and print what is being restored
92
94 btrfs restore returns a zero exit status if it succeeds. Non zero is
95 returned in case of failure.
96
98 btrfs is part of btrfs-progs. Please refer to the documentation at
99 https://btrfs.readthedocs.io.
100
102 btrfs-check(8), btrfs-rescue(8), mkfs.btrfs(8)
103
104
105
106
1076.6.2 Nov 24, 2023 BTRFS-RESTORE(8)