summaryrefslogtreecommitdiff
path: root/Documentation/btrfs-receive.8
blob: 13771d33688792ed145593f2b83f5780f7f8f3fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
'\" t
.\"     Title: btrfs-receive
.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 01/23/2019
.\"    Manual: Btrfs Manual
.\"    Source: Btrfs v4.20.1
.\"  Language: English
.\"
.TH "BTRFS\-RECEIVE" "8" "01/23/2019" "Btrfs v4\&.20\&.1" "Btrfs Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
btrfs-receive \- receive subvolumes from send stream
.SH "SYNOPSIS"
.sp
\fBbtrfs receive\fR [options] \fI<path>\fR
.sp
or
.sp
\fBbtrfs receive\fR \-\-dump [options]
.SH "DESCRIPTION"
.sp
Receive a stream of changes and replicate one or more subvolumes that were previously generated by \fBbtrfs send\fR\&. The received subvolumes are stored to \fIpath\fR, unless \fI\-\-dump\fR option is given\&.
.sp
If \fI\-\-dump\fR option is specified, \fBbtrfs receive\fR will only do the validation of the stream, and print the stream metadata, one operation per line\&.
.sp
\fBbtrfs receive\fR will fail in the following cases:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  1." 4.2
.\}
receiving subvolume already exists
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  2." 4.2
.\}
previously received subvolume has been changed after it was received
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  3." 4.2
.\}
default subvolume has changed or you didn\(cqt mount the filesystem at the toplevel subvolume
.RE
.sp
A subvolume is made read\-only after the receiving process finishes successfully (see BUGS below)\&.
.sp
\fBOptions\fR
.PP
\-v
.RS 4
increase verbosity about performed actions, print details about each operation
.RE
.PP
\-f \fI<FILE>\fR
.RS 4
read the stream from
\fI<FILE>\fR
instead of stdin,
.RE
.PP
\-C|\-\-chroot
.RS 4
confine the process to
\fIpath\fR
using
\fBchroot\fR(1)
.RE
.PP
\-e
.RS 4
terminate after receiving an
\fIend cmd\fR
marker in the stream\&.
.sp
Without this option the receiver side terminates only in case of an error on end of file\&.
.RE
.PP
\-E|\-\-max\-errors \fI<NERR>\fR
.RS 4
terminate as soon as NERR errors occur while stream processing commands from the stream
.sp
Default value is 1\&. A value of 0 means no limit\&.
.RE
.PP
\-m \fI<ROOTMOUNT>\fR
.RS 4
the root mount point of the destination filesystem
.sp
By default the mountpoint is searched in
\fI/proc/self/mounts\fR\&. If
\fI/proc\fR
is not accessible, eg\&. in a chroot environment, use this option to tell us where this filesystem is mounted\&.
.RE
.PP
\-\-dump
.RS 4
dump the stream metadata, one line per operation
.sp
Does not require the
\fIpath\fR
parameter\&. The filesystem remains unchanged\&.
.RE
.SH "BUGS"
.sp
\fBbtrfs receive\fR sets the subvolume read\-only after it completes successfully\&. However, while the receive is in progress, users who have write access to files or directories in the receiving \fIpath\fR can add, remove, or modify files, in which case the resulting read\-only subvolume will not be an exact copy of the sent subvolume\&.
.sp
If the intention is to create an exact copy, the receiving \fIpath\fR should be protected from access by users until the receive operation has completed and the subvolume is set to read\-only\&.
.sp
Additionally, receive does not currently do a very good job of validating that an incremental send stream actually makes sense, and it is thus possible for a specially crafted send stream to create a subvolume with reflinks to arbitrary files in the same filesystem\&. Because of this, users are advised to not use \fBbtrfs receive\fR on send streams from untrusted sources, and to protect trusted streams when sending them across untrusted networks\&.
.SH "EXIT STATUS"
.sp
\fBbtrfs receive\fR returns a zero exit status if it succeeds\&. Non zero is returned in case of failure\&.
.SH "AVAILABILITY"
.sp
\fBbtrfs\fR is part of btrfs\-progs\&. Please refer to the btrfs wiki \m[blue]\fBhttp://btrfs\&.wiki\&.kernel\&.org\fR\m[] for further details\&.
.SH "SEE ALSO"
.sp
\fBmkfs\&.btrfs\fR(8), \fBbtrfs\-send\fR(8)