VHDX file

I have a dynamically expanding virtual server. The VHDX file is 400gb but the actual space used on the machine is only 100gb.. i had cleaned up the server and removed 100's of gb worth of data. My question is how do i now get my VHDX file back down to a smaller size?

Srv 2016
Hyper V
Jack 50Asked:
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.

Cliff GaliherCommented:
There isn't a good way to do this. The way NTFS writes data means that there is almost always blocks of data at the end of the file.

There are third party Defrag tools that can move all data to the from of the "disk" and then you can use hyper-v disk tools to shrink the file.  But it has historically been high risk. I would never recommend this path. Leave the white space and let the virtual OS rewrite to it as needed.
Tom CieslikIT EngineerCommented:
You can convert file from dynamic to Fixed size

All you have to do is shot down VM
Go to Properties, select disk
Click Edit
Select Choose Action
Select Convert
Choose Disk Type and select Fixed Size

If you think that 200GB or less  is enough, click Next and put new information.
Hyper-V manager will convert disk for you


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
Check this document:

First, you should check if the shrinking is available for your volume.
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.

Philip ElderTechnical Architect - HA/Compute/StorageCommented:
If there is enough free space on the host then create a new Dynamic VHDX file, attach it to the VM, _move_ everything over to the new VHDX file, remove the old VHDX, and change the new VHDX partition's drive letter to the old one. The shares and permissions should all be the same.

Make sure to back things up before, during, and one time just prior to removing the old VHDX. Once complete, delete the old VHDX. Done.
Muhammad BurhanManager I.T.Commented:
Login to your virtual machine and open Computer Management then go to Disk Management and shrink to the possible size then shutdown that VM and open HyperV manager go to edit disk and choose compact
Jack 50Author Commented:
Couldn't shrink, wouldn't let me
Determining if a VHDX is Eligible for Shrinking
Did you check this?
Jack, that's all you have for us, one sentence?
What steps did you follow? If Muhammad Burhan's were followed but did not work (which would surprise me), there's still the possibility to make an image copy of the drive and restore it to a new dynamically expanding VHDX. Only used sectors will be restored, so the result will be a small drive, if the imaging program allows that. You could take the trial of drive snapshot: http://www.drivesnapshot.de/en/down.htm - it allows restoring to a smaller disk.
PberSolutions ArchitectCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

-- Tom Cieslik (https:#a42417126)
-- 8046586 (https:#a42417127)
-- Muhammad Burhan (https:#a42417318)
-- McKnife (https:#a42418535)
-- Cliff Galiher (https:#a42417123)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Cleanup Volunteer
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
Windows Server 2016

From novice to tech pro — start learning today.