Virtualbox: can’t remove / attach new hard disk

When i try to remove a disk in Virtualbox with this command:

# VBoxManage storageattach "myvm" --storagectl SATA --port 0 --device 0 --type hdd --medium none

I got the following error

VBoxManage: error: The machine is not mutable or running (state is Saved)
VBoxManage: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "DetachDevice(Bstr(pszCtl).raw(), port, device)" at line 403 of file VBoxManageStorageController.cpp

And the fix is:

VBoxManage discardstate uuid
VBoxManage discardstate 23036a87-de86-4bee-ad92-5eed022a13d9

Leave a Reply

Your email address will not be published. Required fields are marked *