Run ./simple-zfs-repl -h
for help, it's REALLY™️ simple.
Notice the PREFIX
option must be unique, it's used to mark replication position for a target and also used in lock file name.
You may put it into cron job or write a shell loop in a Systemd service.
There are so many ZFS replication tools, but I'm not satisfied with them:
- Written in Perl/Python/Go that are not so easy to understand
- Too many lines to easily understand
- Some create inconsistent snapshots across ZFS filesystem hierarchy, they should use
zfs snapshot -r
- Some try to manage snapshot retention, I think that is already resolved well by zfs-auto-snapshot
- Some support plain TCP or encrypted TLS transport, I think that's unnecessary, SSH is enough
- Some create ssh authentication wrapper script, I think that's unnecessary too,
zfs allow
is more secure - Some support unencrypted-to-encrypted or encrypted-to-unencrypted etc transformation between
zfs send
andzfs recv
, I don't need that - Some need configuration file or configuration in ZFS properties
- Tried some but I'm not smart enough to get them work
So I make another wheel, hope to keep it short and simple to understand.
- DON'T
zfs clone
snapshots created bysimple-zfs-repl
, these snapshots are for floating mark. Create your own snapshots on source, they will be replicated to target. - DON'T directly create snapshots on target because they will be destroyed automatically by
zfs recv -Fsv
.
Just for your reference, they have more features:
- https://github.com/jimsalterjrs/sanoid/
- https://github.com/bolthole/zrep
- https://github.com/zrepl/zrepl
- https://github.com/oetiker/znapzend/
- https://github.com/jgoerzen/simplesnap
- https://github.com/psy0rz/zfs_autobackup
- https://github.com/alunduil/zfs-replicate
- https://github.com/truenas/zettarepl
- https://github.com/rlaager/zfs-replicate