Linux command
zfs-receive 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Receive snapshot from file
zfs receive [pool/dataset] < [backup.zfs]
Receive from remote system
ssh [host] zfs send [pool/data@snap] | zfs receive [pool/newdata]
Receive with force rollback
zfs receive -F [pool/dataset] < [backup.zfs]
Receive using full path from stream
zfs receive -d [pool] < [backup.zfs]
Dry run to test receive
zfs receive -nv [pool/dataset] < [backup.zfs]
Receive and override properties
zfs receive -o mountpoint=[/mnt/data] [pool/dataset] < [backup.zfs]
Receive excluding property
zfs receive -x compression [pool/dataset] < [backup.zfs]
Resume interrupted receive
zfs receive -s [pool/dataset] < [backup.zfs]
说明
zfs receive (or zfs recv) creates a snapshot from a stream provided on stdin. The stream is typically generated by zfs send. Full streams create new datasets; incremental streams update existing ones. For incremental receives, the destination must have the base snapshot. The -F flag forces rollback to enable the receive. Replication streams (-R from send) can destroy extra snapshots at destination. Properties can be overridden with -o or inherited with -x during receive. This is useful for setting different mount points or compression on the destination. The -s flag enables resumable receives, allowing interrupted transfers to continue from where they stopped.
参数
- -F
- Force rollback to most recent snapshot before receive.
- -d
- Use all but first element of sent snapshot path.
- -e
- Use only last element of sent snapshot path.
- -u
- Don't mount received filesystem.
- -o _property=value_
- Set property on received dataset.
- -x _property_
- Exclude (inherit) property on received dataset.
- -s
- Enable resumable receive.
- -n
- Dry run, don't actually receive.
- -v
- Verbose output.
- -h
- Skip hold related errors (with -F).
FAQ
What is the zfs-receive command used for?
zfs receive (or zfs recv) creates a snapshot from a stream provided on stdin. The stream is typically generated by zfs send. Full streams create new datasets; incremental streams update existing ones. For incremental receives, the destination must have the base snapshot. The -F flag forces rollback to enable the receive. Replication streams (-R from send) can destroy extra snapshots at destination. Properties can be overridden with -o or inherited with -x during receive. This is useful for setting different mount points or compression on the destination. The -s flag enables resumable receives, allowing interrupted transfers to continue from where they stopped.
How do I run a basic zfs-receive example?
Run `zfs receive [pool/dataset] < [backup.zfs]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -F do in zfs-receive?
Force rollback to most recent snapshot before receive.