Deleting VirtualBox Snapshots

Published: 2010-06-18

The Discard current snapshot and state command dishappeared as of VirtualBox version 3.1 leaving VirtualBox with no obvious way of deleting snapshot disk state (the misnamed Delete Snapshot command merges the snapshot into the parent). The good news is that you can delete snapshots using the branched snapshots feature introduced in version 3.1.

Note

Throughout this post I use the word delete to mean removing both the snapshot and the associated disk state, I use the word merge to mean deleting the snapshot and merging the associated disk state into the parent (the latter refers to the misname VirtualBox Delete Snapshot command and was discussed in a previous post).

The technique to delete snapshots involves grafting an empty snapshot at the point you want to delete to; merging snapshots down to that point; and finally merging the empty snapshot to its parent. The following screenshots should make the process a bit clearer:

  1. Here’s our starting point — the goal is to delete snapshots 3 and 4.
    deleting-vbox-snapshots-1.png
  2. Restore to snapshot 2.
    deleting-vbox-snapshots-2.png
  3. Graft a snapshot (snapshot 5) to snapshot 2.
    deleting-vbox-snapshots-3.png
  4. Restore back to snapshot 4.
    deleting-vbox-snapshots-4.png
  5. Merge snapshot 4 (i.e. use the VirtualBox Delete Snapshot command).
    deleting-vbox-snapshots-5.png
  6. Merge snapshot 3 (i.e. use the VirtualBox Delete Snapshot command).
    deleting-vbox-snapshots-6.png
  7. Restore to the empty snapshot 5.
    deleting-vbox-snapshots-7.png
  8. Merge the empty snapshot 5 (i.e. use the VirtualBox Delete Snapshot command). This last step effectively deletes snapshots 3 and 4 disk state from snapshot 2.
    deleting-vbox-snapshots-8.png

That’s it!

I discuss merging and compacting Snapshots in this post (which also includes a utility (vboxmerge.py) that I wrote to merge VirtualBox snapshots).

Advertisements

5 Responses to “Deleting VirtualBox Snapshots”

  1. SilverWave Says:

    How very odd – I did a test

    machine boot to log in desktop (has 1 doc)
    ss1
    add copy doc (has 2 docs)
    ss2
    add copy doc (has 4 docs)
    ss3

    Then delete
    ss3
    ss2
    Looks as if it has merged but if you close and instead of saving “close > Power off machine > Restore current snapshot Snapshot1” then it actually deletes!

    Obviously at this point I could instead save the machine state, that is if I wanted a merge.

    restore ss1 then only one copy. So delete means delete…

    hmm how to merge then…

  2. SilverWave Says:

    ^ opps
    Looks like an edit problem the last 2 lines where appended in error :-(
    __

    >restore ss1 then only one copy. So delete means delete…

    >hmm how to merge then…
    __

  3. Jon Says:

    Thanks for this. Worked a treat for me!

  4. Erik Says:

    I am sorry but I do not follow this at all.
    There are only screenshots, but no instruction for how to accomplish the tasks?

    I am trying to understand how to delete vs merging the snapshots in various scenarios as you showed above.

  5. sean Says:

    one of my two serious gripes about VirtualBox: 1 ) merge when you really want to revert and nuke the old snapshot. 2 ) the occasional guest abort upon remote desktop disconnect…

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: