Rollback to some nested snapshot (ZFS)

Mael Strom

Active Member
Sep 21, 2019
11
1
43
When trying to use `pct rolback <vmid> <snapname>` it fails on non-recent snapshots.

ZFS itself is able to rollback discarding bookmarks and snapshots newer than target:
```
zfs rollback rpool/data/subvol-999-disk-0@clean
cannot rollback to 'rpool/data/subvol-999-disk-0@clean': more recent snapshots or bookmarks exist
use '-r' to force deletion of the following snapshots and bookmarks:
```

But `pct` is not, and not accepting `-r` or `--recurse`.
And WebUI too.
 
When trying to use `pct rolback <vmid> <snapname>` it fails on non-recent snapshots.

ZFS itself is able to rollback discarding bookmarks and snapshots newer than target:
```
zfs rollback rpool/data/subvol-999-disk-0@clean
cannot rollback to 'rpool/data/subvol-999-disk-0@clean': more recent snapshots or bookmarks exist
use '-r' to force deletion of the following snapshots and bookmarks:
```

But `pct` is not, and not accepting `-r` or `--recurse`.
And WebUI too.

you can simple delete the snapshots one by one, and then rollback.
 
I'll say more, by hands I can delete all above snapshots recursively in one command, zfs able to do it.

It's a good crunch, but it isn't a solution. When you have many snapshots for testing some things, and need rollback to something deeper, it hurts.
ZFS also support deletion of a bunch snapshots from middle, like this: `zfs destroy <dataset>@<snap[N]>%<snap[N+M]`, and it very useful too, for same purposes.

It will be nice, if `pct` support such things, which underlying fs already supports.
 
the problem is that every storage is a bit different, and we need to provide a common interface. you can easily scipt removing the snapshots (either via "pct/qm", or via the REST API) and then rolling back. Ceph, qcow2 and LVM-thin all support rolling back to arbitrary snapshots AFAIR.
 
Agree.
But, it hard to not notice: anyway, one place to implement code by high-skilled engineers, covered by tests, reviewed — definitely better, than a million of user scripts.

Hoping, that Proxmox 7 or 8 will include this functionality.