Compacting a Windows VM - no effect

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Michael S
Posts: 1
Joined: 17. Aug 2017, 16:12

Compacting a Windows VM - no effect

Post 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!
Last edited by socratis on 18. Aug 2017, 10:09, edited 1 time in total.
Reason: Fixed obfuscated URLs.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Compacting a Windows VM - no effect

Post 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>
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply