none
Merge .vhd and .avhd files

    Question

  • Is there anyway to merge a disk's .vhd and it's .avhd metadata?
    It's hard to make a differencing disk when the VM i'm making the base from never seem to update it's (empty) .vhd file.

    Friday, January 18, 2008 10:17 PM

Answers

  • On the Vm machine under settings \ Management \ Intergration Services there is a addon called Backup (Volume snapshots). This addon causes the .avhd's to be created.

    After making a vm without this addon it does't create .avhd files without me manually creating snapshots Smile

    Saturday, January 19, 2008 11:50 AM
  • No.  VSS is not identical to the snapshots you create in the UI, and does not use .AVHD files.

     

    Cheers,

    Ben

    Monday, January 21, 2008 7:26 PM
    Owner

All replies

  • You have to delete the snapshots which will merge the changes back to the parent vhd.  This is a background operation and requires the VM to be off.

     

    -taylor

     

    Saturday, January 19, 2008 12:07 AM
  • I'm not talking about a snapshot that i took, i'm talking about the snapshot that the it makes by default.
    You still mean i can just remove it? It's not listed in the manager anywhere, so i have to remove it in explorer then.

    Edit: I just removed the snapshot and ruined the vm Stick out tongue
    That is not the way to do it..

    PS: Anyway to get hyper-v to not make that metadata snapshot when you have a fixed disk? It's not alot of performance from having a fixed size .vhd disk when it never stores to it in real time Sad


    This is my VM:
    It has OS.vhd (20 GB fixed disk) that has't been updated yet even 10 hours after the install.
    And it has the snapshot .avhd file that i'm talking about that now is around 6 GB in size.
    I guess this is something needed for being able to make quick snapshots, but it kills the performance the fixed .vhd disk was meant to have over a dynamic one and it also makes little sense to have a empty 20 GB fixed .vhd that is "never" used.

    I want disk-performance on my vm's, 4 MB/s write is not very good disk performance Sad

    Saturday, January 19, 2008 7:32 AM
  • On the Vm machine under settings \ Management \ Intergration Services there is a addon called Backup (Volume snapshots). This addon causes the .avhd's to be created.

    After making a vm without this addon it does't create .avhd files without me manually creating snapshots Smile

    Saturday, January 19, 2008 11:50 AM
  • This is the VSS backup support - it does not use AVHDs.  It is a bit confusing because we have VSS snapshots (for backups) and virtual machines snapshots (which are created through our UI) - but only the latter use AVHDs.

     

    Cheers,

    Ben

    Monday, January 21, 2008 6:19 AM
    Owner
  •  Ben Armstrong [MSFT] wrote:

    This is the VSS backup support - it does not use AVHDs.  It is a bit confusing because we have VSS snapshots (for backups) and virtual machines snapshots (which are created through our UI) - but only the latter use AVHDs.

     

    Cheers,

    Ben

     

    Hm, not sure if i missunderstand you but.

    The VSS snapshot you talk about is still a .avhd file, and it's identical to the snapshots you create in the ui (just that it get much bigger and can't be seen in the ui).
    I've found little info about the VSS backup support other than when disabled you don't get that extra .avhd file and the .vhd is actually written to.

    Monday, January 21, 2008 6:34 AM
  • No.  VSS is not identical to the snapshots you create in the UI, and does not use .AVHD files.

     

    Cheers,

    Ben

    Monday, January 21, 2008 7:26 PM
    Owner
  • Hm, I can't seem to recreate the problem I had, and I see the .vsv files now.

    Not sure what happened when i made the first vm client, but now it's doing exactly what you said it would be doing.

    Monday, January 21, 2008 7:41 PM
  • Help....I just corrupted my guest system SBS 2008. The guest machine Paused-Critical. HyperV reported lack of disk space.
    I had one snapshot in the UI that I subsequently deleted.
    Then the problems started I could not start the guest machine anymore.
    " Merge in progress"  ... very slow. Thought it was due to lack of disk space.

    I have a now a .vhd that is the very basic SBS 2008, but still 17 GB. And a Snapshot folder with a bunch of folders, with .vsv and .avhd files.
    How can I merge them?

    Snapshot folder is total of 65 GB. Not sure why a SBS 2008 guest machine needs over 80 GB.

    I noticed I had all the add-ons in Integration services checked.
    I thought all the guest data is kept in the .vhd file. Not so as I experienced !

    The situation now is that I can still use the .vhd file.
    But all the additions, like SBS users, Exchange mailboxen, web sites are probably in the snapshot files.

    Any help is appreciated. Thanks, -Eric
    Thursday, March 05, 2009 3:50 PM
  • hello eric!

    ive got the same problem:

    timeshedule:
    23.40 server is fine but needs more hd space
    power off server and create snapshot
    expend servers vhd without any problem
    power on server - doesnt boot

    create new machine and add vhd file as boot image
    boots fine BUT about 2 months data are missing.

    now i have a 20 gb vhd file
    snapshot folder contains a few avhd files
    i can merge the last file - its created at the DAY AFTER failure.
    the important file is 9 gb big and from 23.45 - so THIS is my last running system

    now i cant merge that 9 gb into the 20gb - but i need the information in this file (sharepoint server 2007)

    any help very welcome!
    please help!
    thanks
    Saturday, March 07, 2009 7:22 PM
  • This is confusing to say the least.

    I have Server 2008 x64 Std. installed in a virtual machine.

    I had volume shadow for the vhd enabled in the virtual machine, but then I deleted the copies (I thought) in the virtual machine and disabled vss.

    I had taken one snapshot of the virtual machine, but then I deleted it in Hyper-V Manager.

    I also disabled backup (volume snapshot) in integration services.

    So what are these .avhd files in C:\ProgramData\Microsoft\Windows\Hyper-V\Snapshots\{guid} that I cannot delete?
    Sunday, March 08, 2009 12:24 AM
  • I shut down the virtual machine in question.

    Now I notice "Merge in progress (n%)" in Hyper-V Manager.

    Was this triggered by my trying to delete the .avhd files?  Or is it normal and I just never noticed it?

    Are these .avhd files created when I shutdown the Hyper-V server, and it shuts down the virtual machines?
    Sunday, March 08, 2009 12:31 AM
  • There are many things going on here.

    Maybe some background information into snapshots might help.
    (I am referring to Hyper-V snapshots - not VSS snapshots, they are totally different VSS is a backup technology)

    THE absolutely most important concept to understand about snapshots is that a Hyper-V snapshot is NOT a method of backing up a VM.  It is strictly intended to provide a known good point in time to return to for testing updates, upgrades, etc.

    Background regarding snapshots:
    http://itproctology.blogspot.com/2008/03/snapshottingnot-your-checkpointing.html
    http://itproctology.blogspot.com/2008/07/managing-hyper-v-snapshots-basics.html
    http://itproctology.blogspot.com/2008/05/hyper-v-snapshots-more-about-how-they.html


    Manual merge:
    http://itproctology.blogspot.com/2008/06/how-to-manually-merge-hyper-v-snapshots.html

    One of the biggest mistakes that I see folks making is by taking a snapshot prior to expanding a VHD.
    This will always end in a broken VM (the differencing disk chain is damaged.)


    Brian Ehlert (hopefully you have found this useful)
    • Proposed as answer by mbell610 Saturday, November 07, 2009 6:03 PM
    Monday, March 09, 2009 4:14 PM
    Moderator
  • The merge was triggered by the act of shutting down (powering off, stopping) the VM.

    It does not start immediately, it takes a few moments for the system to realize the VM is off and that there is the pending task of merging files together.

    It is easy to miss, and it is normal for it to take a few minutes to start.

    An AVHD file is created when a Hyper-V snapshot is created.  (either when the VM is running or off).
    An AVHD is a special file extension used for Differencing disks that are created by the Hyper-V snapshotting process.



    Brian Ehlert (hopefully you have found this useful)
    Monday, March 09, 2009 4:17 PM
    Moderator
  • EricV: whenever you take a snapshot, any data writtend after that point is written to the .avhd file. Before you delete your snapshots in order to merge them, check to see the structure of your snapshot tree. If it is linear, just delete the snapshots. However, if it is not, choose which branch you want merged to the VHD file and make the tip of that branch the current running state and then go ahead and delete the snapshot. the snapshots with the other branches are deleted, including the avhds. since you have significant amount of data in your avhd files, you will probably have to wait for a while for the snapshots to be complete.


    This posting is provided "AS IS" with no warranties, and confers no rights
    Thursday, March 12, 2009 4:58 PM
  • Soumya: I had a linear snapshot tree, deleted all my snapshots, shutted the maschine down and got the same troubles. for hours. :-/


    lg
    • Proposed as answer by EricV Thursday, April 16, 2009 8:21 AM
    Thursday, April 16, 2009 1:49 AM
  • Thanks to all for your contribution.
    I decided to rebuild my guest system (SBS2008) from scratch (i.e. DVD)
    reasons:
    1. my Hyper-V C-drive that contained the .vhd and snapshot data was full, even if I merge was working it was a dead-end
    2. no merge possible meant I lost the most recent updates to my guest system,both programs and data (mail).

    Lessons learned when you get a message in Hyper-V manager that the guest machine Paused-Critical and you use snapshots.
    1. shut down the machine - this will trigger the merge process -Ok.
    2. if you cannot merge, since your actual workspace (c-disk) is full I think you are still lost.
    3. I decided to have guest machines with fixed disks (SBS 2008 needs min. 61 GB) so the problem is contained in the guest and not in the host
    4. No more snapshots in a (semi) production environment - if I need to restart at a known point, I use the system restore in the guest system.

    Conclusion:
    1. if you need snapshots, just do it for one day and do not forget about it.
    2. Microsoft could help with a utility:
    - do not automatically start merge after guest shutdown
    - allow to move the snapshot folders
    - allow the user to start the snapshot merge.

    thanks -Eric

    Thursday, April 16, 2009 8:23 AM
  • Please note that this is not a supported method...it is kind of a hack, but it works....

    I think it is also worth noting that I am using Hyper-V Manager, and not SCVMM, and I did not have a branched snapshot scenario.  In other words, I never reverted back to a snapshot and then took later snapshots, thus "branching" the differencing files...

    With that said...I don't think you have a lost cause if you are out of disk space...

    The configuration for each VM is an .XML file...If you delete that .XML file, Virtual Machine Manager loses all knowledge of it (Please note a status of "Saved" complicates this more, but not worth going into now since you mentioned that you could shut down the VMs)  Please also note that you will be recreating this VM, so you will need the information regarding number of Processors, and amount of memory, and the like.  I was also told that this could cause you to need to activate the license again, but I did not have this problem.

    In order to delete the .XML file for the VM, the Virtual Machine Manager Service has to be stopped.  Before doing that, all VMs should be shut down gracefully if possible. 

    Here are the steps:
    1. Shut down all VMs gracefully
    2. Stop the service using services.msc, or stop the service using the Server Manager
    3. Let any merge jobs complete that can
    4. Delete (or rename for those of you carefull folks) the .xml file for the VM in question
    5. Restart the Virtual Machine Management services...Your guest will not be listed.
    6. Find the GUID for the VM in question...and delete the .xml configuration file.
    7. Find all of the .avhd files for the machine
    8. Move as many .avhd files as you need off to another drive to free up some room, but leave the last 2(very important to start with the last .avhd files and work your way backwards)
    9. Change the extension on the LAST .avhd file to .vhd
    10. In Hyper-V manager, chose edit disk
    11. Browse for the renamed file
    12. Chose to Merge the file (It will automatically look for the parent of the .avhd file...this information is included in the child file itself)...the merge will merge all information from the Child into the Parent, and THEN delete the child (this is where your space problem came in, btw)
    13. Move the parent of that file (the next oldest .avhd file) back to its ORIGINAL location (very important to put it back where it was)
    14. Repeat as needed

    Always rename the newest Child to have a .vhd extention, because the "Edit Disk" wizard only sees .vhd files, and alway merge into the Parent, and not to a new file.

    This way, you have the room you need to merge the files, and eventually, you will arrive at the original .vhd file, and have only one virtual hard drive.

    After all of this, just re-create the Virtual Machine, and use the combined .vhd file in the Wizard...
    Wednesday, October 14, 2009 10:31 PM
  • Deleting the snapshot merges the .avhd files with the .vhd files. This will get you a sing .vhd file when you export it.
    • Proposed as answer by Pablo_73uhfrq9 Tuesday, January 28, 2014 2:04 AM
    Tuesday, May 24, 2011 5:38 AM
  • To me what worked was this (I had two drives, one vhd and one avhd for each drive. No snapshots showing in the history)

    1) stop the VM

    2) create a snapshot (you will see another avhd file)

    3) delete the snapshot (the merge process will trigger)

    4) Merge completed and only the vhd were left

    • Proposed as answer by Pablo_73uhfrq9 Tuesday, January 28, 2014 2:04 AM
    Tuesday, January 28, 2014 2:04 AM