Page 1 of 1

Snapshots CLI explained

Posted: 1. Aug 2009, 07:12
by sonicbuddha
Can I get a little help understanding the basics of snapshotting from the command line? Not to be critical, but this feature doesn't seem to be outlined well in the documentation, which is too bad since it is such a major plus for VirtualBox usage.

Here's how I understand it (and the parts I don't):

To take a snapshot, which is easy enough:

Code: Select all

VBoxManage snapshot <guest> take <name> [-desc <description>]
The snapshot is not a full copy but a copy of what has changed since the last snapshot. Each snapshot builds on this logic, keeping snapshots small.

To revert to the last snapshot taken:

Code: Select all

VBoxManage snapshot <guest> discardcurrent -state
This changes the current state to the last snapshot, which is what the '-state' implies. This seems self explanatory.

Here's where I get muddy:

Code: Select all

VBoxManage snapshot <guest> discardcurrent -all
If I understand this correctly, this skips the last snapshot and goes back to the previous, changing the "current state" to the snapshot previous. I don't understand the logic behind the name "-all", which is admittedly confusing.

If I want to go back to a snapshot several snapshots ago I have to delete snapshots until the snapshot I want to revert to is the most recent, which honestly begs the question of why snapshot management is so rudimentary and I can't specify a specific snapshot by name? Still, that sounds more like a feature request than a request for information- unless I'm missing something.

What is really confusing is that the discard option doesn't work at all like expected. For example:

I have four snapshots, test1, test2, test3, and test4. I run:

Code: Select all

VBoxManage snapshot <guest> discard test2
And I don't lose test 2 but instead I lose test1. I continue to delete snapshots and instead of removing what I'm asking its always deleting from the oldest. Why? Is there something I'm missing, such as the snapshots are being merged and then renamed? On what basis of logic? I tried this via the gui and this is not the behavior. Am I encountering a bug?

I am using version 3.0.2r49928

Please explain for I feel very confused and a bit insecure about using snapshotting until I understand it better.

Re: Snapshots CLI explained

Posted: 2. Aug 2009, 13:43
by TerryE
My tutorial All about VDIs explains the snapshotting process in more depth.