ZFS receive resume token
A ZFS receive resume token is the receive_resume_token property value that records where an interrupted resumable receive stopped, so zfs send -t can continue it.
The token exists only when the receive was started with zfs receive -s, which keeps partially received state instead of deleting it when the stream ends early, a checksum error appears in the stream, the receiving process is terminated or the system shuts down uncleanly. That option needs the extensible_dataset pool feature. zfs send -t with the token produces the continuation stream, zfs send -S sends the saved partial state itself with the last fully received snapshot as incremental source if one exists, and zfs receive -A deletes the saved state. [2] [4] [1]
In OpenZFS 2.3.0 the value has the form version-checksum-length-payload. Only token version 1 is accepted, the checksum is the first 64-bit word of a Fletcher-4 sum over the compressed payload, the length is that of the uncompressed payload, and the payload is the hex encoding of a packed name-value list compressed with gzip at level 6. [5] [6]
The list carries the target snapshot GUID and name, the incremental source GUID when there is one, the object number, byte offset and byte count already received, and flags for large-block, embedded, compressed and raw streams, plus redaction snapshot lists where they apply. When the sender parses the token, a target name that now refers to a different snapshot or no longer exists stops the resume with an error. [5] [6]
Relations
Advantages
- An interrupted transfer can continue from the recorded object and offset instead of restarting the whole stream. [2, 5]
- The sending side keeps no session state, because the token carries what is needed to rebuild the continuation stream from the source snapshot. [6]
Limitations
- zfs receive -A discards saved partial state instead of retrying it. [2]
- The payload is only compressed and hex-encoded, not encrypted, so the token discloses the snapshot name and GUIDs it refers to. [5]
- Resuming depends on the original source snapshot still existing on the sending side. [6]
Citations
- OpenZFS v2.3: zfsprops(7), receive_resume_token
- OpenZFS v2.3: zfs-receive(8), incremental and raw receives
- OpenZFS v2.3: zfs-send(8), resume and saved-state streams
- OpenZFS 2.3.0 module/zfs/dsl_dataset.c: get_receive_resume_token_impl
- OpenZFS 2.3.0 lib/libzfs/libzfs_sendrecv.c: resume token parsing and resumed send
Further reading
Sources & caveats
- Version scope: OpenZFS v2.3 documentation and OpenZFS 2.3.0 source, with no pool or recovery experiment.
- props, receive and send are the OpenZFS v2.3 zfsprops(7), zfs-receive(8) and zfs-send(8) manual pages, read in the receive_resume_token, -s, -A, -t and -S entries.
- token-gen is module/zfs/dsl_dataset.c at tag zfs-2.3.0, read in get_receive_resume_token_impl.
- token-parse is lib/libzfs/libzfs_sendrecv.c at tag zfs-2.3.0, read in zfs_send_resume_token_to_nvlist and zfs_send_resume_impl_cb_impl.