Link to home
Start Free TrialLog in
Avatar of ibtaya
ibtaya

asked on

Hyper V avhd files not going away after snapshot removal

I have a cluster of servers running on Server 2008 SP1 Hyper V.  My problem is that I'm running out of space.  As I looked for large files I'm noticing that each server has a directory inside the VHD directory called Snapshots.  Inside that directory are LARGE avhd files with todays date on them.  

Can someone tell me if these files are needed?  I tried to rename one but it told me it was in use.

Another note, each vm has different scenerios as far as snapshots, even the vm's without snapshots has this large file.  The file seems consistantly about 90% the size of the VHD.
Avatar of Shreedhar Ette
Shreedhar Ette
Flag of India image


In a nutshell, when you take a snapshot of a Virtual Machine, a differencing disk is created - the AVHD file - and data changes while the machine is running under that snapshot are written to the AVHD file rather than the parent VHD file. This allows the state of the virtual machine to be restored to a previous snapshot by simply pointing the machine to a different differencing disk.

You won't be able to delete the AVHD files while the Virtual Machine is running, as data is actively being read and written to the file. Furthermore, you should NOT delete the files if the VM is offline. Doing so will cause data loss.

The proper way to rid yourself of these files is to delete the associated snapshots from the VM in the Hyper-V console, then shut the VM down. After a short wait in the offline state, the Hyper-V Manager will show "Merge in Progress", at which point the AVHD data is being written back into the parent VHD file. Given enough time, this process should complete and the AVHD file automatically removed.

There's a more detailed explanation on Taylor Brown's Blog (one of the Hyper-V team at Microsoft): http://blogs.msdn.com/taylorb/archive/2009/03/10/hyper-v-background-merging-of-avhd-s-when-s-it-done.aspx.

-Matt
Avatar of ibtaya
ibtaya

ASKER

Thanks for shining the light on this for me.  I live in the VMWare world where this isn't the exact process.  Tell me this.  If I delete the snapshots, shut down the VM and the merge process corrupts the VHD, am I left with a bad VHD and no restore points?

The AVHD files are differencing disks which work in conjunction with the parent VHD file. At the point the snapshot of the VM was created, the parent VHD essentially became read-only and all the changes or additions to disk made by the VM were actually being written to the AVHD file. This allows snapshots to do their job by giving the flexibility to dump all those changes and return the VM to its original state at the top of the snapshot tree (or to earlier snapshots somewhere in between).

So, in answer to your question, if the parent VHD file becomes corrupt, everything goes down the pan, because the AVHD has no parent VHD it can be linked with. I would have a good backup of the VM(s) before you remove the snapshots and allow them to start the merge.

That said, I've never had a merge fail on me... but you can never account for the possibility of physical server failure, power outage or such incidents beyond your control.

-Matt
Avatar of ibtaya

ASKER

Do you have a good article to back up the entire VM, both the VHD and AVHD?  Is it just a matter of shutting down the VM's and backing up the folders?
ASKER CERTIFIED SOLUTION
Avatar of tigermatt
tigermatt
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ibtaya

ASKER

I'll close this ticket out once I'm successful, thanks for your help!!!!  I'll do this tonight.  To bad it's not VMware, it could be done on the fly, wonder why M$ hasn't picked up on that yet.