Syncing ZFS pools to another machine

daves_nt_here

Member
Dec 27, 2021
16
3
23
51
I have 2 machines. (all lxc's [apache web server, SQL server and samba server])
Once the 1st machine was all setup and running, I made backups and recovered them on the 2nd machine.
2nd machine is a backup that is not set to autostart. Only if I start the containers. It's not mission critical for failover.

I would like to keep the files inside the lxc's synced every 15 min.

Doing some googling, I see their is pve-zsync but this looks like is creates a snapshot that would then be transferred to the 2nd machine then recovered.

Could I just do an rsync from the 1st machine to the 2nd?
rsync -aAXH --delete --numeric-ids -e ssh /pool/subvol-5225-disk-1/ root@192.168.40.35:/pool/subvol-5225-disk-1/
OR even:
rsync -aAXH --delete --numeric-ids -e ssh /pool/ root@192.168.40.35:/pool/
 
I see their is pve-zsync but this looks like is creates a snapshot...
Yes. A snapshot makes sure that the whole dataset has a consistent state. And if that's not clear: only the differences (the modified data) will be transferred. "zfs send/receive" is fast because of this.

"rsync" operates on another level, one step up to the file system layer. It is filesystem agnostic, as far as I know. And because of this it has no chance to operate on a snapshot. (You may look for "rsnapshot" or other toolchains instead of plain rsync.) What happens when rsync is busy to copy fileA while fileB is modified and transferred a second later? While this aspect may be not important for most "normal" files the snapshot approach guarantees consistency.