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?