How to delete snapshots from CLI in SynetoOS 4

Written By Christian Castagna (Administrator)

Updated at January 22nd, 2025

→ Applies to: SynetoOS 4.x

WARNING: The delete operation will permanently delete the snapshots and will no longer be recoverable.

 

Step 1. Connect to SynetoOS appliance via SSH as admin

ssh admin@<your_ip_address_or_hostname>

 

Step 2. Become Super User

sudo su

 

Delete a single snapshot 

Step 1. List datastore's snapshots (replace <datastore_name> with the correct information)

zfs list -t snapshot -o name <datastore_name>

EXAMPLE

zfs list -t snapshot -o name flash/datastores/vm

 

Step 2. Delete the single snapshot of your interest (replace <datastore_name> with the correct information)

zfs destroy <datastore_name>@auto:minute-by-minute-flash--datastores--vm-2021-03-10-17:48

EXAMPLE

zfs destroy flash/datastores/vm@auto:minute-by-minute-flash--datastores--vm-2021-03-10-17:48
Generic

 

Delete a number of snapshots

Step 1. Verify how many snapshots are present on the system

zfs list -r -t snapshot -o name | wc -l

 

Step 2.  Delete a number of snapshots without specific criteria (replace <snapshots_number> with the correct information)

zfs list -r -t snapshot | awk '{ print $1 }' | head -n <snapshots_number> | xargs -L1 zfs destroy

 

Delete snapshots with schedule criteria

Step 1. Delete all snapshots for a specific protection schedule (replace <datastore_name>  and <criteria> with the correct information)

zfs list -r -t snapshot <datastore_name> | grep <criteria> |  awk '{ print $1 }' | xargs -L1 zfs destroy

EXAMPLE

zfs list -r -t snapshot flash/datastores/vm | grep weekly |  awk '{ print $1 }' | xargs -L1 zfs destroy

 

Step 2. Delete a number of snapshots for a specific protection schedule  (replace <datastore_name> ,<criteria> and <snapshots_number> with the correct information)

zfs list -r -t snapshot <datastore_name> | grep <criteria> |  awk '{ print $1 }' | head -n <snapshots_number> | xargs -L1 zfs destroy

EXAMPLE

zfs list -r -t snapshot flash/datastores/vm | grep weekly |  awk '{ print $1 }' | head -n 100 | xargs -L1 zfs destroy