Onsite Backup - Different snapshot retention time on replication target

Hi :slight_smile:

I‘m currently setting up my onsite backup and want my main pool to be replicated to my backup machine but want the backup target to hold a different (longer) retention time for different snapshots.

My current snapshots:

  • Daily - Kept for 7 days
  • Weekly - Kept for 4 Weeks
  • Monthly - Kept for 3 Months

I know I can set a different retention time in the replication task but this is for all snapshots. So my daily snapshots would be kept for 6 month for example. But I want to implement this retention time on the backup machine:

  • daily keep for 1 month
  • weekly keep for 3 month
  • monthly keep for 6 month

I came across an post in the old forum with the same question, but it wasn’t really answered.

Is it even possible to implement this kind of retention time within TrueNAS replication tasks?

I am really the only one with this problem? :thinking: The use case doesn’t really seems that unusual to me

I think the only way to do this is to create a replication task for each snapshot task/schema.

Wouldn’t I then have to replicate the data multiple times because the referenced based from the snapshot on each replication task is different?

Shucks you’re right. :frowning_face:

It will either fail or rollback your destination dataset to the most recent snapshot being sent (if the “force” option is invoked.)

Maybe some other workarounds you can think of? What about creating the same snapshot tasks on the backup (same naming scheme etc) and set a higher retention time? But then I think the replication tasks doesnt match up the snapshots from the source anymore. Strange that there is not the option to set different lifetimes for different snapshots :frowning:

This may work but I think you’d need a different naming scheme for the backup system snapshots to avoid the sending machine getting confused.

True but then I have to run the backup system 24/7 which wasnt planned :confused:

Is there a reason why you need a longer retention on the backup pool than on the main pool? Does the main pool have less available capacity?

Yes but also for a sort of archival purposes, for you know just in case

I was about to write up a theoretical way this can be done with scripting, but I think a feature request is more warranted. This is actually something I would expect to be shipped with TrueNAS by default.

If the Replication Tasks allow you to choose multiple Snapshot Tasks or Naming Schemas, then it should present a “Retention Policy” option for each schema.

So you mention this as a desired option for the backup however you also say:

So would you plan be to turn it on every day and then turn it off again?

Weekly or monthly but yes

Yes I was expecting something similar. I have a look on to make a feature request on that.

It would have to be at least weekly otherwise your daily snapshots would have expired before they have been replicated.

Yes I’m aware on that but thanks for pointing it out. But since its seems currently not possible what I want to do I have to set the retention time higher in the replication task anyway.

I don’t know how that relates to the other requirements.

I have three snapshot tasks for dailies, weeklies and monthlies—all with the same naming scheme, but different retention times. The backup server runs a single daily PULL task to retrieve the snaphsot(s). (PUSH should work as well.)
What I think cannot be done is having different retention times on the source and the destination.

A script on the backup server that combines “holds”, “releases”, and “deferred destructions” (i.e, zfs destroy -d) could theoretically accomplish this.

I think that this should be integrated into the GUI, to keep TrueNAS as much of an appliance as possible.

I created a feature request:

1 Like