Haven’t had occasion to set up an rsync task before, but now I have two TrueNAS servers and want to sync some data between them. In the relevant directory, files could be added or removed on either system. So ZFS replication is out–if I replicate from A to B, and I’ve added files on B, they’ll disappear when the replication runs.
OK, rsync it is. Pretty obnoxious that the SSH connections set up for replication don’t also work for rsync, but I guess that is what it is. But is it possible to set up a single bidirectional task to push files from A that aren’t present on B to B, and pull files on B that aren’t present on A to A? Or does it just take two tasks?
And as a bonus question, is there a better way I should be considering to do this?
I was hoping for something that didn’t involve an additional app, but that’s a possibility. The one rsync push task I set up consistently fails after about 20 minutes with this:
On further review, Syncthing may be just the ticket. The TrueCharts version, at least, doesn’t seem to work over my tailscale connection, but their relay service still lets both systems connect. Tom’s other video (https://www.youtube.com/watch?v=se4V-CgO7ZM) seems to suggest you’d want to start with data in only one place, but it seems to be syncing up two folders, both with data in them, without problems.
Yup - I use it all the time for 2 way sync. I would (to be safe) start with the data in one place and let it sync naturally - or if paranoid make a copy first, just in case
Well, I’m dealing with about 15 TB of data, most of which is the same between the two systems, and a WAN link to sync them. The soonest these systems would be in the same place will be at the end of this year. So “re-sync everything” really isn’t an option. But of course “make snapshots of both locations” is.
I trust ST can distinguish between “the file isn’t in the destination location yet” and “the file’s been deleted”?
I know of some users who have configured syncthing to create a sort of SMB metro cluster spanning multiple sites on SCALE (one of our enterprise apps). This requires some understanding of which xattrs must be configured to sync up and how to configure the underlying dataset parameters, but it works pretty well once you get it configured. NOTE: this requires SCALE on both sides.
I can only suggest trying it out. Make snapshots first - so if it does go wrong you can recover. Once the initial sync is good you should be OK from then.
With 15TB of data I suspect you will need to adjust a couple of tunables:
Stux et al
Community users can add the enterprise train/catalog of apps to their systems if they choose.
Instructions are different based on the version/release of SCALE. In EE you click Train Settings on the Settings dropdown list (found on the Installed applications screen). Select the enterprise train, click Save, then go back to the Discover apps screen and click Refresh Catalog. Enterprise apps should now show on the screen.
In 24.04, you use the Manage Catalogs link to open the Catalogs screen. Select the option to edit the catalog as described here:
Since all the rest of my apps come from TrueCharts, I decided to install their version of Syncthing as well. But once that was done, well, it did just what it says on the tin. Shared a directory between the two servers, pointed it to the matching physical directory on each NAS, and it happily synced them up–new files on A get copied to B, new files on B get copied to A, files deleted on A get deleted on B, etc. I had to fix permissions in a few places, and a few filenames somehow had non-UTF8 characters which caused ST to barf, but now it’s transferring stuff just fine.
And while both servers were/are connected via Tailscale, that probably really isn’t necessary any more, at least not for this purpose.
I know this topic veered onto syncthing (very nice utility–used it tons, even in enterprise), but you could also try Unison. You can have a little more fine-grained control in some cases. You install unison on both machines, set up a preference file (.prf) and setup a cron script.
Example preference file below. As you can see the paths are a little more customiziable in that you establish a list–include only what you want–and you can also include other preference files so you can have a whole slew of them (which I do) for a bunch of different situations and whatnot.
For SCALE we added a feature to syncthing to ensure it understands ZFS ACLs and properly syncs xattrs. We have done no such work for unison and so there is zero guarantee that it will properly sync up permissions on two TrueNAS servers.