Setting up storage reclamation for virtual disks in Hyper-V is a pretty straightforward process, and it can really make managing storage more efficient. If you’re using Hyper-V, it’s likely you’re already familiar with virtual disks, but the storage reclamation feature is something that might not be on your radar yet. It’s all about optimizing your storage space by reclaiming unused space in your virtual hard disks, which is especially useful when you have dynamic disks.
First, you'll want to ensure you’re running on the right version of Windows Server. The feature is called Compacting virtual disks and supported in Windows Server 2016 and later, so if you’re using an older version, you won’t see this option. Once you've confirmed that, you’ll also need to ensure that you’re using a storage solution that supports this feature, typically Spaces or any kind of advanced storage solution that allows for the reclamation.
Now, the actual setup starts in the Hyper-V Manager. You can navigate through the settings of your virtual machine where the VHDX (that’s the virtual hard disk file) resides. Firsts, delete all checkpoints the VM might have. Then go into the Hyper-V Manager settings for the VM and navigate to the VHD settings. There you will see an Edit button. Click the edit button and in the new screen that will open, select the Compact function.
After you've run compaction, it’s a good practice to keep an eye on the disk usage. Hyper-V includes handy management tools that will let you check how much space is being reclaimed and whether the virtual disks are functioning as intended. By regularly checking in on this, you’ll ensure that the feature is working smoothly and that you’re making the most of your storage solutions.
Please also note that you might have to shrink the partition inside the VM to regain most of the empty storage back on the host. It also helps running a defrag with /x option to move all allocated blocks to the beginning of the virtual disk.
I hope my post was useful. Are you new to Hyper-V and do you have a good Hyper-V backup solution? See my other post
First, you'll want to ensure you’re running on the right version of Windows Server. The feature is called Compacting virtual disks and supported in Windows Server 2016 and later, so if you’re using an older version, you won’t see this option. Once you've confirmed that, you’ll also need to ensure that you’re using a storage solution that supports this feature, typically Spaces or any kind of advanced storage solution that allows for the reclamation.
Now, the actual setup starts in the Hyper-V Manager. You can navigate through the settings of your virtual machine where the VHDX (that’s the virtual hard disk file) resides. Firsts, delete all checkpoints the VM might have. Then go into the Hyper-V Manager settings for the VM and navigate to the VHD settings. There you will see an Edit button. Click the edit button and in the new screen that will open, select the Compact function.
After you've run compaction, it’s a good practice to keep an eye on the disk usage. Hyper-V includes handy management tools that will let you check how much space is being reclaimed and whether the virtual disks are functioning as intended. By regularly checking in on this, you’ll ensure that the feature is working smoothly and that you’re making the most of your storage solutions.
Please also note that you might have to shrink the partition inside the VM to regain most of the empty storage back on the host. It also helps running a defrag with /x option to move all allocated blocks to the beginning of the virtual disk.
I hope my post was useful. Are you new to Hyper-V and do you have a good Hyper-V backup solution? See my other post