ZFS raw send
ZFS raw send writes the blocks of an encrypted dataset into a send stream exactly as they are stored, so the stream can be moved and received without the keys.
With zfs send -w, blocks leave the pool as they exist on disk, so a backup can be taken while the keys are not loaded and kept on a machine that can neither read the data nor alter it undetected. The received dataset has the same keys as the source, and its keylocation defaults to prompt. For an unencrypted dataset the flag equals -Lec and adds no encryption. [1]
Native encryption uses AEAD ciphers, and each block is encrypted with a random initialization vector kept in metadata. The IVs of all blocks in a snapshot form its IV set, which a raw stream carries to the destination. A non-raw send decrypts on the source; receiving it into an encrypted dataset re-encrypts the data and creates a different IV set. Before an incremental raw receive, the receiver checks that the from snapshot has the same IV set on both sides. [2]
A raw stream can only be received as it is, without re-encryption, decryption or recompression, and encryption properties other than keylocation cannot be overridden. In encrypted blocks the usual 256-bit checksum is split into 128 bits of the chosen checksum and a 128-bit MAC. [2] [3]
Relations
Advantages
- Scrub, resilver, rename and deletion work without the keys, so the receiving pool can be maintained by a party that cannot read the data. [3]
Limitations
- Dataset and snapshot names, the dataset hierarchy, properties, file sizes and holes are not encrypted, so the receiving side can see them. [3]
- A non-raw receive may follow raw replication if ordinary receive checks pass. Re-encryption changes the destination IV set, so later raw incrementals based on that divergent history fail. [2, 1]
Citations
- OpenZFS v2.3: zfs-send(8), raw and resumed streams
- OpenZFS v2.3: zfs-receive(8), incremental and raw receives
- OpenZFS v2.3: zfs-load-key(8), encryption scope
Further reading
Sources & caveats
- send, receive and keys are the OpenZFS v2.3 manual pages zfs-send(8), zfs-receive(8) and zfs-load-key(8).
- They were read in the -w option, the raw receive and IV set discussion, and the Encryption section.
- No send or receive was run, so stream contents were not inspected.