Page 1 of 1

Guest Disk Space to Host File Space Mismatch

Posted: 10. Aug 2021, 21:01
by MattC13
Hi, I'm finding this difficult to understand. The disk space in the VM (Win10) is showing around 20GB used. The vdi file in the host is showing 14GB. I could understand it if it was the other way round as the vdi does not contract, even if the guest disk usage is reduced. But I don't understand the vdi being smaller than the guest's. Does Vb use compression with its vdi? If not, can anyone explain this?

Matt

Re: Guest Disk Space to Host File Space Mismatch

Posted: 10. Aug 2021, 23:12
by scottgus1
I don't think Virtualbox uses compression in VDI, but Windows compresses some things in its installation.

Please use Upload Attachment to show a screenshot inside the VM of the disk's Properties tab. Also, please run these commands in the host's Command Prompt or Terminal Window:

(this one if it's a Windows host:)
CD C:\Program Files\Oracle\Virtualbox

vboxmanage showmediuminfo "path\to\\drive\file.vdi"

Re: Guest Disk Space to Host File Space Mismatch

Posted: 11. Aug 2021, 01:47
by fth0
MattC13 wrote:If not, can anyone explain this?
Windows cannot count! ;)

Seriously, Windows 10 uses hardlinks for many of its own installed files (e.g. *.exe, *.dll). Open a command prompt and enter the following command:

Code: Select all

fsutil hardlink list c:\windows\notepad.exe
The output will probably look like:

Code: Select all

\Windows\System32\notepad.exe
\Windows\notepad.exe
\Windows\WinSxS\amd64_microsoft-windows-notepad_31bf3856ad364e35_10.0.19041.1081_none_e3f87355251e8c43\notepad.exe
If you use the Properties dialog of Explorer on any of those files, it will tell you that their size on disk is approximately 200 kB. If you use the Properties dialog of Explorer on the c:\windows folder, all three of them account for approximately 600 kB. But this simply isn't true. ;)

In addition to that, Windows 10 uses file compression (e.g. in C:\Program Files\WindowsApps) and sparse files, and VirtualBox will not allocate VDI blocks for 1 MB blocks containing only zeroed bytes.