Windows Server TechCenter > Windows Server Forums > Hyper-V > hyper-v server R2 restore vm from previous install
Ask a questionAsk a question
 

Answerhyper-v server R2 restore vm from previous install

  • Friday, February 27, 2009 10:54 PMisu_compu_dude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I asked this question in the server r2 virt forum but I wonder if it might not belong in this group instead after reading some of the posts in this group.


    I am trying to restore vm's with snapshots from hyper-v server that were moved during the install process of Hyper-V Server R2.

    The upgrade process did not work and so I installed using the method that moves the old installation of windows to windows.old. Now I am stuck with vm's that are in \windows.old\users\public\...

    I tried moving the directories from the old installation but when I start the hyper-v service it shows the machines with the guid long name instead of the vm name and the snapshots window is empty.


    Specifically I did:

    stopped the hyper-v service

    move \users\public \users\public-empty
    move \windows.old\users\public \users\public
    move \programdata\microsoft\windows\hyper-v \programdata\microsoft\windows\hyper-v-empty
    move windows.old\programdata\microsoft\windows\hyper-v \programdata\microsoft\windows\hyper-v

    start the hyper-v service

    hyper-v manager shows
    NAME                     STATE
    {some guid here} save-critical
    SNAPSHOWS
    DETAILS
    1/1/0001

     

    I think this may have something to do with the way hyper-v uses access control because I read some threads that led me to believe that the symlinks found here (that are now fixed) need different acls

     

    01/08/2009  02:44 PM    <SYMLINK>      6FBFD543-38A3-479A-9E2E-E80DD841147C.xml
    [C:\Windows.old\Users\Public\Documents\Hyper-V\Virtual Machines\6FBFD543-38A3-479A-9E2E-E80DD841147C.xml]
    01/08/2009  11:21 AM    <SYMLINK>      A849689C-6646-430A-AA90-B732BAD19999.xml
    [C:\Windows.old\Users\Public\Documents\Hyper-V\Virtual Machines\A849689C-6646-430A-AA90-B732BAD19999.xml]
    01/08/2009  12:53 PM    <SYMLINK>      CBE3D051-1855-4EF9-AAA5-616021C0A231.xml
    [C:\Windows.old\Users\Public\Documents\Hyper-V\Virtual Machines\CBE3D051-1855-4EF9-AAA5-616021C0A231.xml]


Answers

  • Tuesday, March 03, 2009 6:00 AMisu_compu_dude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Ok problem solved... this is no backdoor or hack or anything else brian might think.... this is simple disaster recovery

    For those of you that are using hyper-v server and you want to upgrade to hyper-v server r2 beta you may (as in you will) have issues. For me it was a weekend of my wife screaming at me to come home and that I have spent to much time at work, and browsing a lot of webpages that were helpful but not on the mark.

    From here on Hyper-V Server R2 beta will be known as HVR2 and hyper-v Server will be known as HVR1. I am sure that this information would also apply to 2008 and 2008 R2 beta many different flavors of hyper-v but we will focus on the Hyper-V server flavor because thats what I am using. Also the following information applies to the default installs... no changes in the defaults were made when creating the virtual machines (from now on refered to as VMS)

    1. When I tried to upgrade to HVR2 by putting the disc in the drive and following the installer I was greeted upon reboot by a windows PE error durring the upgrade process. SO I was forced to install side-by-side meaning all the original files on the HVR1 server were moved to c:\windows.old

    2.  There is no magic...no mysterious data items that do not exist...this is not hocus pocus
    This took me a while to figure out because I was trying to follow all the website instructions to recover hyper-v machines. Most of the sites were outdated, unclear, or incomplete. It wasn't until I made a new machine and found out where it stores its files that I was able to put all the pieces of the puzzle together.

    3. The are several default directories that are important.
    c:\users\public\documents\hyper-v
    c:\programdata\microsoft\windows\hyper-v
    These directories hold all the files for running the virtual machines.

    4. No matter what anyone says you can move a machine to another server with snapshots.
    You do not have to combine them. Don't ask me why they say you have to. I didn't read that far because I wanted the previous states on my machines... I mean whats the point of having them if in a disaster you cant have them anymore.

    5. No matter what I did I could not ever get symlinks to work in HVR2. Then when I made a machine in HVR2 I figured it why, they arent used anymore.

    6. Snapshots and virtual machines are moved to programdata in HVR2 where they were in users\public before, so now they replace the symlinks that were there. Probably because of some security issue with symlinks.

    7. By default HVR2 now puts the initial disk and avhd files in a different location that HVR1 but you can still use the old location. I suppose you could edit the xml config but I didnt want to edit anything.

    8. ACLS are manditory because when Hyper-V runs a machine it has to act like a new computer. Thus you have to set the files that belong to that VMS to the ACL...which is easy its just the directory name. So you have to follow the instructions to set them on the directories.
     
    9. I did not totally fix everything in my disaster recovery plan. I gimped out on the network config. HVR1 has a directory that holds the configuration information that I did not locate in HVR2, I simply edited the config for the VMS with the manager to fix the network adapter.

    10. Make sure to insert the vmguest.iso and run the tools to update your guests since there is new software in R2. My machines were slow as molasses before I ran them.


    After all this maybe someone can tell me WTF is going on with this team? why is the guest iso in windows/system32? Why can't they stick with 1 directory or the other for the hyper-v files? I mean its like they have 14 year old programming this. With all the problems I have had with Going from Virtual Server to Hyper-V to Hyper-V R2 I might as well be running Linux. J/K I know I would not have had all the wonderful resources that have helped me out.

    Thank you John Howard, Janique Carbone and Robert Vierhaler for patience and help guiding me through something thats "not supported"

All Replies

  • Friday, February 27, 2009 11:59 PMisu_compu_dude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I fixed the symlinks and the acls and when I started the hyper-v service I see the names of the vms in the list now. Still no snapshots. But when it started it said it was merging.

    Now when I try and start one of the vms it says 'Unamed VM' could not initialize. Failed because access is denied.

    I still think there are some security issues...maybe I can add everyone?
  • Saturday, February 28, 2009 8:34 PMBrianEhMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Snapshots that were taken of running VMs are not supported to pull forward.

    Offline snapshots can generally be carroed forward, but again it is not recommended.

    Best practice is to Export if you want snapshot history, or to delete snapshots if you want to guarantee a good experience.

    Brian Ehlert (hopefully you have found this useful)
  • Sunday, March 01, 2009 2:38 PMisu_compu_dude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I understand its not supported.

    I am not sure you understand the issue. Think of this as disaster recovery... and I would like to know the inner workings of hyper-v not the suggested methods of backup and restores.

    I have been able to get everything back into hyper-v as before. The state now says saved. Except the snapshots are empty.

    When I start a vm it says restoring failed in the operation. A window popup says "Unnamed VM" could not initialized. Access was denied to the vm configuration. 0x80070005.

    I believe this all comes down to security at this point. I think if I could just allow everyone access the snapshots and machines would start.
  • Sunday, March 01, 2009 4:56 PMBrianEhMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    There is no secret.

    There are data items that do not simply exist in system files, but exist more within a runtime database.

    One thing to consider is the symbolic links.
    Another thing to consider is a unique hidden security identifier that is assigned to each VM when the VM is created or imported.  (this is the security context that a VM runs within).

    Snapshots and snapshot history is a totally different thing.  Recovering snapshot history is only available through the Export process (as that is when it is written to a file) or through a backup utility that maintains a copy of the history.

    Getting a running VM is a different focus that is primary to recovering the virtual disks.

    Brian Ehlert (hopefully you have found this useful)
  • Sunday, March 01, 2009 6:55 PMisu_compu_dude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I find it hard to believe that what I am looking for doesnt exist since it is found on the server reboot. It is in the registry or in a file somewhere.

    I have fixed all the symbolic links and the service sid as per the posts on the groups here and on the blog here:
    http://blogs.msdn.com/robertvi/archive/2008/12/19/howto-manually-add-a-vm-configuration-to-hyper-v.aspx that show how to get the machines back in to hyper-v.

    Now the problem comes to the service sid and the acl. When I try and start the vms that are now restored into hyper-v it says "Unamed VM" could not initaialize. Failed because access is denied.

    I do not understand how hyper-v uses the
    VM GUID as a user connecting to the local machine for permisions on the file. If I could fix this I would be home free.

    BTW I have the machines back into hyper-v before I fixed the permisions on the symlinks like the blog post says when I would start the hyper-v service their would just be the vm guid instead of the machine name and the state was failed now the names show up right and the state is saved.

    I am sure it has to do with security and not with some magical secret runtime database that doesnt exist.
  • Sunday, March 01, 2009 7:18 PMisu_compu_dude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I understand that I can merge the snapshots together to restore the state of my machine...by following this blog post:
    http://blog.networkfoo.org/?p=384

    But following the instructions in the blog post in my last response I should not need to do such a thing.

    I have my vm's back in hyper-v. I need the snapshots back in.

    I believe it has so to do with the error I get when I try to start the vm which indicates a security problem...probably the same reason why the snapshots arent shown.

  • Sunday, March 01, 2009 7:25 PMisu_compu_dude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    In simple terms that I can understand:

     

    I understand that A849689C-6646-430A-AA90-B732BAD19999 is my VM found defined here

    02/27/2009  05:09 PM    <SYMLINK>      A849689C-6646-430A-AA90-B732BAD19999.xml

    [c:\Users\Public\Documents\Hyper-V\Virtual Machines\A849689C-6646-430A-AA90-B732BAD19999.xml]

     

    When I do the following command, it should let that machine have access to its snapshot files.

     

    C:\ProgramData\Microsoft\Windows\Hyper-V\Snapshots>icacls 1B22C144-259D-41A4-980A-B1E3BB8C77BB.xml /grant "NT VIRTUAL MACHINE\A849689C-6646-430A-AA90-B732BAD19999":F /L

    processed file: 1B22C144-259D-41A4-980A-B1E3BB8C77BB.xml

    Successfully processed 1 files; Failed processing 0 files

     

    Where is this user? Or how is it being used because when I do the following command the permissions are missing.

     

    C:\ProgramData\Microsoft\Windows\Hyper-V\Snapshots>icacls 1B22C144-259D-41A4-980A-B1E3BB8C77BB.xml

    1B22C144-259D-41A4-980A-B1E3BB8C77BB.xml BUILTIN\Administrators:(I)(F)

                                             NT AUTHORITY\SYSTEM:(I)(F)

                                             NT AUTHORITY\LOCAL SERVICE:(I)(RX)

                                             NT AUTHORITY\NETWORK SERVICE:(I)(RX)

                                             BUILTIN\Users:(I)(RX)

     

    Successfully processed 1 files; Failed processing 0 files

     

     

    So does this mean that I need to create the user A849689C-6646-430A-AA90-B732BAD19999 somewhere?

  • Monday, March 02, 2009 4:19 PMBrianEhMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You can continue to try to backdoor the system if you like.

    However, these security accounts are created by the Hyper-V system.

    You can attempt to create one to see if you can spoof the system.  And the permissions are on more than the XML file.

    Brian Ehlert (hopefully you have found this useful)
  • Tuesday, March 03, 2009 1:53 AMisu_compu_dude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I understand the permissions are more than the xml file. Yes I do want to do a disaster recovery on these vms.

    I have added the sids to the acls using the follow command

    C:\Users\Public\Documents\Hyper-V>icacls * /t /grant "NT Virtual Machine\{...idhere...}":F
    and on the publicdata hyper-v folder

    Now I am getting the following event logs:

    Event 3050, hyper-v-worker
    Could not initialize memory %%2147778581 (0x80048014). (Virtual Machine ID ....
    'machinename' failed tp restore. (Virtual machine id ....

    Event id 16320
    Cannot load snapshot configuration: the system cannot find the path specified (0x80070003) (Snapshot ID ....\

    Event id 14250
    Cannot find the path specified Snapshot. (Snapshot ID ....

    Event 12340, Hyper-v-vmms
    'saved state' cannot read key '/configuration/_ba8735ef-e3a9-4f1b-badd-dbf3a5909915_/VideoMonitor/State' from the repository. Error '%%2147778581' (7864368). (Virtual machine ID ....

  • Tuesday, March 03, 2009 6:00 AMisu_compu_dude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Ok problem solved... this is no backdoor or hack or anything else brian might think.... this is simple disaster recovery

    For those of you that are using hyper-v server and you want to upgrade to hyper-v server r2 beta you may (as in you will) have issues. For me it was a weekend of my wife screaming at me to come home and that I have spent to much time at work, and browsing a lot of webpages that were helpful but not on the mark.

    From here on Hyper-V Server R2 beta will be known as HVR2 and hyper-v Server will be known as HVR1. I am sure that this information would also apply to 2008 and 2008 R2 beta many different flavors of hyper-v but we will focus on the Hyper-V server flavor because thats what I am using. Also the following information applies to the default installs... no changes in the defaults were made when creating the virtual machines (from now on refered to as VMS)

    1. When I tried to upgrade to HVR2 by putting the disc in the drive and following the installer I was greeted upon reboot by a windows PE error durring the upgrade process. SO I was forced to install side-by-side meaning all the original files on the HVR1 server were moved to c:\windows.old

    2.  There is no magic...no mysterious data items that do not exist...this is not hocus pocus
    This took me a while to figure out because I was trying to follow all the website instructions to recover hyper-v machines. Most of the sites were outdated, unclear, or incomplete. It wasn't until I made a new machine and found out where it stores its files that I was able to put all the pieces of the puzzle together.

    3. The are several default directories that are important.
    c:\users\public\documents\hyper-v
    c:\programdata\microsoft\windows\hyper-v
    These directories hold all the files for running the virtual machines.

    4. No matter what anyone says you can move a machine to another server with snapshots.
    You do not have to combine them. Don't ask me why they say you have to. I didn't read that far because I wanted the previous states on my machines... I mean whats the point of having them if in a disaster you cant have them anymore.

    5. No matter what I did I could not ever get symlinks to work in HVR2. Then when I made a machine in HVR2 I figured it why, they arent used anymore.

    6. Snapshots and virtual machines are moved to programdata in HVR2 where they were in users\public before, so now they replace the symlinks that were there. Probably because of some security issue with symlinks.

    7. By default HVR2 now puts the initial disk and avhd files in a different location that HVR1 but you can still use the old location. I suppose you could edit the xml config but I didnt want to edit anything.

    8. ACLS are manditory because when Hyper-V runs a machine it has to act like a new computer. Thus you have to set the files that belong to that VMS to the ACL...which is easy its just the directory name. So you have to follow the instructions to set them on the directories.
     
    9. I did not totally fix everything in my disaster recovery plan. I gimped out on the network config. HVR1 has a directory that holds the configuration information that I did not locate in HVR2, I simply edited the config for the VMS with the manager to fix the network adapter.

    10. Make sure to insert the vmguest.iso and run the tools to update your guests since there is new software in R2. My machines were slow as molasses before I ran them.


    After all this maybe someone can tell me WTF is going on with this team? why is the guest iso in windows/system32? Why can't they stick with 1 directory or the other for the hyper-v files? I mean its like they have 14 year old programming this. With all the problems I have had with Going from Virtual Server to Hyper-V to Hyper-V R2 I might as well be running Linux. J/K I know I would not have had all the wonderful resources that have helped me out.

    Thank you John Howard, Janique Carbone and Robert Vierhaler for patience and help guiding me through something thats "not supported"

  • Saturday, March 14, 2009 10:55 PMDaveAtDotNetCodeSlingersDotCom Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I agree about the 14 yo kids designing this! I upgraded from Server 2008 integrated SP2 beta to Server 2008 integrated SP2 RC and all my virtual machines disappeared. Why does the storage need to be so complex and obscure? SP2 RC set the VM and VM Config diretories back to default but even after I pointed them BACK to where they were before the update, Hyper-V does not see any of my VMs. This sucks!!! At least they should publish a procedure or a tool to recover the VMs. Or warn they will all disapper and to export them all before upgrading. Dave
    Dave
  • Sunday, March 15, 2009 1:09 AMBrian Borg Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I agree.  I just went through this.  What a pain.

    See my post in HELP - SP2 RC deleted my virtual machines.
  • Sunday, March 15, 2009 5:16 PMBrianEhMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    isu_compu_dude:

    I am glad that you have gotten to a state that you can deal with.

    And from some folks that you give you better answers than I was able.  Much of this is due to some of the behavior changes that you mention.

    I have just recently learned of some of these behavior changes myself.  And this makes it difficult on all of us, when behavior is different and there is no documentation that states so.

    For safety sake I recommend to anyone to follow the upgrade instructions from the origional beta release.  As this is the only safe way.

    Also- in R2 you can reconnect to AVHD files, you can merge AVHD files (no renaming, etc. involved).
    Saved states of running VMs is still not supported to carry forward (has not been supported since the very first beta).
    Also, you have already caught some of the new file placement changes.
    All significant changes to an administrator, but not important enough to be featured by marketing.

    I have made some suggestions to the team and hopefully we will see some additional guidance.

    Thanks for posting your solution back to the forums.
    Brian Ehlert (hopefully you have found this useful)
  • Sunday, March 15, 2009 5:22 PMDaveAtDotNetCodeSlingersDotCom Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I made some suggestions and posted a summary there as well on how Hyper-V could be made a LOT easier to manage. Microsoft please consider these suggesitons. HELP - SP2 RC deleted my virtual machines

    Dave