ZFS-PRUNE-SNAPSHOTS(1)

πŸ“¦ version 1.5.0, in alpine 3.24, nixos 26.05, nixpkgs unstable

✨ ZFS-PRUNE-SNAPSHOTS πŸ’…

okay so bestie, welcome to the zfs-prune-snapshots(1) page β€” a general commands manual entry, no cap, and it's literally about scooping up old ZFS snapshots and yeeting them. Let me walk you through it 🫢


🌸 NAME 🌸

zfs-prune-snapshots β€” Remove snapshots from one or more zpools that match given criteria. that's it, that's the whole vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

zfs-prune-snapshots [OPTIONS] <time> [[DATASET1] ...]

like, options first, then the time thing, then as many datasets as your heart desires (or none, she's flexible πŸ’–)


⭐ DESCRIPTION ⭐

Remove snapshots from one or more zpools that match a criteria given over the command line. yes queen, you hand her the criteria, she hands you a cleaner pool. it's giving spring cleaning but make it zfs 🧹✨


πŸ’… OPTIONS πŸ’…

  • -h β€” print this message and exit (the classic "help me help you" move)
  • -n β€” dry-run, don't actually delete snapshots πŸ™ˆ (she'll look at them very seriously but won't touch)
  • -l β€” list only mode, just list matching snapshots names without deleting (like dry-run mode with machine-parseable output πŸ”₯)
  • -p <prefix> β€” snapshot prefix string to match
  • -s <suffix> β€” snapshot suffix string to match
  • -i β€” invert matching of prefix and suffix (the "not me matching the opposite" energy πŸ’€)
  • -q β€” quiet, do not printout removed snapshots 🀫
  • -R β€” recursively delete, pass '-R' directly to 'zfs destroy'
  • -v β€” increase verbosity (more talking, more detail, more 🌈)
  • -V β€” print the version number and exit

⏰ TIMESPEC ⏰

The first argument denotes how old a snapshot must be for it to be considered for deletion β€” possible specifiers are:

  • s β€” seconds
  • m β€” minutes
  • h β€” hours
  • d β€” days
  • w β€” weeks
  • M β€” months
  • y β€” years
watch the case bestie β€” m is minutes and M is months 😭 they are NOT the same and she will not be forgiving about it

πŸ”₯ EXAMPLES πŸ”₯

  • zfs-prune-snapshots 1w β€” Remove snapshots older than a week across all zpools
  • zfs-prune-snapshots -vn 1w β€” Same as above, but with increased verbosity and without actually deleting any snapshots (dry-run)
  • zfs-prune-snapshots 3w tank1 tank2/backup β€” Remove snapshots older than 3 weeks on tank1 and tank2/backup. Note that this script will recurse through all of tank1 and all datasets below tank2/backup
  • zfs-prune-snapshots -p 'autosnap_' 1M zones β€” Remove snapshots older than a month on the zones pool that start with the string "autosnap_"
  • zfs-prune-snapshots -s '_frequent' 2M tank β€” Remove snapshots older than two months on the tank pool that end with the string "_frequent"
  • zfs-prune-snapshots -i -p 'autosnap_' 1M zones β€” Remove snapshots older than a month on the zones pool that do not start with the string "autosnap_"

πŸ’€ BUGS πŸ’€

found one? spill it here: ⟨https://github.com/bahamas10/zfs-prune-snapshots⟩ πŸ›


πŸ‘‘ AUTHOR πŸ‘‘

Dave Eddy <bahamas10> <dave@daveeddy.com> (https://www.daveeddy.com) β€” icon behavior honestly 🫢


🌈 SEE ALSO 🌈

zpool(1M), zfs(1M) β€” go read those too, iykyk ⭐


πŸ“ LICENSE πŸ“

MIT License ✨


and that's the whole page bestie πŸ’œ this was zfs-prune-snapshots(1) from the General Commands Manual, part of the User Commands corner, dated NOV 2018 β€” slay, go prune responsibly πŸŽ€πŸ’–

πŸ“¦ where this page comes from