[Users] Basic questions about ploop snapshotting

Roman Haefeli reduzent at gmail.com
Sat Oct 18 13:44:35 PDT 2014


Hey Scott

Sorry, I accidentally used the address of my son as sender, but it was
still me writing the mail.


On Sam, 2014-10-18 at 13:53 -0600, Scott Dowdle wrote:
> Martin,
> 
> ----- Original Message -----
> > I'm not quite following all of your statements. Specifically, I don't
> > see why you think you need a base AND a first snapshot. One snapshot is
> > sufficient for later restoring. Also, I don't think you need to
> > understand the underlying architecture in order to successfully use
> > snapshots (it might be helpful or interesting, but not really necessary).
> > The command 'snapshot-switch' reliably restores the state  of
> > the CT it had at the time when you created the snapshot. It's as simple
> > as that. Also, when deleting snapshots, vzctl auto-magically does the
> > right thing in that it merges or deletes when it is appropriate without
> > affecting the other snapshots of the given container.
> 
> If I only create a single snapshot... it is active... and there is no
> other snapshot to switch to... *THAT* is why I need two snapshots...
> one I called the "base".  If you only have one snapshot... there is
> absolutely nothing you can do with it... other than delete it... which
> merges it down... and you are stuck with it.
> 
> I know that doesn't seem how it should work... but so far as I can
> figure out, that is indeed how it works.
> 
> I single snapshot is basically worthless.
> 
> I would love to be wrong about that and if someone can show me
> otherwise I'm definitely ready to receive the set of instructions.

Ok, I think I understand now what you mean. Creating the first snapshot
means that from now on rood.hdd is mounted read-only and any further
changes are written to the delta file. Although this snapshot is flagged
as active, you can still switch to it. Switching to it means that the
delta file deleted and a new empty one is created, so that you get the
state of the 'naked' root.hdd image. Changes are still written now to
the new delta file so it increases in size over time. When you finally
delete the snapshot, all the data of the delta file is merged to
root.hdd. This means from now on you cannot switch to an earlier state
since all changes have been incorporated to rood.hdd.

You can verify what by doing following steps while watching the size of
the files in the rood.hdd folder of the CT root.

$ vzctl snapshot CTID --name cleanstate

Now create some files in the CT and see how the delta file grows
(probably you need to issue a 'sync' command inside the CT so that
caches are flushed to disk). Now when you do:

$ vzctl snapshot-switch CTID --id <id-of-cleanstate>

you see how a new empty delta file is created and the files you created
just before in the CT are gone. If you do some storage heavy stuff, you
see the new delta file grow again. When you now delete the snapshot by
doing:

$ vzctl snapshot-delete CTID --id <id-of-cleanstate>

any changes are moved from the the delta file to the rood.hdd and then
the delta file is deleted. 

I hope I'm actually helping in clearing the picture and not causing more
confusion.

Roman

 



More information about the Users mailing list