Last week a disk with my virtual server began runing out of space. I found out that there is a snapshot of the virtual machine and that I de facto don’t need it – so I deleted it. When the virtual machine was started again, Hyper-V began to automatically merge versions before and after the snapshot (VHD and AVHD files). So far so good.
But Hyper-V seems to leave AVHD without changes and copies data to VHD, therefore this operation needs a lot of disk space – and I was short of it even before.
I was unable to cancel the automatic merge and as I’ve googled, it’s not supported at all.
I chose Edit Disk in Hyper-V Manager, selected the AVHD file, Action Merge, To a new virtual disk, thereby merging virtual disks to a new file located on another drive.
Then I deleted both the original VHD and AVHD and replaced them by the merged file.
The last step was to change the disk in virtual machine settings. Hyper-V didn’t want to allow that due to the merging in progress. What helped was to completely remove the old virtual disk and add a new one.