Auto-delete expired snapshots ?

AlcSi

Dabbler
Joined
Sep 20, 2019
Messages
41
Hi, I'm guessing this has been asked over and over so sorry in advance, but I couldn't find an answer with the search.

In my FreeNAS-11.3-U5 instance, using:
Code:
zfs list -t snapshot
lists a whole lot of snapshots that have outlived their own expiration (ex: raidp1/rh@auto-20200630.0000-1m; this one-month snapshot should have been deleted quite a while ago already).
And it's not a naming issue... at least for part of them, which are the cases I'm interrested in solving.

Note that:
Code:
zfs holds raidp1/rh@auto-20200630.0000-1m
(or with any other very old snapshot) doesn't give any output. As far as I understand, it means that there is no manual "hold" on the snapshot ?

I can definitely delete them but it's a daunting task (that could, indeed, be scripted), but, mostly, the point of my message is that I would have expected the system to simply wipe out snapshots that are older than their expected lifetime...

What did I miss ?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
First, its easy to delete a bunch of old snapshots using the syntax:

zfs destroy pool/dataset@oldestSnap%newestSnap

All snapshots between the oldestSnap and newestSnap for that dataset (or if you use recursive, all children too) will be destroyed in one command.

I have yet to understand which process is really doing the job of deleting old snapshots if they aren't linked to a replication task (zettarepl does it in that case).

I think it's the middleware daemon in 12, but seems you're not using that.

Anyway, maybe some of that helps.
 

AlcSi

Dabbler
Joined
Sep 20, 2019
Messages
41
It does help, and I've used the method to clear up space (was above 80%), thanks.
I'd still be willing to understand how automatic snapshot rotation should work so this is not a worry anymore in the future, if another user has the info.
 
Top