Field Notes
October 04, 2026 · 2 min read

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 destroy

Retention

KindKept
Hourly24
Daily14
Weekly8

Test the prune line with echo in front of zfs destroy before trusting it.

Filed under StorageBackups

← Clean shutdowns on a cheap UPS with NUT