HyperV Virtual Disk Size Reduction with CloneZilla
There are so many articles that discuss reducing the size of a Hyper-V .VHD or .VHDX Virtual Disk file. Some work, but mostly the proposed solutions just seem to find a way not to work.
This article is about reducing the size of a CentOS 7 OS in a Microsoft Hyper-V Host.
Preparation
Make a backup copy of the Virtual Disk!
If not done already, clean up all of the files within the Operating System of the Virtual Disk OR mount the disk with a utility and delete any unwanted folders / directories and files.
Download an ISO image of CloneZilla (not FileZilla, that's related to FTP) appropriate for your hardware: https://clonezilla.org/downloads.php
Make a Disk Image
Boot from the CloneZilla ISO image.
Most of the defaults are fine, and to clone to an Image, select Disk-Image. Cloning from Disk to Disk has been found to not be 100% reliable in reducing the size of a Virtual Disk. Doing the "double step" of Disk to Image and then Image to Disk works every time.
After imaging, shut down the VM and attach a new Virtual Disk (Dynamically Expanding of course). Make sure it is the same size as the original, otherwise Clonezilla will need to change partition size. For example: 2048 GB
Boot up and use the Image file to create a new Virtual Disk.
AND, there's no need to "shrink" the VHD or VHDX as it is already shrunk