Can't get an rsync task to ignore the .zfs folder where snapshots live in a dataset

Hello. I’m wondering if anybody here understands why this isn’t working for me.

I’m on the current latest stable release of CE. I set up an rsync task to send all the data I have in one dataset to a location I created on my Synology NAS. I don’t want the rsync task to copy over any of the zfs snapshot folders (as I have the snapshot location set to visible in the dataset options), so I set --exclude=".zfs" as an auxiliary parameter for the rsync task.

However the rsync task is still sending over all the data in the .zfs/ directory of the dataset. I have tried doing things like --exclude=".zfs/" and --exclude=".zfs/snapshot"` and both don’t work either.

I have resorted to just setting the snapshot location to be invisible so the rsync task doesn’t transfer all that data over.

Am I putting the aux parameter wrong into the GUI?

Thanks for any responses.

Try with a slash in front of the dot.

--exclude=/.zfs/

It’s also possible that these auxiliary parameters are now ignored in the latest TrueNAS CE.

One option if you aren’t particularly relying on snapdir visibility for anything is to turn that off at a dataset level. Then rsync shouldn’t see it and will naturally skip the ctldir / snapdir.

I tried with --exclude=/.zfs/ and it didn’t work.

And yeah, I have resorted to just making the snapshot directory invisible on the dataset level to get around the issue for now.

Using --exclude=".zfs" used to work in the past for me. I have since stopped using rsync many Truenas Scale versions ago and switched to replication tasks after I built a 2nd Truenas server. It’s just now that I find I can’t exclude any whole folder.

I haven’t tried excluding any single file though, so not sure if it’s just directories that can’t be excluded.

It’s possible the auxiliary parameters are no longer being used. Auxiliary parameters were removed from SMB Shares, so maybe the same is being planned for Rsync Tasks?

Hopefully not. Though I believe I remember seeing the exclude option I set from the GUI in the rsync command from the terminal when I logged into it to kill the rsync task during my testing.

Can anyone else exclude folders with their rsync tasks?

Only thing I’m doing special is that I’m using the module mode instead of SSH to connect to my Synology nas.

I had this problem while running an rsync push from my TrueNAS to an old ReadyNAS. I could not exclude ‘.zfs’ from the rsync process set up in the WebGUI of TrueNAS–excluding it there had no effect. I either had to hide .zfs completely (no access on my MacOS) or it would blow up the copy share by copying .zfs internals.

Instead, I set this up as the command of a scheduled cron job on my TrueNAS, it has run without issue for a month now [thank you Gemini AI]:

rsync -avz --delete --exclude='.zfs/' --exclude='snapshot/' -e "ssh -p 22" /mnt/bigpool/my_share/ ``root@192.168.20.30``:/data/my_share-readynas/

The ‘snapshot’ being excluded here is one on the ReadyNAS side, a BTRFS snapshot folder of its own. [Edit: if you have not done it before, you can set up a ‘one line command’ cron job within the WebGUI which gives you some ability to manage it there, search the WebGUI for ‘cron jobs’]

That defeats the point of having a NAS appliance.

Maybe TrueNAS should remove custom cron jobs because they’re risky and dangerous like auxiliary parameters are.

The real solution to this Rsync issue is to remove the option to use auxiliary parameters and remove the ability to create custom cron jobs. The next step would be to make a feature request to add “exclude” to the UI options for Rsync Tasks.

Careful with irony, the way TrueNAS is heading you might get what you do not want…

(Although, admittedly, you’ve already found the solution and the exit door.)