#65
Remove all ZFS snapshots
Tonight, I've been trying to free up some storage space on my Solaris ZFS array, and had a bunch of old snapshots that were eating up 2TB of space. I threw together a quick BASH script to remove those old snapshots.
please use this at your own peril :)
nano /root/scripts/snapshot_cleaner.sh
and paste...
#!/bin/bash
for snapshot in `zfs list -H -t snapshot | cut -f 1 | grep tank`
do
zfs destroy $snapshot
done
Make it executable
chmod +x /root/scripts/snapshot_cleaner.sh
Finally, run it.
. /root/scripts/snapshot_cleaner.sh
In a few minutes, I had removed all my old snapshots and freed up a bunch of space.