Hi
Thank you for posting your query.
Kindly the details provided below to answer your query.
- NTFS puts a secondary copy of the MFT at the exact center of a partition. This means you won't be able to compact more than 50%. All compaction does is truncates any zero filled disk clusters it can find starting at the end of the disk.
- This is plausibly because Hyper-V will only compress the first partition, which is that "System Reserved" one. You just need to shut-down the VM, mount the .VHD(X) file as drives, then compact them individually.
Turn off the VM
run "DiskPart"
C#
DISKPART> select vdisk file="J:\Virtual Hard Drives\<filename>.vhdx"
DiskPart successfully selected the virtual disk file.
DISKPART> attach vdisk readonly
100 percent completed
DiskPart successfully attached the virtual disk file.
DISKPART> compact vdisk
100 percent completed
DiskPart successfully compacted the virtual disk file.
DISKPART> detach vdisk
DiskPart successfully detached the virtual disk file.
Oddly enough, you then go into the Hyper-V manager and use THAT compress feature, and it seems to work properly.
Go to this link for your reference https://community.spiceworks.com/topic/2077033-compacting-vhd-not-working-in-hyper-v
Note: This is a non-Microsoft website kindly take precautions before downloading anything.
If the answer is helpful kindly click "Accept as Answer" and upvote it. Thanks.