zfs-rs
- ZFS administration utility to automate the synchronizing of datasets via sending snapshots.
zfs-rs replicate [OPTIONS] source destination
zfs-rs replicate automates the process of transferring snapshots between multiple instances of the same dataset. It was developed to automate the transfer of nightly "backups" on production infrastructure.
Given a source and a destination, zfs-rs replicate will obtain the snapshot list for both instances, compute whether it is possible to send a delta from A to B, and execute the appropriate zfs(8) commands.
USAGE:
Dataset instances source and destination admit very simple naming rules. At its most basic, a dataset can be specified by naming it as it appears on the output of zfs list
. An example, assuming two locally-attached zpools named "tank" and "backup":
zfs-rs replicate tank/webserver-data backup/webserver-data
Only valid characters are alphanumeric, dash '-', underscore '_' and slash '/', the latter only as component delimiter. This is a subset of the allowed character set in ZFS names, and may change in future versions of this program.
The dataset can be indicated to exist on a remote, SSH-accessible host by prefixing it with a 'hostname:' part, similar to scp(1):
zfs-rs replicate tank/webserver-data bk01.company.tld:backup/webserver-data
Both source and destination can be specified to be remote, including simultaneously in a single invocation of zfs-rs replicate. More details on this mode of operation under section ZFS-RS REPLICATE OVER SSH.
A relative path can be specified by one (and only one) occurrence of "//" in the source instance. All name components that appear the "//" are appended to the destination instance.
zfs-rs replicate tank/containers/webserver-rootfs bk01.company.tld:backup/containers/webserver-rootfs
zfs-rs replicate tank//containers/webserver-rootfs bk01.company.tld:backup
Both invocations are identical. Note that trailing slashes are always illegal; it would be incorrect to write:
zfs-rs replicate tank//containers/webserver-rootfs bk01.company.tld:backup/ # WRONG!
An administrator will normally give idential names to different replicas of the same dataset; this comes naturally but not mandated by ZFS (and neither by zfs-rs replicate). It is perfectly valid to execute the following:
root@webserver05:~$ zfs-rs replicate tank/webserver-data bk01.company.tld:backup/webserver05-data
Of course, having a different naming scheme on the source and destination pools precludes the use of the relative ("//") paths.
For the ending snapshot (s2), zfs-rs replicate will by default choose the most recent snapshot (that already exists) on the source instance. If desired (-t, and optionally -T options), zfs-rs replicate can generate a snapshot on the source instance prior to sending and use that as the ending snapshot (s2).
If only -t is specified, a snapshot name consisting of a prefix ("zfs-rs-" at the time of writing this manual) plus a short, random string of characters will be used.
A name for the snapshot-to-be-created can be passed in using -T.
zfs send -i
will be used, instead of zfs send -I
.zfs recv -F
. Please find detailed usage notes under section ZFS-RECV ROLLBACK.