zgenhostid: accept hostid arguments equal to zero.
[zfs.git] / man / man8 / zfs-send.8
blob1a241a52d54b63329639a0d4bd1032415930e206
1 .\"
2 .\" CDDL HEADER START
3 .\"
4 .\" The contents of this file are subject to the terms of the
5 .\" Common Development and Distribution License (the "License").
6 .\" You may not use this file except in compliance with the License.
7 .\"
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 .\" or http://www.opensolaris.org/os/licensing.
10 .\" See the License for the specific language governing permissions
11 .\" and limitations under the License.
12 .\"
13 .\" When distributing Covered Code, include this CDDL HEADER in each
14 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 .\" If applicable, add the following below this CDDL HEADER, with the
16 .\" fields enclosed by brackets "[]" replaced with your own identifying
17 .\" information: Portions Copyright [yyyy] [name of copyright owner]
18 .\"
19 .\" CDDL HEADER END
20 .\"
21 .\"
22 .\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
23 .\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
24 .\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
25 .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
26 .\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
27 .\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
28 .\" Copyright (c) 2014 Integros [integros.com]
29 .\" Copyright 2019 Richard Laager. All rights reserved.
30 .\" Copyright 2018 Nexenta Systems, Inc.
31 .\" Copyright 2019 Joyent, Inc.
32 .\"
33 .Dd June 30, 2019
34 .Dt ZFS-SEND 8
35 .Os
36 .Sh NAME
37 .Nm zfs-send
38 .Nd Generate a send stream, which may be of a filesystem, and may be incremental from a bookmark.
39 .Sh SYNOPSIS
40 .Nm zfs
41 .Cm send
42 .Op Fl DLPRbcehnpvw
43 .Op Oo Fl I Ns | Ns Fl i Oc Ar snapshot
44 .Ar snapshot
45 .Nm zfs
46 .Cm send
47 .Op Fl DLPRcenpvw
48 .Op Fl i Ar snapshot Ns | Ns Ar bookmark
49 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
50 .Nm zfs
51 .Cm send
52 .Fl -redact Ar redaction_bookmark
53 .Op Fl DLPcenpv
54 .br
55 .Op Fl i Ar snapshot Ns | Ns Ar bookmark
56 .Ar snapshot
57 .Nm zfs
58 .Cm send
59 .Op Fl Penv
60 .Fl t
61 .Ar receive_resume_token
62 .Nm zfs
63 .Cm send
64 .Op Fl Pnv
65 .Fl S Ar filesystem
66 .Nm zfs
67 .Cm redact
68 .Ar snapshot redaction_bookmark
69 .Ar redaction_snapshot Ns ...
70 .Sh DESCRIPTION
71 .Bl -tag -width ""
72 .It Xo
73 .Nm zfs
74 .Cm send
75 .Op Fl DLPRbcehnpvw
76 .Op Oo Fl I Ns | Ns Fl i Oc Ar snapshot
77 .Ar snapshot
78 .Xc
79 Creates a stream representation of the second
80 .Ar snapshot ,
81 which is written to standard output.
82 The output can be redirected to a file or to a different system
83 .Po for example, using
84 .Xr ssh 1
85 .Pc .
86 By default, a full stream is generated.
87 .Bl -tag -width "-D"
88 .It Fl D, -dedup
89 Deduplicated send is no longer supported.
90 This flag is accepted for backwards compatibility, but a regular,
91 non-deduplicated stream will be generated.
92 .It Fl I Ar snapshot
93 Generate a stream package that sends all intermediary snapshots from the first
94 snapshot to the second snapshot.
95 For example,
96 .Fl I Em @a Em fs@d
97 is similar to
98 .Fl i Em @a Em fs@b Ns \&; Fl i Em @b Em fs@c Ns \&; Fl i Em @c Em fs@d .
99 The incremental source may be specified as with the
100 .Fl i
101 option.
102 .It Fl L, -large-block
103 Generate a stream which may contain blocks larger than 128KB.
104 This flag has no effect if the
105 .Sy large_blocks
106 pool feature is disabled, or if the
107 .Sy recordsize
108 property of this filesystem has never been set above 128KB.
109 The receiving system must have the
110 .Sy large_blocks
111 pool feature enabled as well.
113 .Xr zpool-features 5
114 for details on ZFS feature flags and the
115 .Sy large_blocks
116 feature.
117 .It Fl P, -parsable
118 Print machine-parsable verbose information about the stream package generated.
119 .It Fl R, -replicate
120 Generate a replication stream package, which will replicate the specified
121 file system, and all descendent file systems, up to the named snapshot.
122 When received, all properties, snapshots, descendent file systems, and clones
123 are preserved.
125 If the
126 .Fl i
128 .Fl I
129 flags are used in conjunction with the
130 .Fl R
131 flag, an incremental replication stream is generated.
132 The current values of properties, and current snapshot and file system names are
133 set when the stream is received.
134 If the
135 .Fl F
136 flag is specified when this stream is received, snapshots and file systems that
137 do not exist on the sending side are destroyed. If the
138 .Fl R
139 flag is used to send encrypted datasets, then
140 .Fl w
141 must also be specified.
142 .It Fl e, -embed
143 Generate a more compact stream by using
144 .Sy WRITE_EMBEDDED
145 records for blocks which are stored more compactly on disk by the
146 .Sy embedded_data
147 pool feature.
148 This flag has no effect if the
149 .Sy embedded_data
150 feature is disabled.
151 The receiving system must have the
152 .Sy embedded_data
153 feature enabled.
154 If the
155 .Sy lz4_compress
156 feature is active on the sending system, then the receiving system must have
157 that feature enabled as well. Datasets that are sent with this flag may not be
158 received as an encrypted dataset, since encrypted datasets cannot use the
159 .Sy embedded_data
160 feature.
162 .Xr zpool-features 5
163 for details on ZFS feature flags and the
164 .Sy embedded_data
165 feature.
166 .It Fl b, -backup
167 Sends only received property values whether or not they are overridden by local
168 settings, but only if the dataset has ever been received. Use this option when
169 you want
170 .Nm zfs Cm receive
171 to restore received properties backed up on the sent dataset and to avoid
172 sending local settings that may have nothing to do with the source dataset,
173 but only with how the data is backed up.
174 .It Fl c, -compressed
175 Generate a more compact stream by using compressed WRITE records for blocks
176 which are compressed on disk and in memory
177 .Po see the
178 .Sy compression
179 property for details
180 .Pc .
181 If the
182 .Sy lz4_compress
183 feature is active on the sending system, then the receiving system must have
184 that feature enabled as well.
185 If the
186 .Sy large_blocks
187 feature is enabled on the sending system but the
188 .Fl L
189 option is not supplied in conjunction with
190 .Fl c ,
191 then the data will be decompressed before sending so it can be split into
192 smaller block sizes.
193 .It Fl w, -raw
194 For encrypted datasets, send data exactly as it exists on disk. This allows
195 backups to be taken even if encryption keys are not currently loaded. The
196 backup may then be received on an untrusted machine since that machine will
197 not have the encryption keys to read the protected data or alter it without
198 being detected. Upon being received, the dataset will have the same encryption
199 keys as it did on the send side, although the
200 .Sy keylocation
201 property will be defaulted to
202 .Sy prompt
203 if not otherwise provided. For unencrypted datasets, this flag will be
204 equivalent to
205 .Fl Lec .
206 Note that if you do not use this flag for sending encrypted datasets, data will
207 be sent unencrypted and may be re-encrypted with a different encryption key on
208 the receiving system, which will disable the ability to do a raw send to that
209 system for incrementals.
210 .It Fl h, -holds
211 Generate a stream package that includes any snapshot holds (created with the
212 .Sy zfs hold
213 command), and indicating to
214 .Sy zfs receive
215 that the holds be applied to the dataset on the receiving system.
216 .It Fl i Ar snapshot
217 Generate an incremental stream from the first
218 .Ar snapshot
219 .Pq the incremental source
220 to the second
221 .Ar snapshot
222 .Pq the incremental target .
223 The incremental source can be specified as the last component of the snapshot
224 name
225 .Po the
226 .Sy @
227 character and following
229 and it is assumed to be from the same file system as the incremental target.
231 If the destination is a clone, the source may be the origin snapshot, which must
232 be fully specified
233 .Po for example,
234 .Em pool/fs@origin ,
235 not just
236 .Em @origin
237 .Pc .
238 .It Fl n, -dryrun
239 Do a dry-run
240 .Pq Qq No-op
241 send.
242 Do not generate any actual send data.
243 This is useful in conjunction with the
244 .Fl v
246 .Fl P
247 flags to determine what data will be sent.
248 In this case, the verbose output will be written to standard output
249 .Po contrast with a non-dry-run, where the stream is written to standard output
250 and the verbose output goes to standard error
251 .Pc .
252 .It Fl p, -props
253 Include the dataset's properties in the stream.
254 This flag is implicit when
255 .Fl R
256 is specified.
257 The receiving system must also support this feature. Sends of encrypted datasets
258 must use
259 .Fl w
260 when using this flag.
261 .It Fl v, -verbose
262 Print verbose information about the stream package generated.
263 This information includes a per-second report of how much data has been sent.
265 The format of the stream is committed.
266 You will be able to receive your streams on future versions of ZFS.
268 .It Xo
269 .Nm zfs
270 .Cm send
271 .Op Fl DLPRcenpvw
272 .Op Fl i Ar snapshot Ns | Ns Ar bookmark
273 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
275 Generate a send stream, which may be of a filesystem, and may be incremental
276 from a bookmark.
277 If the destination is a filesystem or volume, the pool must be read-only, or the
278 filesystem must not be mounted.
279 When the stream generated from a filesystem or volume is received, the default
280 snapshot name will be
281 .Qq --head-- .
282 .Bl -tag -width "-L"
283 .It Fl L, -large-block
284 Generate a stream which may contain blocks larger than 128KB.
285 This flag has no effect if the
286 .Sy large_blocks
287 pool feature is disabled, or if the
288 .Sy recordsize
289 property of this filesystem has never been set above 128KB.
290 The receiving system must have the
291 .Sy large_blocks
292 pool feature enabled as well.
294 .Xr zpool-features 5
295 for details on ZFS feature flags and the
296 .Sy large_blocks
297 feature.
298 .It Fl P, -parsable
299 Print machine-parsable verbose information about the stream package generated.
300 .It Fl c, -compressed
301 Generate a more compact stream by using compressed WRITE records for blocks
302 which are compressed on disk and in memory
303 .Po see the
304 .Sy compression
305 property for details
306 .Pc .
307 If the
308 .Sy lz4_compress
309 feature is active on the sending system, then the receiving system must have
310 that feature enabled as well.
311 If the
312 .Sy large_blocks
313 feature is enabled on the sending system but the
314 .Fl L
315 option is not supplied in conjunction with
316 .Fl c ,
317 then the data will be decompressed before sending so it can be split into
318 smaller block sizes.
319 .It Fl w, -raw
320 For encrypted datasets, send data exactly as it exists on disk. This allows
321 backups to be taken even if encryption keys are not currently loaded. The
322 backup may then be received on an untrusted machine since that machine will
323 not have the encryption keys to read the protected data or alter it without
324 being detected. Upon being received, the dataset will have the same encryption
325 keys as it did on the send side, although the
326 .Sy keylocation
327 property will be defaulted to
328 .Sy prompt
329 if not otherwise provided. For unencrypted datasets, this flag will be
330 equivalent to
331 .Fl Lec .
332 Note that if you do not use this flag for sending encrypted datasets, data will
333 be sent unencrypted and may be re-encrypted with a different encryption key on
334 the receiving system, which will disable the ability to do a raw send to that
335 system for incrementals.
336 .It Fl e, -embed
337 Generate a more compact stream by using
338 .Sy WRITE_EMBEDDED
339 records for blocks which are stored more compactly on disk by the
340 .Sy embedded_data
341 pool feature.
342 This flag has no effect if the
343 .Sy embedded_data
344 feature is disabled.
345 The receiving system must have the
346 .Sy embedded_data
347 feature enabled.
348 If the
349 .Sy lz4_compress
350 feature is active on the sending system, then the receiving system must have
351 that feature enabled as well. Datasets that are sent with this flag may not be
352 received as an encrypted dataset, since encrypted datasets cannot use the
353 .Sy embedded_data
354 feature.
356 .Xr zpool-features 5
357 for details on ZFS feature flags and the
358 .Sy embedded_data
359 feature.
360 .It Fl i Ar snapshot Ns | Ns Ar bookmark
361 Generate an incremental send stream.
362 The incremental source must be an earlier snapshot in the destination's history.
363 It will commonly be an earlier snapshot in the destination's file system, in
364 which case it can be specified as the last component of the name
365 .Po the
366 .Sy #
368 .Sy @
369 character and following
370 .Pc .
372 If the incremental target is a clone, the incremental source can be the origin
373 snapshot, or an earlier snapshot in the origin's filesystem, or the origin's
374 origin, etc.
375 .It Fl n, -dryrun
376 Do a dry-run
377 .Pq Qq No-op
378 send.
379 Do not generate any actual send data.
380 This is useful in conjunction with the
381 .Fl v
383 .Fl P
384 flags to determine what data will be sent.
385 In this case, the verbose output will be written to standard output
386 .Po contrast with a non-dry-run, where the stream is written to standard output
387 and the verbose output goes to standard error
388 .Pc .
389 .It Fl v, -verbose
390 Print verbose information about the stream package generated.
391 This information includes a per-second report of how much data has been sent.
393 .It Xo
394 .Nm zfs
395 .Cm send
396 .Fl -redact Ar redaction_bookmark
397 .Op Fl DLPcenpv
399 .Op Fl i Ar snapshot Ns | Ns Ar bookmark
400 .Ar snapshot
402 Generate a redacted send stream.
403 This send stream contains all blocks from the snapshot being sent that aren't
404 included in the redaction list contained in the bookmark specified by the
405 .Fl -redact
407 .Fl -d
408 ) flag.
409 The resulting send stream is said to be redacted with respect to the snapshots
410 the bookmark specified by the
411 .Fl -redact No flag was created with.
412 The bookmark must have been created by running
413 .Sy zfs redact
414 on the snapshot being sent.
416 This feature can be used to allow clones of a filesystem to be made available on
417 a remote system, in the case where their parent need not (or needs to not) be
418 usable.
419 For example, if a filesystem contains sensitive data, and it has clones where
420 that sensitive data has been secured or replaced with dummy data, redacted sends
421 can be used to replicate the secured data without replicating the original
422 sensitive data, while still sharing all possible blocks.
423 A snapshot that has been redacted with respect to a set of snapshots will
424 contain all blocks referenced by at least one snapshot in the set, but will
425 contain none of the blocks referenced by none of the snapshots in the set.
426 In other words, if all snapshots in the set have modified a given block in the
427 parent, that block will not be sent; but if one or more snapshots have not
428 modified a block in the parent, they will still reference the parent's block, so
429 that block will be sent.
430 Note that only user data will be redacted.
432 When the redacted send stream is received, we will generate a redacted
433 snapshot.
434 Due to the nature of redaction, a redacted dataset can only be used in the
435 following ways:
437 1. To receive, as a clone, an incremental send from the original snapshot to one
438 of the snapshots it was redacted with respect to.
439 In this case, the stream will produce a valid dataset when received because all
440 blocks that were redacted in the parent are guaranteed to be present in the
441 child's send stream.
442 This use case will produce a normal snapshot, which can be used just like other
443 snapshots.
445 2. To receive an incremental send from the original snapshot to something
446 redacted with respect to a subset of the set of snapshots the initial snapshot
447 was redacted with respect to.
448 In this case, each block that was redacted in the original is still redacted
449 (redacting with respect to additional snapshots causes less data to be redacted
450 (because the snapshots define what is permitted, and everything else is
451 redacted)).
452 This use case will produce a new redacted snapshot.
454 3. To receive an incremental send from a redaction bookmark of the original
455 snapshot that was created when redacting with respect to a subset of the set of
456 snapshots the initial snapshot was created with respect to
457 anything else.
458 A send stream from such a redaction bookmark will contain all of the blocks
459 necessary to fill in any redacted data, should it be needed, because the sending
460 system is aware of what blocks were originally redacted.
461 This will either produce a normal snapshot or a redacted one, depending on
462 whether the new send stream is redacted.
464 4. To receive an incremental send from a redacted version of the initial
465 snapshot that is redacted with respect to a subject of the set of snapshots the
466 initial snapshot was created with respect to.
467 A send stream from a compatible redacted dataset will contain all of the blocks
468 necessary to fill in any redacted data.
469 This will either produce a normal snapshot or a redacted one, depending on
470 whether the new send stream is redacted.
472 5. To receive a full send as a clone of the redacted snapshot.
473 Since the stream is a full send, it definitionally contains all the data needed
474 to create a new dataset.
475 This use case will either produce a normal snapshot or a redacted one, depending
476 on whether the full send stream was redacted.
478 These restrictions are detected and enforced by \fBzfs receive\fR; a
479 redacted send stream will contain the list of snapshots that the stream is
480 redacted with respect to.
481 These are stored with the redacted snapshot, and are used to detect and
482 correctly handle the cases above.  Note that for technical reasons, raw sends
483 and redacted sends cannot be combined at this time.
484 .It Xo
485 .Nm zfs
486 .Cm send
487 .Op Fl Penv
488 .Fl t
489 .Ar receive_resume_token
491 Creates a send stream which resumes an interrupted receive.
493 .Ar receive_resume_token
494 is the value of this property on the filesystem or volume that was being
495 received into.
496 See the documentation for
497 .Sy zfs receive -s
498 for more details.
499 .It Xo
500 .Nm zfs
501 .Cm send
502 .Op Fl Pnv
503 .Op Fl i Ar snapshot Ns | Ns Ar bookmark
504 .Fl S
505 .Ar filesystem
507 Generate a send stream from a dataset that has been partially received.
508 .Bl -tag -width "-L"
509 .It Fl S, -saved
510 This flag requires that the specified filesystem previously received a resumable
511 send that did not finish and was interrupted. In such scenarios this flag
512 enables the user to send this partially received state. Using this flag will
513 always use the last fully received snapshot as the incremental source if it
514 exists.
516 .It Xo
517 .Nm zfs
518 .Cm redact
519 .Ar snapshot redaction_bookmark
520 .Ar redaction_snapshot Ns ...
522 Generate a new redaction bookmark.
523 In addition to the typical bookmark information, a redaction bookmark contains
524 the list of redacted blocks and the list of redaction snapshots specified.
525 The redacted blocks are blocks in the snapshot which are not referenced by any
526 of the redaction snapshots.
527 These blocks are found by iterating over the metadata in each redaction snapshot
528 to determine what has been changed since the target snapshot.
529 Redaction is designed to support redacted zfs sends; see the entry for
530 .Sy zfs send
531 for more information on the purpose of this operation.
532 If a redact operation fails partway through (due to an error or a system
533 failure), the redaction can be resumed by rerunning the same command.
535 .Ss Redaction
536 ZFS has support for a limited version of data subsetting, in the form of
537 redaction. Using the
538 .Sy zfs redact
539 command, a
540 .Sy redaction bookmark
541 can be created that stores a list of blocks containing sensitive information. When
542 provided to
543 .Sy zfs
544 .Sy send ,
545 this causes a
546 .Sy redacted send
547 to occur. Redacted sends omit the blocks containing sensitive information,
548 replacing them with REDACT records. When these send streams are received, a
549 .Sy redacted dataset
550 is created. A redacted dataset cannot be mounted by default, since it is
551 incomplete. It can be used to receive other send streams. In this way datasets
552 can be used for data backup and replication, with all the benefits that zfs send
553 and receive have to offer, while protecting sensitive information from being
554 stored on less-trusted machines or services.
556 For the purposes of redaction, there are two steps to the process. A redact
557 step, and a send/receive step. First, a redaction bookmark is created. This is
558 done by providing the
559 .Sy zfs redact
560 command with a parent snapshot, a bookmark to be created, and a number of
561 redaction snapshots. These redaction snapshots must be descendants of the
562 parent snapshot, and they should modify data that is considered sensitive in
563 some way. Any blocks of data modified by all of the redaction snapshots will
564 be listed in the redaction bookmark, because it represents the truly sensitive
565 information. When it comes to the send step, the send process will not send
566 the blocks listed in the redaction bookmark, instead replacing them with
567 REDACT records. When received on the target system, this will create a
568 redacted dataset, missing the data that corresponds to the blocks in the
569 redaction bookmark on the sending system. The incremental send streams from
570 the original parent to the redaction snapshots can then also be received on
571 the target system, and this will produce a complete snapshot that can be used
572 normally. Incrementals from one snapshot on the parent filesystem and another
573 can also be done by sending from the redaction bookmark, rather than the
574 snapshots themselves.
576 In order to make the purpose of the feature more clear, an example is
577 provided. Consider a zfs filesystem containing four files. These files
578 represent information for an online shopping service. One file contains a list
579 of usernames and passwords, another contains purchase histories, a third
580 contains click tracking data, and a fourth contains user preferences.  The
581 owner of this data wants to make it available for their development teams to
582 test against, and their market research teams to do analysis on.  The
583 development teams need information about user preferences and the click
584 tracking data, while the market research teams need information about purchase
585 histories and user preferences. Neither needs access to the usernames and
586 passwords. However, because all of this data is stored in one ZFS filesystem,
587 it must all be sent and received together. In addition, the owner of the data
588 wants to take advantage of features like compression, checksumming, and
589 snapshots, so they do want to continue to use ZFS to store and transmit their
590 data.  Redaction can help them do so. First, they would make two clones of a
591 snapshot of the data on the source. In one clone, they create the setup they
592 want their market research team to see; they delete the usernames and
593 passwords file, and overwrite the click tracking data with dummy
594 information. In another, they create the setup they want the development teams
595 to see, by replacing the passwords with fake information and replacing the
596 purchase histories with randomly generated ones.  They would then create a
597 redaction bookmark on the parent snapshot, using snapshots on the two clones
598 as redaction snapshots. The parent can then be sent, redacted, to the target
599 server where the research and development teams have access. Finally,
600 incremental sends from the parent snapshot to each of the clones can be send
601 to and received on the target server; these snapshots are identical to the
602 ones on the source, and are ready to be used, while the parent snapshot on the
603 target contains none of the username and password data present on the source,
604 because it was removed by the redacted send operation.
605 .Sh SEE ALSO
606 .Xr zfs-bookmark 8 ,
607 .Xr zfs-receive 8 ,
608 .Xr zfs-redact 8 ,
609 .Xr zfs-snapshot 8