Hyper V Disk allocation: Why Veeam reports full size after Shrinking

Shrinking works on both raw partitions which lack a file system, and on partitions formatted with the NTFS. This allows you to reclaim unused disk space efficiently while keeping your existing data intact. This guide is not on shrinking your virtual hard disk despite discussing the process. In this guide, we shall discuss “Hyper V Disk allocation: Why Veeam reports full size after Shrinking”. Please, see how to convert a VHDX file to a VHD, and steps o fix video Remoting was disconnected on Hyper V.
I saw this question on a Forum and had to reproduce it and blog on it. Note that if a raw partition contains data, such as a database file, shrinking the partition might destroy the data. So, be careful while also testing this.
Table of contents
In newer versions of Hyper-V (Windows 10/11, Server 2019–2025). The “Shrink” option was removed from the Edit Virtual Hard Disk Wizard from Hyper-V.
Please, see how to shrink and create new partition on Windows Server, and how to create a Recovery Partition in Microsoft Windows 10/11, and
Zero out free space inside the VM
You can run SDelete prior to or after shrinking a volume. To maximize compaction and minimize VHDX size, run sdelete -z before shrinking. Running it after shrinking doesn’t hurt, but it’s mostly redundant for the unallocated portion outside the partition. SDelete effectively zeroes out previously used storage blocks, ensuring that free space can be reclaimed efficiently.
Note: Running SDelete isn’t mandatory, many users have reported significantly better results when using it to zero out empty blocks before shrinking the volume. I can also attest to this after running sDelete in my VM. This process helps the hypervisor recognize unused space, maximizing the reduction in virtual disk size
SDelete (Secure Delete) is useful if your VHDX file size is not shrinking even after compacting. This happens because Hyper-V does not automatically mark unused space as “zeroed” after you delete files inside the VM. You can download SDelete from Sysinternals Microsoft’s Official Webpage.

Upon download, please extract

I am fine with the defaults and will click “Extract”.

Files extracted. You can run PowerShell or Command Prompt from the Explorer by typing CMD or PowerShell.

Alternatively, you can run PowerShell as an “Administrator”.

As mentioned above, I want to run the Command Prompt directly from the File Explore.

To zero out free space on a drive, run SDelete with the -z switch followed by the drive letter C in my case as shown below.

As you can see below, free space has been reclaimed.

Please, see Demystifying Zero Trust with Veeam: Design your Architecture, “OOTBI Security Best Practices: Enable Honeypot on Object First“, and “What are the differences between Lite-Touch and Zero-Touch“.
Shrinking Volume in Windows
We have discussed this topic extensively in other articles. This blog will guide you through the steps and explain why size discrepancies can occur in Veeam Backup and Replication during backup, even after shrinking a Hyper-V VM.
To perform this task, you can launch Computer Management, Disk Management, or start the Create and Manage Hard Disk Wizard. All paths ultimately bring you to the same disk management interface where you can manage partitions and virtual disks

Right click on the drive and select “Shrink Volume”.

The volume is being queried for available space as shown below.

Please, see how to install Pleasant Password Server, how to Restore VM to Original location using Veeam Entire VM restore, and how to fix Authentication failed: Invalid credential after installing VSA
Size to Shrink
On the strink wizard, the total size of volume (C:) = 99.05 GB, and the available size to shrink = 49718 MB (≈ 48.6 GB).

Since I want to reduce the total volume to 70 GB. We have to enter the following value of 29773 MB and click on shrink.

The topic of the unallocated space has been dealt with above in the referenced guide. Please, see How to Shrink and Compact Virtual Hard Disks in Hyper-V.

Resize-VHD cmdlet
The Resize-VHD cmdlet changes the maximum physical size of a virtual hard disk. It can expand both VHD and VHDX files but can shrink only VHDX files. The shrink operation fails if it would shrink the virtual disk to less than its minimum size (available through the VHDX object’s MinimumSize property).
There’s no way to shrink the VHDX beyond the last used block. “Compact” alone cannot remove unallocated space at the end. You must either move the partition or create a new smaller VHDX.

