Page 1 of 1

Compacting a Windows VM - no effect

Posted: 17. Aug 2017, 16:54
by Michael S
Alright so this has got to be one of the most common questions people ask, but I can't seem to resolve it even after trying many things in this forum and from other sites. Eg: http://www.netreliant.com/news/9/17/Com ... uests.html

I set up a dynamic 128GB Windows 10 VM on my Ubuntu 17.04 256GB hard drive. The VM worked well and things were going fine. Then I noticed the file size of the .vdi had eventually expanded to around 250GB, eating up all my physical drive. Additionally the size of the Windows VM had drive had grown to 230GB!

I moved the .vdi to an external hard drive, and now run it through a USB connection. I'd like to shrink the VM down to 128GB and move it back to my HD.

I have run disk cleanup and sdelete to zero out the space. Then running commands like (and variations of this)

Code: Select all

VBoxManage modifymedium disk Metro_dynamic.vdi --compact
VBoxManage modifyhd --compact disk Metro_dynamic.vdi 
which runs for an hour or so but doesn't shrink the file size.

So then I created a new VM and made the VM fixed and tried similar commands on the this one, like:

Code: Select all

VBoxManage modifymedium disk Metro_fixed.vdi --compact
VBoxManage modifyhd --compact disk Metro_fixed.vdi 
But same effect. Both are still the same size, around 246GB.

I also tried changing the partitions of my Windows HD VM, so now I have a Windows C: partition which shows 50GB used and 72GB free for a total of 122GB, and a second 107GB Unallocated partition. I thought this might allow it to be compacted in that case. But running the modifymedium commands still has no effect.

Any suggestions for a way out of this? Thanks!

Re: Compacting a Windows VM - no effect

Posted: 18. Aug 2017, 10:17
by socratis
Michael S wrote:I set up a dynamic 128GB Windows 10 VM
Michael S wrote:I noticed the file size of the .vdi had eventually expanded to around 250GB, eating up all my physical drive. Additionally the size of the Windows VM had drive had grown to 230GB!
That's a mathematical impossibility! Are you sure you're not talking about your whole VM directory? Are you sure you're not using snapshots?

Right-click on the VM in the VirtualBox Manager. Select "Show in Finder/Explorer/Whatever". ZIP the selected ".vbox" file and attach it to your response.

Also, a complete directory output of your VM directory along with is subdirectories. And finally, the output of the command:
  • VBoxManage showmediuminfo <Complete_Path_To_Your_VDI>