Managing snapshot retention period on replicated snapshots

Roaders

Dabbler
Joined
Sep 30, 2023
Messages
34
Hi All

I have 2 truenas scale boxes. prod and backup. On prod I have a number of periodic snapshot tasks that happen daily / weekly / monthly with different retention periods.
On the backup box it runs once a day and repliactes all the snapshots from prod. In the replication taks I have the retention policy set to "Same as source".

On the prod box all of the snapshots have an expected retention period. On the backup box none of the snapshots have a retention period. Instead they say "Will not be destroyed automatically".

This is disapointing. My snapshots will be kept forever!

2 questions.

  1. How do I set a sensible retention period for the snapshots that are replicated to backup
  2. What is the safest way to delete all the snapshots that I already have that will be there forever if I don't do anything?
Thanks
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
In my experience push replication works as expected. I'm not sure how "same as source" is supposed to work if the destination uses pull - it does not have that information in that case. IMHO.
 

chuck32

Guru
Joined
Jan 14, 2023
Messages
623

Roaders

Dabbler
Joined
Sep 30, 2023
Messages
34
Yes it is using pull so I was wondering the same. I assumed that the information was probably sent with the snapshot. IMHO if you are using pull then that option should be disabled or removed from the list.
 

chuck32

Guru
Joined
Jan 14, 2023
Messages
623
Did you test if the snapshots do indeed do not get removed?

It is normal, at least in push, that the displayed retention time is "will not get destroyed" but in the end they will be.
 

Roaders

Dabbler
Joined
Sep 30, 2023
Messages
34
Hmmmm... good point...

the reason I started looking into this is that I am getting an alert every night:

Replication "FlugPlatz" failed: could not find any snapshots to destroy; check snapshot names..​

23/01/2024 00:00:05 (Europe/London)

So it's obviously trying to destroy something...
 

chuck32

Guru
Joined
Jan 14, 2023
Messages
623
What does /var/log/zettarepl.log say?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Yes it is using pull so I was wondering the same. I assumed that the information was probably sent with the snapshot. IMHO if you are using pull then that option should be disabled or removed from the list.
All retention/expiry managed by zettarepl is based exclusively on the snapshot names. There is no inherent information of that kind (other than the creation date) in the snapshot itself or anywhere in ZFS. That does come as a surprise to many.

Example: even the local retention (snapshot task) or a push replication does not delete "snapshots older than X days". It deletes "snapshots that fall into the configured naming scheme and whose name indicates they are older than X days".
 

MountainMan

Dabbler
Joined
Dec 10, 2020
Messages
42
Hmm.. I seem to be hitting this issue myself.

Goal: Recursively replicate a ZFS dataset on remote vanilla Ubuntu server via pull from TrueNAS Scale. Add any new snapshots created since the last run, and remove any that no longer exist.

It seems that doesn't really fit into the "Snapshot Retention Policy" options I see. "Same as source" sounded hopeful initially, but doesn't follow snapshot deletions from the (non-local non-trunas) source. "None" isn't going to help, and I don't see any "Custom" option which is mentioned (maybe do to pull?)

Is it safe to say I won't be accomplishing this via the TrueNAS admin? Seem like I'll need to reverse things to push from the remote host via syncoid or similar. :/
 
Top