Add a fsck symlink to btrfsck
[platform/upstream/btrfs-progs.git] / Documentation / btrfs-restore.asciidoc
1 btrfs-restore(8)
2 ================
3
4 NAME
5 ----
6 btrfs-restore - try to restore files from a damaged btrfs filesystem image
7
8 SYNOPSIS
9 --------
10 *btrfs restore* [options] <device> <path> | -l <device>
11
12 DESCRIPTION
13 -----------
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.
17
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.
24
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.
28
29 For images with damaged tree structures, there are several options to point the
30 process to some spare copy.
31
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
35
36 OPTIONS
37 -------
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 by <bytenr>
64
65 -u|--super <mirror>::
66 use given superblock mirror identified by <mirror>, it can be 0,1 or 2
67
68 -r|--root <rootid>::
69 only restore files that are under a specified subvolume whose 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)) with a
82 mandatory format
83 +
84 +^/(|home(|/username(|/Desktop(|/.*))))$+
85 +
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
88 hierarchy.
89
90 -c::
91 ignore case (--path-regex only)
92
93 EXIT STATUS
94 -----------
95 *btrfs restore* returns a zero exit status if it succeeds. Non zero is
96 returned in case of failure.
97
98 AVAILABILITY
99 ------------
100 *btrfs* is part of btrfs-progs.
101 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
102 further details.
103
104 SEE ALSO
105 --------
106 `mkfs.btrfs`(8),
107 `btrfs-rescue`(8),
108 `btrfs-check`(8)