Personal tools
You are here: Home Storage Network FreeNAS zfs list - sample commands for performing operations on snapshots

zfs list - sample commands for performing operations on snapshots

This document captures simple command for manipulating zfs snapshots.  Change the egrep command as required to include or exclude snapshots by name. Change xargs command to perform the required action (the command is prefixed with echo to give show a dry run - remove the echo to get it to execute).

Note:

'-H' suppresses the headers

'-o name' outputs just the snapshot name

 

Example: destroy snapshots with 'ds-' in the name:

# zfs list -H -t snapshot -o name | egrep '(ds-)' | xargs -I {} sh -c "echo zfs destroy {}"

Links

Document Actions