Opened 16 years ago
Closed 14 years ago
#3959 closed enhancement (fixed)
You can't delete an immutable hard disk because of child disks
Reported by: | shay | Owned by: | |
---|---|---|---|
Component: | virtual disk | Version: | VirtualBox 2.2.2 |
Keywords: | Cc: | ||
Guest type: | Windows | Host type: | Windows |
Description
I need to create a strictly controlled build environment. I want to use a batch file and vboxmanage.exe to create and configure a VM. I also want to be able to completely remove the VM via vboxmanage.exe when I am done. Everything is possible with the exception of removing the hard disk that was added.
The vdi hard disk that I want to use is configured to be immutable. This seems to be the cause of the problem. When you create a VM using an immutable hard disk a differencing vdi child disk is automatically created. Then when it comes time to remove the VM everything can be removed except for the original immutable hard disk. This is because you get an error that the hard disk has child hard disks. The batch file doesn't know the name of these child hard disks.
The "closemedium" option should have an option to remove (and optionally delete) all child hard disks.
Error being experienced:
ERROR: Hard disk '<NULL>' has 28833136 child hard disks Details: code E_FAIL (0x80004005), component HardDisk, interface IHardDisk, call ee IUnknown Context: "Close()" at line 1486 of file VBoxManageDisk.cpp
The immutable disk cannot be deleted as long as there a child image exists (e.g. at least one VM started with this disk attached). First remove the child image (either by VBoxManage or from the medium manager in the GUI), then you will be able to remove the immutable disk. Tested with VBox 3.2.8.