Rotating ZFS snapshots without extra tools
A cron job and a few lines of shell keep hourly, daily and weekly snapshots tidy.
Snapshot tools are great, but for one dataset a cron job is easier to reason about.
zfs snapshot tank/data@hourly-$(date +%Y%m%d%H)
zfs list -H -t snapshot -o name -s creation tank/data \
| grep @hourly- | head -n -24 | xargs -r -n1 zfs destroyRetention
| Kind | Kept |
|---|---|
| Hourly | 24 |
| Daily | 14 |
| Weekly | 8 |
Test the prune line with echo in front of zfs destroy before trusting it.