Shrink Win 10 VHD hard drive

We have several Windows 10 Hyper-V virtual machines running on a Server 2016 server. These virtual machines have all been created with a 127 GB hard drive.

We have downloaded quite a bit of data onto these virtual machines which have almost completely filled up these virtual hard drives.

Now this data has been moved to other locations or deleted and these Windows 10 virtual machines now have over 100 GB of free space. However, the sizes of these Generation 2 Windows 10 virtual machine hard drives are still quite large.

Is there any way of compacting these Generation 2 Windows 10 virtual machine hard drives so that their size will only reflect the amount of space that is actually currently being used and so that these virtual hard drive sizes won't expand again until there is more data put on these Windows 10 virtual machines? How can this be done?
IT GuyNetwork EngineerAsked:
Who is Participating?
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.

Steve McCarthy, MCSE, MCSA, MCP x8, Network+, i-Net+, A+, CIWA, CCNA, FDLE FCIC, HIPAA Security OfficerIT Consultant, Network Engineer, Windows Network Administrator, VMware AdministratorCommented:
If you are using thin provisioning, it is already done.  If you use thick provisioning, that needs to be changed.
0
IT GuyNetwork EngineerAuthor Commented:
What are the steps to find out if I am using Thick or Thin provisioning?
0
Alex AppletonBusiness Technology AnalystCommented:
Here's a link that explains how to do this:

https://redmondmag.com/articles/2017/02/08/storage-space-in-hyper-v-vms.aspx

You'll find that you won't be able to reclaim all the white-space on the VHDx file.  Also run a defrag on the volume before attempting to shrink it.
0

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
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
Virtualization

From novice to tech pro — start learning today.