ZFS-RECEIVE(8) | System Manager's Manual | ZFS-RECEIVE(8) |
zfs-receive
—
create snapshot from backup stream
zfs |
receive [-FhMnsuv ]
[-o
origin=snapshot]
[-o
property=value]
[-x property]
filesystem|volume|snapshot |
zfs |
receive [-FhMnsuv ]
[-d |-e ]
[-o
origin=snapshot]
[-o
property=value]
[-x property]
filesystem |
zfs |
receive -A
filesystem|volume |
zfs
receive
[-FhMnsuv
] [-o
origin=snapshot]
[-o
property=value]
[-x
property]
filesystem|volume|snapshotzfs
receive
[-FhMnsuv
]
[-d
|-e
]
[-o
origin=snapshot]
[-o
property=value]
[-x
property]
filesystemzfs
send
subcommand, which by default creates a full
stream. zfs
recv
can be
used as an alias for zfs
receive
.
If an incremental stream is received, then the
destination file system must already exist, and its most recent snapshot
must match the incremental stream's source. For
zvols, the
destination device link is destroyed and recreated, which means the
zvol
cannot be accessed during the receive
operation.
When a snapshot replication package stream that is generated
by using the zfs
send
-R
command is received, any snapshots that do
not exist on the sending location are destroyed by using the
zfs
destroy
-d
command.
The ability to send and receive deduplicated send streams has
been removed. However, a deduplicated send stream created with older
software can be converted to a regular (non-deduplicated) stream by
using the zstream
redup
command.
If -o
property=value or
-x
property is specified, it
applies to the effective value of the property throughout the entire
subtree of replicated datasets. Effective property values will be set
(-o
) or inherited (-x
)
on the topmost in the replicated subtree. In descendant datasets, if the
property is set by the send stream, it will be overridden by forcing the
property to be inherited from the top‐most file system. Received
properties are retained in spite of being overridden and may be restored
with zfs
inherit
-S
. Specifying -o
origin=snapshot
is a special case because, even if origin is a
read-only property and cannot be set, it's allowed to receive the send
stream as a clone of the given snapshot.
Raw encrypted send streams (created with
zfs
send
-w
) may only be received as is, and cannot be
re-encrypted, decrypted, or recompressed by the receive process.
Unencrypted streams can be received as encrypted datasets, either
through inheritance or by specifying encryption parameters with the
-o
options. Note that the
keylocation property cannot be overridden to
prompt during a receive. This is because the receive
process itself is already using the standard input for the send stream.
Instead, the property can be overridden after the receive completes.
The added security provided by raw sends adds some restrictions to the send and receive process. ZFS will not allow a mix of raw receives and non-raw receives. Specifically, any raw incremental receives that are attempted after a non-raw receive will fail. Non-raw receives do not have this restriction and, therefore, are always possible. Because of this, it is best practice to always use either raw sends for their security benefits or non-raw sends for their flexibility when working with encrypted datasets, but not a combination.
The reason for this restriction stems from the inherent restrictions of the AEAD ciphers that ZFS uses to encrypt data. When using ZFS native encryption, each block of data is encrypted against a randomly generated number known as the "initialization vector" (IV), which is stored in the filesystem metadata. This number is required by the encryption algorithms whenever the data is to be decrypted. Together, all of the IVs provided for all of the blocks in a given snapshot are collectively called an "IV set". When ZFS performs a raw send, the IV set is transferred from the source to the destination in the send stream. When ZFS performs a non-raw send, the data is decrypted by the source system and re-encrypted by the destination system, creating a snapshot with effectively the same data, but a different IV set. In order for decryption to work after a raw send, ZFS must ensure that the IV set used on both the source and destination side match. When an incremental raw receive is performed on top of an existing snapshot, ZFS will check to confirm that the "from" snapshot on both the source and destination were using the same IV set, ensuring the new IV set is consistent.
The name of the snapshot (and file system, if a full stream is
received) that this subcommand creates depends on the argument type and
the use of the -d
or -e
options.
If the argument is a snapshot name, the specified
snapshot is created. If the argument is a file
system or volume name, a snapshot with the same name as the sent
snapshot is created within the specified
filesystem or volume. If
neither of the -d
or -e
options are specified, the provided target snapshot name is used exactly
as provided.
The -d
and -e
options cause the file system name of the target snapshot to be
determined by appending a portion of the sent snapshot's name to the
specified target filesystem. If the
-d
option is specified, all but the first
element of the sent snapshot's file system path (usually the pool name)
is used and any required intermediate file systems within the specified
one are created. If the -e
option is specified,
then only the last element of the sent snapshot's file system name (i.e.
the name of the source file system itself) is used as the target file
system name.
-F
zfs
send
-R
[-i
|-I
]), destroy
snapshots and file systems that do not exist on the sending side.-d
-e
-h
-M
-n
-v
option to verify the name the
receive operation would use.-o
origin=snapshot-o
property=valuezfs
set
property=value was invoked
immediately before the receive. When receiving a stream from
zfs
send
-R
, causes the property to be inherited by all
descendant datasets, as through zfs
inherit
property was run on
any descendant datasets that have this property set on the sending
system.
If the send stream was sent with
-c
then overriding the
compression property will have no affect on
received data but the compression property will be
set. To have the data recompressed on receive remove the
-c
flag from the send stream.
Any editable property can be set at
receive time. Set-once properties bound to the received data, such
as
normalization
and
casesensitivity,
cannot be set at receive time even when the datasets are newly
created by zfs
receive
. Additionally both settable
properties
version
and
volsize
cannot be set at receive time.
The -o
option may be specified
multiple times, for different properties. An error results if the
same property is specified in multiple -o
or
-x
options.
The -o
option may also be used to
override encryption properties upon initial receive. This allows
unencrypted streams to be received as encrypted datasets. To cause
the received dataset (or root dataset of a recursive stream) to be
received as an encryption root, specify encryption properties in the
same manner as is required for zfs
create
. For instance:
# zfs
send
tank/test@snap1 |
zfs
recv
-o
encryption=on
-o
keyformat=passphrase
-o
keylocation=file:///path/to/keyfile
Note that -o
keylocation=prompt may not be
specified here, since the standard input is already being utilized
for the send stream. Once the receive has completed, you can use
zfs
set
to change
this setting after the fact. Similarly, you can receive a dataset as
an encrypted child by specifying -x
encryption to force the property to be inherited.
Overriding encryption properties (except for
keylocation) is not possible with raw send
streams.
-s
zfs
receive
process,
or unclean shutdown of the system.
The receive can be resumed with
a stream generated by zfs
send
-t
token, where the token
is the value of the
receive_resume_token
property of the filesystem or volume which is received into.
To use this flag, the storage pool must have the extensible_dataset feature enabled. See zpool-features(7) for details on ZFS feature flags.
-u
-v
-x
propertyIf the specified property is not present in the send stream, this option does nothing.
If a received property needs to be overridden, the effective value will be set or inherited, depending on whether the property is inheritable or not.
In the case of an incremental update,
-x
leaves any existing local setting or
explicit inheritance unchanged.
All -o
restrictions (e.g.
set-once) apply equally to -x
.
zfs
receive
-A
filesystem|volumezfs
receive
-s
, deleting its
saved partially received state.February 16, 2020 | OpenZFS |