Onsite Backup - Different snapshot retention time on replication target

I use the same naming scheme for daily, weekly and monthly backups, and TrueNAS just automagically works it out.

Be careful with this. If you temporarily pause or remove one of the snapshot tasks, the remaining tasks can destroy older snapshots without your intention. This isn’t theoretical. It has affected someone.

I’m doing this and yes, confusing and you must validate that the snapshots are working as you expect.

In the worst case scenario, when doing pull, instead of push, TN cannot set a given max snapshot time, only “same as source” and “never delete”, so I ended doing the never delete in some of my remote/secondary replications, AND then have a daily cron job that runs a snapshot deletion script that I can tailor (dataset, text to match. max snapshot secs/days).

Initially my plan was:

  • have three periodic snapshots with different retentions and replicate those to another target (TrueNAS instance)
  • I was aiming to set up three replication task with the retention set individually (longer than the source due to archiving reasons)

In the meantime I learned, that that’s not possible.

Using separate replication tasks (e.g. daily, weekly, and monthly)-snapshots to the same target dataset breaks a ZFS rule (“timeline”). The replication tasks overwrite the snapshots on the target.

Combining all schedules into a single replication task fixes the timeline conflict. But aparently the TrueNAS GUI lets you only set one global retention policy regarding the target. You cannot set individual retentions (e.g., keep daily for 2 weeks, weekly for 2 months) within a single task

It works, when you set the retention times at the source (periodic snapshot) and configure the replication task to use “Same as Source”

On the first replication run, you need to set “Replicate from Scratch”. The following runs than don’t need this setting and it should be turn off in order to not replicate the whole dataset again each time

To be honest I ditched TrueNAS a while ago (but not zfs) and moved everything to Proxmox. I used zrepl in the past that has this feature but it was a hassle for me to get it running inside TrueNAS. On bare metal zfs instances it was fairly easy. Maybe its worth a look?

Check sanoid and syncoid portable as well.

1 Like

Ok, that’s of course another way.

To be honest: I use this particular TrueNAS as a VM on top of Proxmox. But I’d like to keep it as a VM (with passthrough disk(s)) for separation reasons and because I like my hypervisor minimal.

But I can understand your route as well!

I’m starting to read about these tools - sounds promising! Thank you for the hint!