HOWTO: Convert VDIs Between Fixed-Sized and Dynamic In VirtualBox
While there is no way to actually switch a VDI between fixed-size and dynamic, you can clone the existing VDI into a new one with different settings with VBoxManage.
VBoxManage clonehd [ old-fixed-VDI ] [ new-dynamic-VDI ] --variant Standard
VBoxManage clonehd [ old-dynamic-VDI ] [ new-fixed-VDI ] --variant Fixed
If you want to expand the capacity of a VDI, you can do so with
VBoxManage modifyhd [ VDI-image ] --resize [ megabytes ]
Resizing only works for dynamic VDI images. However, you can combine the resize information with the conversion information to expand fixed-size VDIs. (E.g., convert a fixed-size image to dynamic, expand it, and then convert the dynamic image back to a fixed-size image.)
If you want to compact the image as much a possibly, be sure to zero out the free space. This can be done in Linux by using the dd command to write endless zeros to a file and then deleting that file. (With the caveat of the reserved space of EXT and other file systems.)


Jeff Kroll 11:47 am on January 11, 2012 Permalink |
Thanks for the info. One question: does the word following “-variant” essentially tell VBoxManage what is getting changed to what, i.e. putting “Standard” after “-variant” tells it that it’s changing a fixed to a dynamic?
BrainwreckedTech 12:36 pm on January 13, 2012 Permalink |
It only specifies what the new –variant type is going to be. Standard = dynamic.
Jeff Kroll 2:56 pm on January 13, 2012 Permalink |
Got it. Thanks.
Juliano 9:45 pm on January 22, 2012 Permalink |
Please help me with this:
I am entering this on Terminal:
VBoxManage clonehd [ /Users/JulianoCB/VirtualBox\ VMs/Windows\ XP\ SP3\ Clone/Windows\ XP\ SP3\ Clone.vdi][new.vdi] -variant Standard
But then I get this error:
VBoxManage: error: Could not find file for the medium ‘/Users/JulianoCB/[‘ (VERR_FILE_NOT_FOUND)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium, callee nsISupports
Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadWrite, fForceNewUuidOnOpen, pMedium.asOutParam())” at line 210 of file VBoxManageDisk.cpp
Could not find the file but I droped from finder.
How could I fix this??
I am not very familiar with Terminal…
BrainwreckedTech 11:26 pm on January 27, 2012 Permalink |
First off, leave off the [ and the ] as those are used to indicate variables. They’re used in documentation of command line programs (DOS/Windows/Linux/Unix) as they’re aren’t very many formatting options available on the command line.
Second, with the surrounding white space, the [ is being interpreted as a relative file name. I take it you were in your home directory /Users/JulianoCB when you attempted to execute this command, hence /Users/JulianoCB/[ cannot be found.
Lastly, and pre-emptively, make sure you are using a double dash when using --variant. WordPress tries to be helpful and interprets -- as — unless it occurs in monospace text (pre, tt, code, etc.).
Jeff Kroll 10:47 am on February 20, 2012 Permalink |
One of the reasons I was so glad to find your instructions was due to a problem with a vdi that I was–and still am, sigh–experiencing. I originally created a fixed XP vdi. Later I changed it to a dynamic one and I remember it adjusting it itself, make itself bigger, automatically. But something must have changed and for months it has remained as it is today, never growing bigger.
Via the Virtual Media Manager, I can see that the virtual size of the hd is 48.83 and the actual size is 9.99 gb. Inside Windows, properties of the C drive indicate it is just under 10, but it always stays there. I can’t install any new software & I regularly get alerts about a space problem.
I decided to use the process you detail above to clone a copy back into a fixed size. It worked and in the Virtual Media Manager it is listed as virtual size 48.83 and the actual size is listed as the same. Yet upon opening, the properties of the C drive are listed the same as the non-working dynamic version, i.e., about a 10 gig drive!? Despite changing the clone from dynamic to fixed, apparently the problem got cloned over.
Any guesses on what is wrong or a way for me to fix it (hopefully without having to install a new XP system from scratch, with all its time consuming updates)?
BrainwreckedTech 3:50 pm on February 22, 2012 Permalink |
Did you change the partition table after making the virtual disk bigger? If not, it’s the partition table limiting you to the old 10GB size, not Windows. You say you checked the properties of the C: drive, but this would have been a lot clearer if you used Disk Manager instead.
I wouldn’t use Windows’ Disk Manager to change the partition size, though. Find a good Linux live CD and use parted or fdisk instead. That way you can be sure that the only thing you change is the end boundary of the partition that holds Windows’ C: drive.
Also be sure to run chkdsk /r /f after changing the size of any disk Windows has access to.