Decreasing storage on vbox

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
derrell
Posts: 1
Joined: 29. May 2013, 18:15

Decreasing storage on vbox

Post 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
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Decreasing storage on vbox

Post 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.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: Decreasing storage on vbox

Post 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?
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Decreasing storage on vbox

Post 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.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: Decreasing storage on vbox

Post 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.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
Post Reply