Optimizing VHDX virtual disk files helps reclaim space in dynamically expanding virtual hard disks. The Optimize-VHD cmdlet performs this task using the Compact operation, which removes unused blocks and reorganizes data for better efficiency, ultimately reducing the overall VHDX file size.
Please, see how to Compact Virtual Hard Disks on VMware, how to fix “Unknown Error occurred when installing Veeam Software Appliance“, and Offline and Online Update for Object First Out-of-the-Box Cluster.
Hyper-V Compact
SDelete zeros out the free space inside the VM, while Hyper-V Compact removes those zeroed blocks from the VHDX on the host, effectively reducing the physical file size.
Launch the Hyper-V Manager, right-click on the VM and select Settings or from the Action pane, select settings

Next, ensure the right VHDX file of the VM is selected. Click on the Edit Disk as shown below. This will launch the Edit Virtual Hard Disk Wizard.

On the locate Virtual Hard Disk page, click on Next.

Select Compact and click Next.

Click on Finish when complete

And finally, click on OK.

Please, see how to add Synology NFS Storage to Proxmox VE for VMs and Backups, and how to setup Veeam Software Appliance v13.
Veeam reports full VM Size after Shrinking
After shrinking the C: partition inside the VM. The unallocated space still exists inside the VHDX. Hyper-V sees the VHDX as its original logical size. Compacting removes zeroed blocks inside partitions. But any unallocated space beyond the last used block remains logical and is not physically stored.
The unallocated space does not consume any additional physical disk space on your host. This is a common scenario when shrinking partitions in Hyper-V. The virtual disk file (.vhdx) is compacted to reflect the actual used space. But any unallocated space within the virtual disk remains logically unassigned.
In conclusion, even after shrinking the C: partition inside the VM from 100 GB to 70 GB. Veeam still sees the full 100 GB because it reads the logical disk size from the VHDX metadata. While the host sees only 70 GB physically used after compact.
The unallocated space inside the VM is effectively released to the host but still counts toward the VM’s maximum size in backups. If after resizing and you are having issues with the backup job etc. Please see kb2450.

Please see How to Create a Windows Server VM on Hyper-V, how to install HyperV and Configure vSwitch on Windows Server with PowerShell, and how to Fix PXE Boot Stuck or No Boot Image was found for HyperV VM.
Inspect VHDX
Even after shrinking your partition inside the VM to 70 GB and compacting the disk. When you inspect the virtual hard disk in Hyper-V Manager, it still reports 100 GB

As you can see below, while the Hyper-V host shows only approximately over 50 GB physically used after compaction. This means that the virtual disk can still expand up to its original 100 GB limit even though only 70 GB is allocated inside the VM and just 50 GB is stored on the host.

FAQs
sdelete? Run sdelete -z before shrinking the partition. It zeroes out free space inside the VM so that compaction fully reclaims unused blocks. Running it after shrinking is mostly redundant
“Shrink”: Reduces the logical maximum size of the VHDX, while “Compact”: Reclaims unused physical storage blocks on the host, reducing the VHDX file size. Both steps are often needed to minimize disk usage.
No , the resize-VHD cannot shrink a VHDX below the disk’s MinimumSize, which includes all used blocks and metadata. Shrinking beyond this limit will fail to prevent data loss.
This error occurs when the target size is smaller than the last used block or metadata in the VHDX. PowerShell prevents shrinking below the MinimumSize to avoid data loss.
Even after shrinking the partition, hidden system files or alignment metadata may extend beyond the requested size. Resize-VHD refuses to shrink below the MinimumSize reported by Get-VHD.
I hope you found this blogpost very useful on “Hyper V Disk allocation: Why Veeam reports full size after Shrinking”. Please, feel free to leave a comment.