ZFS Snapshots Not Being Deleted

You can use the % symbol to tell zfs destroy to delete an entire sequence of snapshots. Just be aware, it will destroy ALL snapshots in this range, based on their creation date, with a single command.

An example looks like the following.

To do a non-destructive “dry run”:

zfs destroy -nvr Apps@auto-2024-01-01_06-00%auto-2024-07-31_06-00

The above should cover all snapshots between January 1 and July 31, on the Apps dataset and all of its children.

It will tell you which snapshots would be destroyed, and how much space will be freed.

The -r will issue it recursively, to also apply to child datasets.

If you’re feeling brave, you can remove the -n flag, and run the command again with admin/sudo privileges.

I’d advise that you create a checkpoint first, just in case.

zpool checkpoint <nameofpool>

And then afterwards, if everything appears fine, you can remove the checkpoint:

zpool checkpoint -d <nameofpool>
1 Like