What is the proper way to cleanup excess .avhdx files created by Hyper-V?

Pietr Langevoort 1 Reputation point
2021-04-28T19:13:16.357+00:00

I am working with a Hyper-V server hosting two VMs. The production VM is backed up by a scheduled job in Veeam Backup & Replication program.

I started receiving warnings from Veeam about low disk space. I am attempting to resolve the warning by freeing up some disk space.
It appears most of the disk space is being taken up by .avhdx files approximately 1GB in size, 6 per month, going back almost one year.

Hyper-V manager does not show any open snapshots. I believe the only open snapshots are temporary and occur during the backup job.
It seems snapshots are being created during the backup process and offloaded to cloud storage on Backblaze and each time a .avhdx file is left behind.
I also ran Get-VMSnapshot in powershell, still no snapshots shown.

What is the proper course of action to remove or cleanup the excess .avhdx files?

Hyper-V
Hyper-V
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
2,506 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Joel 16 Reputation points
    2021-12-30T13:49:59.34+00:00

    I had same issue, Veeam is somehow related to it.

    The solution was too simple and hassle-free:
    Shut down the problematic virtual server as you normally do: Start > Shut Down.
    Then start the server from the Hyper-V Manager by clicking Start on the server.
    The merge process starts and merges all avhdx drives into one vhdx file.
    The process takes time, depending on the number of avhdx files.

    PS. Restarting virtual server does not start the merge process.

    3 people found this answer helpful.

  2. JiayaoZhu 3,911 Reputation points
    2021-04-29T05:35:10.107+00:00

    Hi,

    Thank you for your posting!

    Firstly, I suppose your issue is related to backup. This happens pretty often and it is due to VM backups being ran and "something" happened along the way that caused the automated merge to not take place. If you use Altaro or Veeam, you can recreate the issue by taking a backup, watch the differencing disk get created and towards the end of the backup, cancel it and reboot the host server. The avhd(x) doesn't get removed, but the server starts to run off of it from then on. This is typical when a host update occurs, the backup is running and somewhere it gets restarted due to the updates and the backups were not completed yet. The only way I can find now is to manually merge your excess avhd. files:

    https://social.technet.microsoft.com/wiki/contents/articles/6257.manually-merge-avhd-to-vhd-in-hyper-v.aspx

    https://www.altaro.com/hyper-v/how-to-merge-hyper-v-checkpoints//

    (Please note: Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.)

    Thank you for your support! Wish you have a wonderful day! : )

    BR,
    Joan

    --------------------------------------------------------------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. James Renz 1 Reputation point
    2022-02-04T23:39:22.53+00:00

    I am in the middle of this issue now, I have shut down the VM, and waited, haven't seen any merge process take place. Then I booted it backup, I still don't see any merge take place. Tons of avhdx files still around everywhere in that VM VHD directory, meanwhile the Hyper V Manager shows zero checkpoints. When I check the settings of the VM in question, there are no avhdx files that are pointed to in the settings, just the original VHDX for that VM. Is it safe to move the AVHDX file to another partition?


  4. JSlee 0 Reputation points
    2023-03-23T05:47:54.2433333+00:00

    Not sure if this helps.

    I have similar 2 copies of .avhdx file in one of my virtual machine in hyper-v as I have 2 checkpoint done for this vm.

    What I did was delete the checkpoint (if you really don't need it) from Checkpoints section.

    After deleted, you shall see the status column of that virtual machine is showing with merge in progress. upon completion the files in .avhdx should be gone as it's merged to the main file.

    Another test done was to click again "Checkpoints" function to create checkpoint. Upon this action, System creates a new file with .avhdx so I think above information is valid.

    0 comments No comments