Page 1 of 1

Decreasing storage on vbox

Posted: 29. May 2013, 18:23
by derrell
i want to create more space on my host machine and need to decrease the storage space on my virtual machines. my storage is dynamically allocated, and i have looked at other postings giving advice but nothing helps.

i have used: vboxmanage modify "/users/apple/virtualboxvms/csn214inet01/csn214inet01.vdi" --resize 25600

but i've gotten this error message:
VBoxManage: error: Cannot register the hard disk '/Users/Apple/VirtualBoxVMs/CSN214INET01/csn214inet01.vdi' {08d73373-91b6-46a6-b8e8-48c241aac964} because a hard disk '/Users/Apple/VirtualBoxVMs/CSN214INET01/CSN214INET01.vdi' with UUID {08d73373-91b6-46a6-b8e8-48c241aac964} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp

Re: Decreasing storage on vbox

Posted: 29. May 2013, 18:32
by mpack
"--resize" can't be used to make disk capacity smaller, in fact none of the popular tools will allow that because it isn't safe.

If you want to keep a lid on disk space use then getting rid of all snapshots is a great start, and necessary for most of what follows.

If all you want to do is compact the disk then you can either use CloneVDI (under Wine), or run a free space zeroing tool in the guest followed by VBoxManage modifyhd --compact. I would recommend a free space zeroing tool for your guest OS, except you neglected to mention what it was.

If you want to permanently reduce the capacity of a drive then the easiest way is to boot up the guest with a gparted live cd, and reduce the partition size to suit. It's usually a bad idea to make the partition size so small that the guest becomes congested. After the partition size is reduced you should clone+compact with CloneVDI, as that is the only method I know for discarding unpartitioned space on a virtual drive.

Re: Decreasing storage on vbox

Posted: 29. May 2013, 20:57
by loukingjr
I'm confused. If the .vdi is set to be dynamically allocated, even if you set a guest's HD at 2TB the size would only be whatever the files of the guest takes up. Say 15GB or whatever. Or did I miss something?

Re: Decreasing storage on vbox

Posted: 29. May 2013, 21:20
by Perryg
loukingjr wrote:I'm confused. If the .vdi is set to be dynamically allocated, even if you set a guest's HD at 2TB the size would only be whatever the files of the guest takes up. Say 15GB or whatever. Or did I miss something?
Nope you didn't miss anything. There would be a condition of where you installed a lot of programs in the guest and then deleted them. Since the dynamic does not elastic band to the lower size you would need to compact it to reduce the size and reclaim the "empty" state.

Re: Decreasing storage on vbox

Posted: 29. May 2013, 21:25
by loukingjr
thanks Perry :) I have a feeling though since this is related to Macs it might be the issue of Time Machine making backups of all the .vdi's and taking up too much space. If true, turn off Time Machine temporarily, reboot.