So I recently got a warning that I had very little space on my freenas-boot. I determined that the issue was being held in snapshots. It turned out I had quite a few snaps dating back to 2014.. Nearly 50 of them. I decided to write a script to clean them up so I figure I would share what I used. This will keep the most recent 10 of each snapshot.
Code:
#!/bin/sh RETENTION=10 FSLIST="freenas-boot/ROOT freenas-boot/grub" for FS in $FSLIST ; do KILLLIST=`zfs list -H -rt snap -o name -S creation | grep $FS | tail +$RETENTION | sort` for KILL in $KILLLIST ; do echo zfs destroy -R $KILL zfs destroy -R $KILL done done