Linux command
zfs-send 命令
文件
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Send snapshot to file
zfs send [pool/dataset@snapshot] > [backup.zfs]
Send snapshot to remote system
zfs send [pool/dataset@snap] | ssh [host] zfs recv [pool/newdataset]
Send incremental between snapshots
zfs send -i [pool/data@snap1] [pool/data@snap2] | ssh [host] zfs recv [pool/data]
Send all incrementals between snapshots
zfs send -I [pool/data@snap1] [pool/data@snap5] > [backup.zfs]
Send replication stream
zfs send -R [pool/dataset@snapshot] > [full-backup.zfs]
Dry run to estimate size
zfs send -nvP [pool/dataset@snapshot]
Send raw encrypted stream
zfs send -w [pool/encrypted@snap] > [encrypted-backup.zfs]
Resume an interrupted send
zfs send -t [token] | ssh [host] zfs recv [pool/data]
说明
zfs send creates a stream representation of a ZFS snapshot that can be saved to a file or piped to zfs receive on another system. This enables backup, replication, and migration of ZFS datasets. Full streams contain complete snapshot data. Incremental streams (-i) contain only changes between two snapshots, enabling efficient ongoing replication. Replication streams (-R) include all descendant datasets and their snapshots. For encrypted datasets, the -w flag sends raw encrypted data that remains encrypted at the destination. Without -w, the stream is decrypted during send. Streams can be compressed, deduplicated, and piped through SSH for remote replication.
参数
- -i _snapshot_
- Generate incremental stream from snapshot.
- -I _snapshot_
- Generate cumulative incremental stream.
- -R
- Generate replication stream (all descendants, clones, properties).
- -D
- Generate a deduplicated stream. Deprecated in OpenZFS 2.1 and ignored.
- -L
- Generate larger blocks in stream if available.
- -e
- Generate more compact stream.
- -c
- Generate compressed stream.
- -w
- Send raw encrypted data (for encrypted datasets).
- -p
- Include dataset properties in stream.
- -b
- Send only properties that are received or local source.
- -h
- Include holds in the replication stream.
- -n
- Dry run, don't generate stream.
- -P
- Print verbose machine-parsable info about the stream.
- -v
- Verbose output, including progress reporting.
- -t _token_
- Resume an interrupted send using the specified receive_resume_token.
FAQ
What is the zfs-send command used for?
zfs send creates a stream representation of a ZFS snapshot that can be saved to a file or piped to zfs receive on another system. This enables backup, replication, and migration of ZFS datasets. Full streams contain complete snapshot data. Incremental streams (-i) contain only changes between two snapshots, enabling efficient ongoing replication. Replication streams (-R) include all descendant datasets and their snapshots. For encrypted datasets, the -w flag sends raw encrypted data that remains encrypted at the destination. Without -w, the stream is decrypted during send. Streams can be compressed, deduplicated, and piped through SSH for remote replication.
How do I run a basic zfs-send example?
Run `zfs send [pool/dataset@snapshot] > [backup.zfs]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -i _snapshot_ do in zfs-send?
Generate incremental stream from snapshot.