mkovac / notes

Pruning ZFS snapshots without a cron mess

2026-10-19

For a while my NAS had three overlapping cron jobs taking snapshots, and none of them cleaned up. I ended up with about 4,000 snapshots and zfs list -t snapshot taking a minute.

The fix was boring: one tool (sanoid), one policy file, and deleting everything else.

[tank/home]
  use_template = production
[template_production]
  hourly = 24
  daily = 30
  monthly = 6
  autosnap = yes
  autoprune = yes

Before switching I destroyed the old snapshots in batches with zfs destroy tank/home@% ranges, which is much faster than one by one.