https://github.com/alunduil/zfs-replicate
By Alex Brandt alunduil@gmail.com
zfs-replicate sends all Zettabyte File System (ZFS) snapshots to a remote host by SSH. zfs-replicate does not create ZFS snapshots.
zfs-replicate forks autorepl.py used by FreeNAS.
zfs-replicate relates to several other projects, which fit other niches:
- sanoid: A full snapshot management system. Its companion,
syncoid, handles replication with copious options. - zfs-replicate (BASH): A similar project. The major differences include configuration style and system expectations (for example, logging controls). zfs-replicate uses parameters whereas zfs-replicate (BASH) uses a BASH script.
- znapzend: Another scheduling and replicating system.
- zrep: A SH script with several control commands for snapshot replication.
You are free to copy, change, and distribute zfs-replicate with attribution
under the terms of the BSD-2-Clause licence. See the LICENSE for details.
- A remote system with a ZFS filesystem and the
zfscommand-line tools - If using lz4 compression, local and remote systems must have lz4 in their environments
- SSH access to that remote system
- If you're not using the root user remotely:
- Ensure the user can mount filesystems
- FreeBSD:
sysctl -w vfs.usermount=1
- FreeBSD:
- Add ZFS permissions
- Command:
zfs allow ${USER} ${PERMISSIONS} ${BACKUP_DATASET} - Permissions
clonecreatedestroyholdmountpromotequotareadonlyreceiverenamereservationrollbacksendsnapshot
- Command:
- Ensure the user can mount filesystems
- A local ZFS filesystem and
zfscommand-line tools
N.B., don't use the root user to access your remote system.
poetry installpoetry run -- zfs-replicate --help
To match your destination's policy without a post-receive patch-up, set ZFS
properties on the received data set with --receive-set KEY=VALUE (repeatable)
and control mounting with --receive-no-mount. For example, to set the replica
readonly and keep it from mounting on the destination:
zfs-replicate --receive-no-mount --receive-set readonly=on --receive-set canmount=noauto \
-l backup -i ~/.ssh/id_ed25519 backup.example.com tank/backups tank/dataSee zfs-replicate --help for the full set of --receive- flags.
To replicate a large-block, already-compressed data set without re-reading or
recompressing it on the way out, tune the zfs send stream with the --send-
flags:
zfs-replicate --send-large-block --send-compressed \
-l backup -i ~/.ssh/id_ed25519 backup.example.com tank/backups tank/dataSee zfs-replicate --help for the full set of --send- flags.
zfs-replicate --help: Help for zfs-replicate.- LICENSE: Licence file explaining usage of zfs-replicate.
- Survey of ZFS Replication Tools: Overview of various ZFS replication tools and their uses.
- Working With Oracle Solaris ZFS Snapshots and Clones: Oracle's guide to working with ZFS snapshots.
- ZFS replication without using Root user: How to configure ZFS replication for a non-root user.
- GitHub issues: Report any problems or features requests to GitHub issues.