Consolidating Hyper-V Differencing Disks into One
I deleted two snapshots from a Hyper-V virtual machine (VM) this morning. This left the base .vhd file and two .avhd differencing disks. I decided I wanted to merge them into a single file and learned that the diskpart tool will let you do this.
- Open an elevated command prompt (i.e. run as administrator).
- Run diskpart.
- Enter: select vdisk file="<full path to the latest differencing disk>"
- A differencing disk ends in either .avhd or .avhdx.
- Enter: merge vdisk depth=n
- n will be the number of parent files you want to merge. Since I had two parents, one .vhd and one .avhd for this .avhd file, I used depth=2.