Page 1 of 1

How to decrease the memory assigned to virtualbox

Posted: 6. Nov 2013, 12:55
by ??!!
Hi,

I have installed virtualBox on my windows (237 GB). I have chosen a fixed memory of 100 GB for the virtualBox. It was a bad choice because actually I don't have enough memory to use "heavy" softwares on windows :( and i don't really need the 100 GB assigned to virtualbox ...

Is there any way I can decrease the memory of the virtualbox or to make the memory flexible ??

Thanks a lot for your help.

Re: How to decrease the memory assigned to virtualbox

Posted: 6. Nov 2013, 15:51
by Rootman
Are you asking about MEMORY that is RAM or disk space? Given the numbers you are throwing out it must be DISK SPACE, which is NOT memory.

You can reduce the size of the virtual disk many ways.

1) Recreate the VM with a smaller disk - and when doing so choose a DYNAMIC disk instead of a static one, it will then be smaller than even what you specify the size to be and will grow to potentially be the full size that you specify on it's creation.

2) If you stuck with the VDI disk type you can use the CloneVDI tool viewtopic.php?t=22422 and make a second disk of smaller size then release the original, attach the new and delete the original one.

3) You can create a new smaller disk and attach it to the VM, then use a clone tool like Ghost to copy the contents to the new disk. Shut down the VM, detach the larger disk, move the new one up to it's place on the controller and then delete the original.

I'm sure there are a few more ways but one of these will work for you.

Re: How to decrease the memory assigned to virtualbox

Posted: 6. Nov 2013, 18:28
by mpack
Just to prevent one possible misunderstanding: you can't shrink the capacity of a disk with CloneVDI, it won't let you (nor will VBoxManage). You can however compact it, and CloneVDI always outputs dynamic VDI, so the VDI file will be physically smaller while continuing to represent a 100GB disk.

The best solution is to run GParted and shrink the main partition capacity down to something reasonable: let's say 32GB. Then clone+compact with CloneVDI as discussed above. Now you'll still have a 100GB disk, but the partition will prevent it growing beyond 32GB (ish), and it'll start off way smaller than that.

The safest thing would be to build a new VM around the cloned VDI, delete the old VM when you're sure the clone is OK.

Or, if this is all for a new VM then you could consider simply deleting the existing VM (say yes when it asks if you want to delete the physical files, as this is how you will recover the disk space) and start again from scratch. Remember next time to choose a 32GB drive, dynamic VDI.