Hyper-V – Merge multiple AVHDX files (checkpoint / snapshot)

Posted: 08/23/2017 in Hyper-V, virtualization, Windows
Tags: , , , , , , ,

Problem:

Recently I noticed running out of space on one of Hyper-V host. There was only ~10% free space. Couple of VM was placed out of clustered storage, on local RAID.

But what was strange, this VM has ~100 AVHDX files and 1 main VHDX file, but there was no checkpoints!

Automerge should start automatically, but it doesn’t. So let’s try on my own.

 there are about 100 AVHDX files!

 

but there is no any checkpoint in Hyper-V MMC

 

Resolution:

  1. Automerge : should start automatically. Delete checkpoints, then poweroff VM.
    In my situation, there was not any checkpoint, so automerge didn’t start.
  2. Merge files manually through Hyper-V : Hyper-V MMC -> edit disk -> locate latest AVHDX file (by date modification). Repeat procedure until you achieve one VHDX file.
    In my situation (~100 AVHDX files) it would take too long :) 
  3. Merge files manually – without Hyper-V :
    a) download VHDUtils from here
    b) extract makevhd.exe file to VM AVHDX files localization
    c) on cmd or PS run command:
    makevhd -d   merged-disk.vhd   0   latest-modified-avhdx-file.avhd
    d) wait, there will be no progress bar
    e) when merging has completed – attach VHDX to VM.
    You may have “Cannot change disk since a disk merging is pending” warning – just remove HDD from VM, apply VM settings, and then re-add newly merged VDHX file to VM.

That’s it.

Advertisements
Comments
  1. Josh Jonason says:

    I feel like I’m missing something, here. I also have very low space on my host, and am having the exact same issue that you listed here. If I need to make a NEW vhd file, I do not have the space, correct? I can’t use the existing file name of the vhd “The file exists” is the read out. What am I doing wrong?

    • itsapassion says:

      I haven’t been run out of space totally, I had 10% free space on volume. This free space allowed me to merge checkpoints one by one.
      If you dont have any free space, the only way is to free up some space or copy vhd’s to another volume.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s