Solved

Is there a way to import a Hyper-V VM into a Hyper-V Server without an export file?

Posted on 2013-05-13
9
495 Views
Last Modified: 2014-11-12
If you export a Hyper-V VM from Hyper-V manager to a folder, it will create a folder inside that folder with the name of the VM being exported, and within that folder will be an XML file that is used for importing, along with the VHD's of the VM, and any configuration files required for the VM to function.

Running VM's within Hyper-V are typically running inside a folder named for the name of the VM as well.  examples:

D:\VM-DATA\VM1 = working folder for VM1
D:\VM-DATA-VM2 = working folder for VM2

If I shut down VM1, copy the folder D:\VM-DATA\VM1 to another Hyper-V server and try to import the VM, I am not able to because of the absence of an export file.  I can create a NEW VM manually and point the hard drives of the new VM to the VHD files contained in the copied folder, however when this VM's boots up none of the NIC settings will be configured and the NIC's that are attached to the new VM will show up with a new name (LOCAL AREA CONNECTION 3, 4, 5, etc...).  The reason for this is the MAC address of the original NIC(s) was contained in the configuration file of the VM, and when we create a new VM but use existing VHD's, a new configuration XML file is generated and that includes a new MAC address for the NIC.

Is there a way to copy the entire VM folder from one server to another and ADD that VM to the target server without importing it?  Or asked a better way, how is the import file formatted, and is there a way to generate an import file from the current configuration files?  

I'm thinking about this from a disaster recovery point of view...we have had operating systems of VM-Hosts corrupt but the data partition stay intact.  We have been able to pull the entire content of folders off of dead VM Hosts and pull them into currently working hosts, but we end up having to create a new VM shell to host the "transplanted" VM VHD's and data services...the biggest issue being that we have a new MAC address of the VM-NIC and the settings default to DYNAMIC.  We need to set the MAC address sometimes (depending on the APP) and reset the NIC from dynamic to STATIC.  If there was a way to import without an import file, or generate one from the existing setup files, OR create a new VM shell and then replace the configuration file generated with the configuration file that was in the original VM's folder, any of these options would make life much easier.

I know that the right way to attack this requirement would be to put the VM's on external storage like iSCSI SAN, and cluster the VM's using Windows clustering services....but this is not an option and we're trying to mitigate the risk of not having that by coming up with a better way to transplant VM's without an import file.
0
Comment
Question by:jkeegan123
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 39162632
What version of Hyper-V?  I believe 2012 can import VMs without an export
0
 
LVL 5

Author Comment

by:jkeegan123
ID: 39162642
Hyper-V v2 on Windows 2008 R2.  Currently you cannot import a VM without an export file.
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 39162692
Upgrading to 2012 is not an option?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 5

Expert Comment

by:Eddie-Lopez
ID: 39162710
Hi,

All these actions can be automated with Powershell scripts. This is not exactly what you're asking, but here's an example of a ps script that will turnoff/export a VM:

http://www.czerno.com/default.asp?inc=/html/windows/hyperv/cluster/HyperV_Export_VMs.asp

You could modify it or look for other ps scripts as needed.
0
 
LVL 5

Author Comment

by:jkeegan123
ID: 39162788
@leew:  Upgrading to 2012 is definitely an option, but I'm looking for an easy way to deal with 2008R2 disasters, so not in this case.

@Eddie-Lopez:  Thanks, but I'm looking for a way to deal with the VM's in a disaster environment where there would be no time for a script to run, or no way to run it.

I'm looking for a way to get an existing VM with configuration file into a new / different Hyper-V server.
0
 
LVL 119
ID: 39163043
0
 
LVL 5

Expert Comment

by:Eddie-Lopez
ID: 39163084
I see...

Looks like "Hyper-V Replica" feature would probably fit your needs, unfortunately it involves upgrading to Windows server 2012...

You could also make a PS script that on a schedule (once a day, for example) that would turn off, export, and copy your VM files to your disaster recovery host. Or simply a scheduled batch file that copies your VM vhd to your DS host.

That way if your host fails, you have an updated version of your VM to do a failover.
0
 
LVL 5

Accepted Solution

by:
jkeegan123 earned 0 total points
ID: 39163200
These are all great suggestions if we were running an environment with a standby host next to it ready to go...the Windows Server 2012 replication option works great for this!  Unfortunately, we are just mercenaries that often walk into disaster, and in the places that we will encounter hosts in this state, we would not have had any opportunity to do any preventative work.  Furthermore, in the clients that we usually do work, they don't have the budget or the foresight to get a standby server for the WHAT-IF.  so I'm left with what I have.   Since I'm talking about a VM HOST either dying or the host OS corrupting, I'm assuming that all of the DATA PARTITION data is intact, and I'm looking for a way to be able to clone that entire partition and import the VM's without manually re-creating those VM's.  

In example:

When the storm hit in October, We had many VM Hosts come back up with corrupted OS's or damaged hardware.  In all cases, we were able to LIVE-STATE the data volume to external media and restore to a healthy server.  Once that happened, we MANUALLY created all new VM's, and instead of creating a "C" drive, we browsed to the existing one.  Then we added all data volumes as well, and the VM came up as it was without issue, with all drives attached, but the NIC's were not configured.  The LAST thing we had to do was manually re-address the NIC's.  This despite the fact that the VM configuration was in the folder, it just wasn't registered in the new, blank Hyper-V server.

Here is a good example of what I am talking about:  http://eniackb.blogspot.com/2009/05/how-to-recover-hyper-v-virtual-machine.html

I haven't tried it yet, but this may be the way to go.  Does anyone have any experience doing this in the link attached?
0
 
LVL 5

Author Closing Comment

by:jkeegan123
ID: 39190261
This was the only solution that met the posted questions requirements.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question