How to delete snapshots from CLI in SynetoOS 4

Written By Christian Castagna (Administrator)

Updated at July 21st, 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 (optional). Change into Solaris shell (in case you're directed to an unsupported shell)

un sh

 

Step 3. Become Super User

sudo su

 

List datastores

 

zfs list

EXAMPLE

root@syneto-os4:/var/storage/admin# zfs list

NAME                                  USED  AVAIL  REFER  MOUNTPOINT

flash                                 554G  1.22T   124K  /flash
flash/datastores                      460G  1.22T   228K  /flash/datastores
flash/datastores/VM1                  19.6G 1.22T  19.6G  /flash/datastores/VM1
flash/datastores/VM2                  3.04G 1.22T  3.04G  /flash/datastores/VM2

 

The NAME column indicates <pool_name> ("flash" in this example).
The NAME column also indicates <datastore_name> (VM1 and VM2 in this example).

The <pool_name> and the <datastore_name> must then be used for the commands provided in the following sections.

 

List datastore's snapshots within a specific time range

 

List all snapshots of a single datastore within a specific time range (replace <pool_name>, <datastore_name> and <date> with the correct information)

zfs list -t snapshot -o name | grep <pool_name>/datastores/<datastore_name> | grep <date>

EXAMPLE

zfs list -t snapshot -o name | grep hybrid/datastores/VM1 | grep 2025-02
zfs list -t snapshot -o name | grep flash/datastores/VM1 | grep 2025-02

 

Delete a single snapshot 

 

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

zfs list -t snapshot -o name <pool_name>/datastores/<datastore_name>

EXAMPLE

zfs list -t snapshot -o name flash/datastores/VM1
zfs list -t snapshot -o name hybrid/datastores/VM1

 

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

zfs destroy <pool_name>/datastores/<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
zfs destroy hybrid/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 within a specific time range

 

Delete all snapshots within a specific time range (replace <pool_name>, <datastore_name> and <date> with the correct information)

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

EXAMPLE

zfs list -r -t snapshot hybrid/datastores/VM1 | grep 2025-02 | awk '{ print $1 }' | xargs -L1 zfs destroy
zfs list -r -t snapshot flash/datastores/VM1 | grep 2025-02 | awk '{ print $1 }' | xargs -L1 zfs destroy

 

Delete snapshots with schedule criteria

 

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

zfs list -r -t snapshot <pool_name>/datastores/<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
zfs list -r -t snapshot hybrid/datastores/vm | grep weekly |  awk '{ print $1 }' | xargs -L1 zfs destroy

 

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

zfs list -r -t snapshot <pool_name>/datastores/<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
zfs list -r -t snapshot hybrid/datastores/vm | grep weekly |  awk '{ print $1 }' | head -n 100 | xargs -L1 zfs destroy