2

I have a VirtualBox VM (with Windows Server 2012 as both host and guest). I created several snapshots while configuring some difficult stuff:

Before installing OS
 \____ Before installing software A
        \____ Before installing software B
               \____ Before installing software C
                      \____ Testing this
                             \____ Testing that
                                    \____ Current state

Now everything works and I need the disk space so I want to discard all snapshots. My research suggests that there's no other way to remove snapshots than one by one, painfully slow as it is. I can't clone or export the VM because it's already using 75% of the host disk.

Should I start removing from top to bottom or viceversa? What would result in faster merges? Or it doesn't really matter?

10
  • If you want to keep the changes you made with each snapshot start at the bottom and merge the changes. If you move your way down you will discard them
    – Ramhound
    Aug 31, 2017 at 11:07
  • @Ramhound I'm confused. I've been freely creating and removing snapshots for a while and never lost current state unless I explicitly restore a snapshot :-? Aug 31, 2017 at 11:32
  • In any event the amount of time it takes is going to be the same, even if the changes captured by the snapshots are saved. You are merging the changes into the base VM, the amount of changes that you made, are going to be static. So the time to merge those changes into the VM will be the same regardless, but I now that I thought about it some more, I reversed my statement. When you delete a snapshot, you are rolling your changes you made with that snapshot into the base vm, so you want the last snapshot to be merged last. You basically want the last snapshot to become the base VM right?
    – Ramhound
    Aug 31, 2017 at 12:34
  • 1
    @Ramhound If I revert to "Before installing OS" I'd expect to get an empty VM and lose all my work :-? Aug 31, 2017 at 12:56
  • 1
    Incidentally, suggesting a question might be a dupe isn't intended to claim that there's anything wrong with it; to the contrary, I had pretty much the same question which is why I noticed there were so many similar ones on here already. Generally its useful to note duplicates so that one question ends up acting as the "canonical" resource for future readers. Jun 3, 2021 at 13:29

2 Answers 2

0

I don't know if this is best way, but it's the fastest way, and only if you want to discard all snapshot and leave current state.

Go to snapshots, right click on current state, click clone, and select all checkboxes and set "Include all network adapter..."

enter image description here

On the next screen select "Full Clone"

On the next screen select "Current Machine State" and hit Clone

Now you have exactly same machine without any snapshots. Need to delete old machine

Cons: - need to either rename old VM before clone or new VM after clone. Since you are preserving all UUIDs all should work same including command line automation. - need additional space to make double size temporarily

Pros: - Fast Auto merge of all snapshots, so no need to waste time to delete one by one

2
  • The question says “I can't clone or export the VM because it's already using 75% of the host disk.” May 23, 2019 at 23:01
  • Didn't read carefully :) but technically if you specify a clone to a different HDD that has enough space it should work. You really can't clone or delete snapshots on same HDD as either approach need x2 space to really copy entire data. You could try delete one by one staring with smallest, hoping to release space for biggest but you likely end-up stuck at some point. You just need more space. Maybe move VM to other external HDD/SSD merge on other Host, move back? May 24, 2019 at 18:38
0

From experience, I would advise that there is only one correct way to delete snapshots: From latest and move backwards, and delete one at a time.
ALWAYS IN SEQUENCE - NEVER DELETE A "MIDDLE" SNAPSHOT. Or way worse, the oldest / top level snapshot. You'd think VB would step in and keep you from making this huge error, but it happily allows it. It should just flip up a banner that says 'ha ha you'll be sorry!' after it does.
If you have never mucked anything up deleting other than the latest snapshot and sequentially moving backwards, you should be able to delete all including the oldest / top level.
If you have mucked it up, and deleted a middle snapshot, you are likely screwed as far as getting rid of everything. Usually there is a error when you try to delete and you are left with whatever snapshots that remain and you can't remove them. You would need to reload the VM at whatever beginning point (install or import).
Be sure to note that each delete process can take quite a while, near 10 minutes each snapshot or more, depending on system size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.