Need help to delete near 40k snapshots

In the command-line, you can use the % symbol for bulk sequential deletions.


To delete all snapshots on a dataset from a starting point:

zfs destroy -nv mypool/dataset@auto-2023-03-01%

This will destroy all snapshots on the dataset from @auto-2023-03-01 until the most recent one.


To delete a specific range of snapshots on a dataset:

zfs destroy -nv mypool/dataset@auto-2023-03-01%auto-2024-06-30

This will destroy all snapshots on the dataset from @auto-2023-03-01 until @auto-2024-06-30


To do any of the above “recursively” (such as from a parent or root dataset), add the -r flag to the command.


:warning: WARNING: This will delete all snapshots within the range, regardless of their “name”. It does not discriminate between "auto" or "manual" or any custom naming schema.

Do not remove the -n flag, until you are sure you want to commit to the deletions. Better to be safe with a “dry run”, rather than just go for it.

:information_source: I highly recommend you create a checkpoint of your pool before destroying any snapshots in bulk.

4 Likes