Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a VM with many snapshots. I don't need this machine anymore, and I need disk space. Snapshots eat a significant amount of disk space.

But when I try to delete it by VirtualBox means - there is a stupid deadlock.

$ VBoxManage unregistervm VmName --delete
Oracle VM VirtualBox Command Line Management Interface Version 3.2.14
(C) 2005-2011 Oracle Corporation
All rights reserved.

ERROR: Cannot unregister the machine 'VmName' because it has 84 snapshots
Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports
Context: "UnregisterMachine(uuid, machine.asOutParam())" at line 164 of file VBoxManageMisc.cpp

and if I just want to remove vdi I get

$ VBoxManage --nologo closemedium disk path-to-disk.vdi
ERROR: Medium 'path-to-disk.vdi' is attached to 1 virtual machines
Details: code VBOX_E_OBJECT_IN_USE (0x80bb000c), component Medium, interface IMedium, callee nsISupports
Context: "Close()" at line 1617 of file VBoxManageDisk.cpp

I detached the medium from the VM and get just the same error. Probably because medium is used in past snapshots of the machine. The same persists for any of the snapshots of the disk.

Virtualbox shouldn't be stopped when removing it (I have many VMs on it that should be on), so stop-edit VirtualBox.xml-start is not the way to do.

Should I just remove vdis from the file system? Will it break something except the VM that I don't need anyway?

share|improve this question
    
You should be fine just removing the files. I primarily use the graphical interface of VBox, but the end result is I just need to delete the (now missing) disk from the media manager. closemedium should be the equivalent. –  Bob May 10 '13 at 5:54
    
Wait a second. 3.2.14 is a rather old version. There's actually an old bug report cautioning against removing the VM's files without unregistering. You are aware that they're on 4.2.12 now? Even the 3.2 branch is up to 3.2.16. –  Bob May 10 '13 at 6:00
    
Some more information here, and an old bug report, where someone advices to just delete the files and clean up in VBox afterwards. Some forum posts with similar issues. It seems taht you have to remove each snapshot individually if you're doing it from within VBox. –  Bob May 10 '13 at 6:09
    
Remove 84 snapshots individually? Waste 8 hours of time... Doesn't sound optimistic. Thanks for the info –  Andrey Regentov May 10 '13 at 8:27
    
Yea. Personally, I'd just nuke the folder. That works for me on 4.x on Windows. –  Bob May 10 '13 at 8:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.