Monday, August 11, 2008

The VirtualBox Snapshot Manager Sucks

If you use the snapshot manager under VirtualBox, this post may keep you from inadvertently losing your most recent work in your VM.

I had VirtualBox mostly working but I borked my VM hard (disk errors on the vdi file) by trying to run DPaint (yup old DOS program) under it just for kicks because running crappy old software that's not compatible with your current OS is an ideal way to test a Virtual Machine. Well, VirtualBox didn't like DPaint. Not only did it hang the VM instance, but the VirtualBox app itself hung and I had to kill the app. This ended up corrupting my VDI (virtual disk image) file.

No harm done though... I made a snapshot after my clean install, and then another snapshot after applying all the XP updates, ie 7, WMP11, antivirus, etc, etc. Just revert to the last snapshot and I'd be fine.

So I did a revert but thanks to their crappy snapshot manager, I actually jumped back past my last snapshot and ended up blowing away changes (which was several hours of updating, installing, and tweaking to get XP running just right after the clean install).

Turns out in VirtualBox, if you "Revert to Previous Snapshot", it deletes your current state *AND* your last snapshot and goes to the second-to-last snapshot (while destroying your last actual snapshot). If you want to just revert to your latest snapshot, there is something like "Discard Current State" which really isn't that intuitive. If you have something that could potentially throw away a bunch of work in a non-recoverable fashion, your choices and explanation of the choices should be a bit more clear.

In VirtualBox, snapshots are linear -- there is no branching. Reverting to a snapshot is a destructive process that cannot be undone, and it's confusing because you can either revert to your latest snapshot (which they call reverting to current rather than revert to snapshot) or revert to the snapshot before that (which throws away all current changes as well as throws away your latest snapshot). It's not intuitive and you can lose work.

VMWare is definitely nicer for snapshots. The have snapshot trees (they allow branching points for a VM) which you can selectively revert to any arbitrary snapshot in the tree. Moving to another snapshot is non-destructive and you can move back and forth between branches -- i.e. ABCD revert to C have ABCE and then go back to D.

Oh well... now that I know how the sucky snapshot editor in VirtualBox works, I'm less likely to screw it up in the future.

BTW, one other little annoyance on top of all this... if you do a disk-check at startup under XP with VirtualBox, for some reason, VirtualBox won't reboot itself after the diskcheck completes so you have to do that manually.


Ish said...

This hit me by surprise the other day as well. I just wanted to temporarily revert, which is not possible.

Anyways, for now I'm sticking with VMware since I still have a license that is valid for 6.5. I'll reevaluate VirtualBox when it comes time to get a new VMware Workstation license.

But for development, trees of snapshots and the ability to bounce around between them is really, really nice.

Paul said...

Snapshots in VirtualBox have even more trouble than what you just described.

Turns out, if you want to move a snapshot from it's current host location on drive


to some destination location on drive


you cannot do it! You're stuck!

So if you're running out of diskspace on drive C: because your snapshot is getting too big, too bad! Cannot move it!

To me, this is a show-stopper for VirtualBox, but other's do not feel the same. It's just crazy!

I love everything else about virtualbox - just very annoyed by the snapshot problem, that's all.

thierrybo said...

The manual says just this sentence (on more 200 pages...), but it clearly explain what does the “Revert to current snapshot” choice:

To revert to an earlier snapshot, you right-click on the “Current state” item and
select “Revert to current snapshot”. This will bring the VM back to the state of the
nearest (most recent) snapshot. Similarly, you can merge several earlier snapshots
into one by right-clicking on a snapshot and selecting “Discard snapshot”.

Sean said...

in response to paul,

You are partially correct. I also faced this issue. But it is reasonably easy to get around, as the files which tell VirtualBox where to find it's VDI images are plain text, xml. Simply edit those, and you can move your snapshots and/or the whole virtual disk.

Steve said...

So, what happens if you want to keep the current machine state (with all changes made since the snapshot) and yet delete the snapshot itself. Is this possible? How?

Having taken a snapshhot it seems I have boxed myself in to a corner, and now have no way to throw the snapshot away and retain the current state. Is this really the case, or is the documentation just crappy?

ArtInvent said...

Totally agree. Snapshots are almost useless to me because of this idiotic approach. Why can't I just start a previous snapshot of a machine immediately without 'reverting' or destroying anything.

For that matter, the terms and procedure used to describe this process make no sense whatsoever. 'Revert to current snapshot' makes no sense. What they ought to do is allow you to point to any snapshot and have a menu item on that snapshot that says 'Revert and make this snapshot the current state (YOU WILL LOSE THE CURRENT STATE AND ANY INTERMEDIATE SNAPSHOTS)'. It would still suck but at least it would clear exactly what is happening.

LennyCZ said...

Thanx a lot for the first clarification on ho that w this manager works I found.

I found a lot of posts on this topic but no-one stated clearly enough for me that VB snapshot system is all just _history_ of snapshot, i.e. not a _tree_, as in case of VMWare.

What made it impossible for me to understand this is the "tree view" VM uses to display the snapshot history.

(The fact that they don't use just any normal list for the UI leads me to believe that they are going to change the snapshot system so that it can utilize the tree control :-D)

Anyway, I think VB is really great and nice SW.

DragonSlayr said...

:) Some of us even forget after a year or so and do it again.
The lesson seems to be, make backups of the vm and DO NOT USE SNAPSHOTS!

Mark said...

For anybody coming upon these older posts, have a look at this

Er. Nitesh Tater said...

I am trying to revert the state of a virtual machine using vboxmanage console utility. The required command is executed as follow, on my system, but i am getting "invalid parameter" error regarding 'discardcurrent'nitesh@nitesh-Precision-WorkStation-T5500:$ VBoxManage snapshot "niteshvm" discardcurrent -state
Oracle VM VirtualBox Command Line Management Interface Version 4.1.22
(C) 2005-2012 Oracle Corporation
All rights reserved.


VBoxManage snapshot |
take [--description ] [--pause] |
delete | |
restore | |
restorecurrent |
edit ||--current
[--name ]
[--description ] |
list [--details|--machinereadable]
showvminfo |

Syntax error: Invalid parameter 'discardcurrent'