Is switching between snapshots possible? Against which base are snapshot taken?


Can we switch back and forth between various snapshots of a container, with possibly modifications done at any moment (and lost I assume when switching to another snapshot)?

To be clear, if I have a container with 5 snapshots S0… S5 taken in that order:

  1. Can I restore S1, modify and test it, then restore S4 or S5 ?
  2. While doing so, I assume all modifications done for the test are lost, exact?
  3. If all that is doable, that means snapshotting is based on the container as a reference, right?

Thank you!
PS: I hope the answer is not RTFM… I made some searches for sure :slight_smile:

That should work fine with everything except for zfs.
If the container is stored on zfs, only the most recent snapshot may be restored. Restoring an older snapshot requires the deletion of the more recent ones.

That being said, if you just want to poke at things, copying a snapshot into a new container tends to be easiest and works on zfs too: lxc copy container/snap0 container1

Thank you a lot as usual Stéphane. It’s a pleasure to get so quick and clear answers.
(I’m using btrfs so all fine)