Removing ZFS Snapshots under SCALE

Under CORE, I had a script that I used occasionally to clean up old “auto” Snapshots that were not a part of my “daily” set - ones created by TrueNAS itself, that I wanted to remove to free up space once I was sure I no longer needed them. That script was:

for s in `zfs list -r -t snap -H -o name /mnt/data | grep @auto` ; do
    zfs destroy -p $s ;
done

When I try to run this under SCALE (24 / Dragonfish), it doesn’t recognize the command “zfs” - is there an alternative I can use to automatically remove snapshots matching a specific text string?

Thank you!

Likely because you’re running the script as admin rather than as root. Run it with sudo and it should be fine.

1 Like

That did it, thank you! I’m still getting used to SCALE after trying to follow some of the new best practices.