virtualization - Why is there a Snapshot maximum on VM's using Hyper V?

05
2014-04
  • Iris Classon

    Hyper-V has a 50 snapshots max on a VM, I'm curios why.

    Requirements and Limits for Virtual Machines and Hyper-V in Windows Server 2012R2

    Snapshots 50 - The actual number may be lower, depending on the available storage. Each snapshot is stored as an .avhd file that consumes physical storage.

    I've never hit that number (nor will I) but I'm curios if there is a reason for that that number.

  • Answers
  • ekaj

    You start out with a virtual hard drive (VHD), and this first VHD is a fresh install of an operating system. When you create a snapshot it creates a few things from the VHD: a copy of the VM configuration in a .xml file, any save state files, and a differencing disk (.AVHD). The AVHD becomes the new, working disk for all writes, and this AVHD is the child of the working disk prior to the snapshot (in the case of your first snapshot, the parent disk is the VHD).

    When a VM is created in a directory, two sub-directories are created - \Snapshots and \Virtual Machines. Snapshot is intially empty and Virtual Machines contains the original XML config file saved with a unique GUID (globally unique identifier) for the file name. A directory to create the save state files (.VSV) and memory files (.bin). The directory also uses the same GUID its name.

    Write a few files, make a new snapshot, the process is repeated. You are now on your second snapshot, let's call it .AVHD(2) To reference recent changes to the original .VHD, your AVHD(2) looks at VHD(1) (AVHD(1) is now known as VHD(1) that is Read-Only, parent to the current AVHD, and this process continues) and reads those changes. To read changes OLDER than VHD(1), however, your current AVHD has to go back to the original VHD.

    Let's make a change, take a snapshot, and make another change. We are now on our 50th snapshot, yay! This means to reference a change to a filesystem, we now need to look back at VHD(49). Is the change in VHD(49)? No. Let's look back again... 48, 47, 46..? No. To look up a change on an old disk, say VHD(7), you need to look through the other 43 snapshots first, because it doesn't know exactly where that change is. This is VERY resource intensive, and can make something as simple as a read very disk intensive - hence snapshots are not meant to be used on production machines (and various other reasons).

    TL;DR When you create multiple snapshots a VM has to look through each snapshot first until it finds the one it is looking for. If you're on your 50th snapshot, it has to look through 49 other snapshots first to get to the original VHD. This becomes very inefficient very fast and slows disk speed to a crawl. I was not able to find a documented source for the 50 snaps, so it seems to be an arbitrary number for the sake of efficiency. Source


  • Related Question

    backup - How to back up VM's on Windows 8 Preview Hyper-V with WHS 2011?
  • Scott Bussinger

    I've got a computer running the Windows 8 Developer Preview and I've enabled the Hyper-V support built into that. I use a Windows Home Server 2011 box for backing up my computers. Settings and configurations are fairly standard on each of those and generally set to the defaults for most stuff.

    I'm new to Hyper-V and I'm wondering what I need to do to get running VM backups to work correctly in this environment? From reading I gather than Hyper-V can take a shadow copy of the VM and backup it up while running. What's not clear is what needs to be enabled/tweaked to make all of this work correctly. It's also not clear how I'd test it or verify it's working. So I've got several sub-questions:

    1. Do I have to do anything special to enable shadow copies on the Win8 box? Running "vssadmin list shadowstorage" on the machine makes it look like it's running on my drive C: (where the VM's are located).
    2. I've enabled the Hyper-V Integration Services in the VM's (specifically the "Backup (volume snapshot)" service). Is that the only change necessary in the VM's themselves?
    3. I've got a WinXP VM. I gather that unlike my Win7 VM's, it won't do a live backup but will pause the VM momentarily, do the backup, and then resume it again. Is that correct? I assume this is all automatic and I don't have to do anything special for this, right?
    4. I've seen some comments about a "Hyper-V VSS Writer", but that doesn't appear in the list when I run "vssadmin list writers". Do I need to do something to install/configure this? (As an aside, if this IS necessary why doesn't it happen automatically when I install Hyper-V?)
    5. I've found some pages talking about Hyper-V backups and the "Windows Server Backup" utility. Does all that information apply equally to my Windows Home Server 2011 backup? Or do WHS2011 backups work differently? Do I need to do anything in WHS2011 or in the WHS Connector settings for this all to work? I know that WHS uses a lot of the same technologies as other Windows Servers but it's not clear to me what important differences there may be.
    6. Lastly, how do I test this and verify the shadow copy stuff is working right? WHS 2011 backups don't provide a lot of diagnostic information that I'm aware of, so how could I check that I'm getting good VM backups?

    Sorry for the long question, but I'd very much appreciate any help any of you can give me!


  • Related Answers
  • surfasb

    I can answer a few of those.

    But lets get one thing squared away. There are two types of backups.

    Online Backup is where the VM will be backed up and it restores into the previous power-on state. If it was on, it restores as being on. This was not possible until Hyper V 3, which is the Windows 8 Dev Preview.

    The second result is if the VM was running, it will restore into a saved state. That is, the VM will be paused and you will need to resume it. This is the default result.

    1. Shadow Copy is on by default.
    2. For restoring the VM into a live (powered on) state, yes. For restoring a VM into a saved state, the integration component is not necessary.
    3. You do not have to do anything special. This is an Offline Backup.
    4. No idea.
    5. The Windows Server Backup utility is similar to the wbadmin. We'll need someone who's more familiar with WHS to speak about their similarities.
    6. Windows Server Backup does not backup individual VMs, but rather whole volumes. You can test it by taking down a volume and restoring it :)