ZFS in Production: Real-World Deployment Patterns and Pitfalls

One of these days I have to share my script to delete every snapshot but the most recent one of every filesystem, but I have to tidy it up first. I searched and found no similar script in the forum. There was one in the useful-scripts thread but its links don't work anymore.

Edit: In truth, what I'd like is for someone other than me to share their script to do the same and save me the effort. That's my true intention.
 
I'm sorry, but I don't understand what you mean. If you are talking to me, the app you are recommending seems pretty interesting but for what I can understand from its github page it's not what I'm talking about. But thanks.
Sorry, I should have made my post as a reply.
zfs-periodic
1. makes snapshots regularly (hourly, daily, etc.)
2. deletes old snapshots it took leaving the last N snapshots
So, I thought it might much your needs.

But, if what you meant was to erase all but one snapshots including what you or some programs other than zfs-periodic created, surely it is not the one you want.
 
Sorry, I should have made my post as a reply.
zfs-periodic
1. makes snapshots regularly (hourly, daily, etc.)
2. deletes old snapshots it took leaving the last N snapshots
So, I thought it might much your needs.

But, if what you meant was to erase all but one snapshots including what you or some programs other than zfs-periodic created, surely it is not the one you want.

As an Spaniard I feel the need of explaining myself so I don't contribute to the myth of us being disorganized people.

I periodically make backups/clones of my system disk.

My data files live in their own filesystem and are backed up in several disks separately, not as a filesystem but as files.

Snapshots I use manually before I introduce any kind of change to the system (update, installation of an app with many dependencies, messing with the config files).

Sometimes I also do a manual snapshot just because.

From time to time, I delete all snapshots but the latest ones.
 
Seems to me the `zfsnap` utility could be right up your alley.
For example:
Create an alias in your shell RC file for creating a snapshot that has a lifespan (shown here is 5 days):

Code:
alias snap='/sbin/zfsnap snapshot -a 5d -r zpool'

Then create a crontab to just delete snapshots after they expire.
Code:
#
# SNAPSHOT: delete
# At 11:00am on Friday delete expired snapshots.
0       23      *       *       5       root   /usr/local/sbin/zfsnap destroy -r zroot
 
Back
Top