Mysterious hyper-v VHDX size.

Question regarding Hyper-v VHDX size management

One of VM's VHDX shows incorrect size.
Host: windows 2012
VM: Windows 2012, SQL 2012, 4CPU, 4GB RAM fixed, dynamic VHDX

When I check the VHDX size of this VM, it shows 80GB. But, when I log into the VM check the size in Windows Explorer, it shows about 45GB in use (80GB free out of 126GB).

I don't have any extra unused partition.
 I thought SQL database file held some free space, but when I checked it grows dynamically and have only 2 databases, so the reserved space was not meaningful much, 2GB.
Where else would I look at?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

When you create a new VM in Hyper-V and use the defaults, it creates a virtual Disk that to the VM looks like 127GB. As it is dynamic, the actual File's size is less, and it will only reach the full 127GB when it is fully used. You can change size from the default max size to something else, butthat will only apply to a new virtual disk. Once it is created it stays at 127GB.
Cliff GaliherCommented:
This isn't uncommon. Dynamic virtual disks grow as needed, but do NOT shrink. Let's say you run windows update and there are 30 GB of patches. During the download process, that VHDX will grow by 30GB to temporarily hold those patches. Then, as each patch installed, it is *replacing* files in the windows directory, so it doesn't actually take up more space. The downloaded installer installs and is deleted. Poof, free space! But your VHDX is still bigger because of that process.

That is just one (but by no means not the only) example of bow a dynamic VHD can be bigger than the used space reported in the OS. This is perfectly normal. It is not being reported "wrong," The file is now that size.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
crcsupportAuthor Commented:
"Starting in Windows Server® 2012 R2, Hyper-V delivers the ability to expand or shrink the size of a virtual hard disk while the virtual machine is still running. For more information about resizing virtual hard disks, see Configure Online Virtual Hard Disk Resize."

So, Is this also true with 2012 if it's updated?
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

crcsupportAuthor Commented:
I think it's 'Compact' , not 'Shrink' that I'm looking for.
I tried to compact online VHDX, couldn't. I wonder if 2012R2  allows it online like Shrink.
Cliff GaliherCommented:
You cannot "update" from 2012 to 2012 R2. They are different versions and there is no free path from one to the other.

No, 2012 does not have this ability. It requires 2012 R2.

And just to be clear about that feature, 2012 R2 does *not* shrink dynamic VHDX disks automatically. It provides a GUI so an admin can if a significant amount of data was removed without first bringing down the VM, hence the "online" part of the feature. Online does not mean automatic.
crcsupportAuthor Commented:
Thanks. Well, I have to shut down then, weekend job... I hate it.
Why do you want to shrink it? currently it seems to just use 80GB, and hasn't reached the 127GB yet.
crcsupportAuthor Commented:
No, what I was looking for is Compact, not Shrink, my mistake.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.