I just started playing with Hyper V images for the Team System team and noticed the directory of our primary image contains 48 gigabytes of AVHD files! Looking it up on Technet it turns out AVHD files are Snapshots….Fair Enough how do i merge our ONE snapshot in Hyper-V? According to the documentation you do this by editing the virtual hard drive…Unfortunately the UI in my Hyper –V it doesn’t give me that option. In doing more some more reading and by talking to Michael Kleef you can force the merge by deleting the snapshot(s) in the Hyper –V.
Not certain who thought of that as a good UI but it worked kinda –at least the UI indicating it was merging the snapshot.
-But it didn’t seem to do much for the files sitting on the disk.
The reason i started looking at these files was to copy the image to another computer.
So in the mean time i decided to export all 48gb of the AVHDs and the 7gb VHD to an export directory….I import this into a new (STOPPED) image; as i am sitting there wondering about the ramifications for starting the exact same server on our corpnet i notice the Hyper-V status of my stopped image changes to “Waiting to merge disk…” That’s interesting, what does that mean? As i watch my “Snapshots” folder i notice one of these AVHD files disappear and a couple of minutes later another goes PSFFT –gone!
Turns out the Virtual image had several snapshots created against but never had any down time to magically merge them back to the base VHD.
Edit Virtual Hard Disk Wizard
You can use the Edit Virtual Hard Disk Wizard to perform various actions that modify virtual hard disks. The available actions differ depending on the type of disk you select. The following table provides information for each action.
Applies to dynamically expanding virtual hard disks and differencing virtual hard disks. Reduces the size of the .vhd file by removing blank space that is left behind when data is deleted from the virtual hard disk. If the virtual hard disk is not NTFS formatted, the blank space must be overwritten with zeroes so that the compact action can reduce the file size by removing sectors that contain only zeroes.
If the virtual hard disk is not NTFS formatted, you must prepare the virtual hard disk for compacting by using a non-Microsoft disk utility program to replace the blank space with zeroes.
Converts a dynamically expanding virtual hard disk to a fixed virtual hard disk, or vice versa.
Increases the storage capacity of a dynamically expanding virtual hard disk or a fixed virtual hard disk.
Applies to differencing disks only. Allows you to combine the changes stored in a differencing disk with the contents of the parent disk. You can either copy the contents of the parent disk and differencing disk into a new virtual hard disk, which leaves both source disks intact, or you can apply the changes to the parent disk.
Applies to differencing disks only. If you select a differencing disk and the parent virtual hard disk cannot be located, this page appears automatically. If the disks are part of a chain of differencing disks, this page will appear if the wizard cannot locate any of the disks in the chain.