Noob here. I have identical datasets/filesystems on two TrueNAS devices both running 25.04. I would like to rsync between select NFS filesystems on these devices nightly, some from TN1>TN2 and some from TN2>TN1. These filesystems are actively mounted to hosts. Can this be done with internal Truenas tools or do I need to setup a VM and just do a manual rsync? Thanks!
The best way to do this is with ZFS replication. You can replicate datasets between Truenas systems quiet easily.
Thanks for the reply. After reading about ZFS snapshots I see that the first snap will create a full size copy of the source dataset though subsequent snaps are only deltas. This would be a problem for me as I have a few filesystems of 6TB each. I am also not yet clear on the application/update process of the snap once it is sent to the target system. Is it automatically applied to the target dataset once it is replicated to the target host or are there manual commands that need to be done when the replication is completed? Is there any interruption on the target host when this snap is applied?
I am quite familiar with rsync and how it only sends deltas, as my Truenas hosts were formerly Ubuntu 22 w/ZFS, and I was hoping to do something with rsync through built-in TrueNAS tools. I am currently caught up trying to figure out the ssh keys, pairs, and how they work with the Data Protection > rsync tasks. I am familiar with manually exchanging keys but have not figured out how to do this in the Truenas GUI. Yet. Thanks for the suggestion. In the meantime I will continue to poke around Truenas forums and docs to see if this replication is possible with rsync.
The first snapshot is NOT a full size copy - its just a marker for a point in time and takes no appreciable space. Any changes after that point use extra space as the original data in the snapshot cannot be changed
WIth ZFS replication the destination is always read-only if you want to perform incremental runs in the future. The OP reads like he wants to sync on the file level with both sides accessible via NFS.
So rsync it ist, IMHO.
Why would you need to set up a VM? rsync is in the TrueNAS base system. Find the rsync invocation you need (something like rsync -a <source> <destination>
) and set up a cron job with that command.
Possibly wrap all the rsync tasks in a shell script with some logging and put that in a cron job.
Or use Syncthing as app or VM.
Understood. But in the situation where I am replicating that first snap of a volume on array1 to array2 what gets shipped, a full copy or just the deltas?
I now understand that a ZFS replication target is read-only so that would not meet my specific needs. As you noted, I want a fully usable copy of the volume contents on both arrays. I have not yet figured out proper permissions for accounts to get to the command prompt with root privs and setup an rsync script via cron. I thought I could do that with the Data Protection > Rsync Tasks but havent figured that all out yet.
If both sides can be edited then I suggest syncthing as a two way copy
Replication always ensure full transfer of underlying data, whether as full copy or as delta.
In your situation, you could run a one-off replication to transfer the data, make the replication target writable (readonly=off) and then let rsync or Syncthing handle further changes.