SOLVED Cleanup oldest snapshots on freenas-boot

Status
Not open for further replies.

RobertT

Explorer
Joined
Sep 28, 2014
Messages
54
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

 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
Quick question, you were preforming "snapshots" on your boot volume? Why?

I didn't even know FreeNAS would let you do that, but it is simply sufficient to either manually or use a script to backup the config file at a frequency of your choosing. That is the only thing that changes on the boot volume.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
Quick question, you were preforming "snapshots" on your boot volume? Why?
I assume these are simply the boot environments, from all the updates.
 
Status
Not open for further replies.
Top