Skip to content

Instantly share code, notes, and snippets.

@RamaRoberts
Created September 28, 2010 20:58
Show Gist options
  • Save RamaRoberts/601761 to your computer and use it in GitHub Desktop.
Save RamaRoberts/601761 to your computer and use it in GitHub Desktop.
#! /bin/sh
for pool in `zpool list -H -o name`; do
zfs snapshot -r $pool@auto:`date "+%FT%T"`
zfs list -H -t snapshot -o name | grep $name@auto: | \
sed -e 's/.*auto://' | sort -r | uniq | tail +14 | \
while read name; do
zfs destroy -r $pool@auto:$name
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment