Msvm_VirtualSystemManagementService::ExportVirtualSystem

Odpovědět Msvm_VirtualSystemManagementService::ExportVirtualSystem

  • 2. července 2008 18:10
     
     
    Hi,

    I'm looking at the various ways to "backup" a VM. I'm curious what exactly "powered off" means in the context of using ExportVirtualSystem to backup the VM. I'm wondering if this means that the Hyper-V VS Writer is invoked and the disk file is in a stable state, or if a proper system shutdown is performed before the export, or ?

    What I'm trying to figure out is: what's the best method to take a proper backup of a VM that I may also want to come back around and loopback mount the .vhd file on? And, what's the best method to take a quick snapshot that I may not care about loopback mounting the .vhd on (I'm pretty sure that CreateVirtualSystemSnapshot solves that one).  And lastly, will the WMI API be able to satisfy both cases or is possible I'll need to use the VS Writer as well as the WMI API?

    Thanks a lot for any input.

Všechny reakce

  • 2. července 2008 18:57
    Moderátor
     
     Odpovědět
    In the context of using 'export' the vm must be 'stopped' - that is not running, the power switch is off.

    In the context of using the VSS Writer - the gust OS needs to be VSS aware (and hopefully the application in the guest as well).

    This just allows Hyper-V to trigger the Guest to go into its stateful 'happy place' - fush out the cache and all that and prepare for a running backup. 

    This works just like using VSS when the OS is running on hardware, except in this case it is the Hyper-V VSS telling the guest VSS to 'get ready' instead of the Hyper-V VSS just telling Hyper-v to get ready.

    If all that you want to do iis to mount the VHD - the key is to make sure that you only have the VHD to mount (this means no snapshots - no AVHD differecing disks attached to your parent VHD).

    As long as this is the case, your life is much simpler.

    Use the VSS writer if you know how - is the recommended way - and the only way to allow your VM to keep running during the process..

    Sorry I don't have code samples, but I know that a bit of google-fu will turn some up for you.


    Brian Ehlert (hopefully you have found this useful)
  • 2. července 2008 20:28
     
     Odpovědět
    Hi Brian,

    Thanks for the reply.

    So if there are snapshots or AVHDs involved, is it possible to use VSS to create a shadow copy, mount that shadow copy and then use the WMI APIs to collapse them into a mountable .vhd file? I'd like to be able to mount the .vhd without shutting down the actual VM and without messing with the disk images / snapshots it currently has. I can do some experimentation on this, but it probably boils down to the flexibility of the WMI calls. I'm hoping this is possible.

    Thanks again. I was able to find some samples using diskshadow and it all works great. I just wanted to make sure I'm heading in on the right track. I'll use VSS directly for backups and restores, and then maybe the WMI API for management functionality.