Remove all ZFS snapshots
Here’s a small bash script to destroy all existing zfs snapshots.
Run at your own risk!
#!/bin/bash
for snapshot in `zfs list -H -t snapshot | cut -f 1`
do
zfs destroy $snapshot
done
for snapshot in `zfs list -H -t snapshot | cut -f 1`
do
zfs destroy $snapshot
done
Related posts:

slawko:
Hi,
It’s better to get rid of cut command:
for snapshot in `zfs list -H -o name -t snapshot`
(…)
23 April 2009, 12:50 pmAnders:
Well,
zfs list -H -o name -t snapshot | xargs -n1 zfs destroy
is even better
18 December 2009, 8:07 pmLuke Sheldrick:
Nice. Ta
24 May 2010, 10:26 amhseldon:
I found that when deleting snapshots from multiple shares this works okay:
zfs list -H -o name -t snapshot|grep nameofzfsshare|pfexec xargs -n1 zfs destroy
4 December 2011, 4:09 pm