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.
LVL 2
ibtayaAsked:
Who is Participating?
 
tigermattConnect With a Mentor Commented:

I would shut it down and Export the Virtual Machine: http://www.petri.co.il/importing-and-exporting-your-virtual-machines.htm. Keep a copy of the exported data safe, because you can blow the machine away and re-import it if something goes drastically wrong.

Your other option would be to take a backup from within the VM itself, using standard backup tools - NTBackup for Server 2000/2003 and Windows Server Backup for 2008/2008 R2.

-Matt
0
 
Shreedhar EtteCommented:
0
 
tigermattCommented:

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
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
ibtayaAuthor Commented:
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?
0
 
tigermattCommented:

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
0
 
ibtayaAuthor Commented:
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?
0
 
ibtayaAuthor Commented:
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.
0
All Courses

From novice to tech pro — start learning today.