Virtualbox: How to merge current state (snapshot) with disk image

No beforeGRML is not the current state. It is the machine state of the point in time when you made the snapshot.

VirtualBox is really unintuitive with snapshot command naming, if you want to merge the current state you have to delete the snapshot.

From their manual (http://www.virtualbox.org/manual/ch08.html#idp15412176):

The delete operation deletes a snapshot (specified by name or by UUID). This can take a while to finish since the differencing images associated with the snapshot might need to be merged with their child differencing images.

To revert to the state of the snapshot you use the restore operation:

The restore operation will restore the given snapshot (specified by name or by UUID) by resetting the virtual machine's settings and current state to that of the snapshot. The previous current state of the machine will be lost. After this, the given snapshot becomes the new "current" snapshot so that subsequent snapshots are inserted under the snapshot from which was restored.


Another way to get a virtual disk in the state of a specific snapshot is to clone that virtual disk with VBoxManage.

To be sure what virtual disk you clone, open for read the .vbox file or use the GUI to get the disk path (i prefer to use full paths rather than hard disk IDs).

Cloning a ...TheNameOfVirtualDisk... gives you all previous states merged onto the new one, while letting untouched all the snapshots.

Then you can test in a new machine this new disk and see if it is what you want it to be and if it works.

So, that way if something goes wrong, you lose nothing except only some time.

Not to mention, if you want to get rid of only a snapshot in the middle of the tree of snapshots... it is a PAIN, the terminology VBox uses make a lot people to get confused.

But, thinking this way you will FIX the terminology: Deleting a Snapshot does not lose anything else except that point in time (internally it merges that State into all of the childs).

Let me explain with a more complex example. You have a Top level, with two childs, one of that child has also two childs while the other has three childs. Top level is A (one node), second level is B (two nodes), third level is C (five nodes), so tree is as follows:

  • A1
  • A1 - B1
  • A1 - B1 - C1
  • A1 - B1 - C2
  • A1 - B2
  • A1 - B2 - C3
  • A1 - B2 - C4
  • A1 - B2 - C5

Imagine now you want to get rid of B1, then when you delete B1 the differencing disk need to be merged onto C1 and C2, so C1 & C2 will be childs of A1; it is not as simple as deleting a single file; this VirtualBOX call it DELETE the B1 snapshot.

Now comes the other way of wish: Want to lose the states after a point, let me saw for that tree, i want to get rid of B2 and all its childs, so there is no more B2 part on the tree (implies eliminating all levels of its childs), so it will be very fast to do, it is only to delete some files (C3, C4, C5 & B2); this is not possible to be done in VirtualBOX, what VirtualBOX call RESTORE is to get rid of C1, C2 & C3, but not B2... you need to manually edit the .VBOX file and do that work manually. If you restore A1 to get rid of B2, you will also loose B1, C1 & C2 in the process.

So be sure what you do!

Yes, VirtualBOX allows you to get rid of B2 and all its childs, but not in one step, you need two steps:

  1. Restore B2, so all childs get removed and their files deleted
  2. Delete B2, so B2 it self get removed and its files deleted

Hope now it can be a little bit clear... a lot of people on internet talk about losing all their work because they RESTORE A1, trying to REMOVE B2.

If terms had been REMOVE and DESTROY it would not caused so much confusion.

REMOVE a node is to get rid of that node without touching the rest (if it has childs merge the state on all of them, if not just delete the state). DESTROY a node is to get rid of a node and all its childs (just delete the state and all child states).

I do not understand why VBox talks about RESTORE when talking about Snapshots, that introduces a lot of misunderstanding.