Solutions Log by Dan Reiland

25Nov/090

Remove a Range of Unwanted ZFS Snapshots from the Command Line

Remove a range of unwanted snapshots, from the command line, if necessary.
In the following example, all automatic snapshots in the bash shell are removed.

for s in $(zfs list -H -o name -t snapshot | grep @zfs-auto-snap); do zfs destroy $s; done

One could add a secondary pipe and grep statement to filter on individual file systems.

Reference: How to Manage the Automatic ZFS Snapshot Service