Pruning snapshots in a replication target

My replication target has less available space than my primary, so I want to prune snapshots in the target more aggressively than the original. What is the recommended way to do this?

My primary snapshot schedule is a triple of hourly/daily/monthly snapshots (9 days hourly, 6 months daily, 10 year monthly). That turns out to crowd the backup pool, so I’d like to shrink the daily window there. But how?

I’ve tried setting up snapshot schedules on the target with the smaller windows (and setting retention policy to “none”), but that seems to create snapshots in the target pool that break replication (“most recent snapshot of offsite/backup/mir does not match incremental source”) even though all the target filesystems are entirely readonly.

Do I need to cook my own thinning script, or am I missing an obvious approach?

Thanks
– perry

Snapshots are pruned based on their name. In other words TN has to recognise which task created the snapshot and then deletes as appropriate.

So adjust the snapshot task for local snapshots and adjust the replication task to adjust the remote snapshots

I am assuming that you are pushing snapshots - which is what I do

Yes, I’m push-syncing between two TN systems. How do I “adjust the replication task to adjust the remote snapshots”? The only choices for retention policy are “same as source”, “none”, and a “custom” that just lets me say “30 days” or such. How do I say “limit the dailies to 30 days but keep the monthlies and hourlies around”? I’m replicating once (a day) for three snapshot schedules. Are you suggesting I should run three replication tasks, each to match one snapshot schedule?

Its the only way I can think of doing it. You have to make sure that your snapshots are named differently rather than the defaults auto-%Y-%m-%d_%H-%M. so use dailies-%Y-%m-%d_%H-%M, hourlies-%Y-%m-%d_%H-%M and monthlies-%Y-%m-%d_%H-%M

So three different snapshot tasks and three different replication tasks

Its the only way I can think of doing it

1 Like

I guess I’m just going to run a thinning script that knows my schedules and conventions. I just didn’t want to re-invent something that’s already obviously (except to me…) available in TrueNAS.

Thanks
– perry

Do you need to send all the snaps you’re taking? Could you not just send the snaps that meet your required backup retention and keep the rest local?

I would love to just send the (fewer) snaps. How do I do that? Keep in mind that I have a gradually thinning schedule. I do not want to thin out the monthlies, which are are the longest-living ones.

In the replication configuration just select the single most appropriate schedule instead of all of them.

I don’t parse. I have three snapshot schedules on the primary (hourly, daily, monthly). How do I “shorten” the daily without affecting the hourly and monthly schedules during replication?

Create another schedule for the daily with a shorter retention and ideally give it a slightly different name and take the snap at a slightly different time during the day to the other daily and send that schedule instead of your other one which stays local.

1 Like