Is there a way to import a Hyper-V VM into a Hyper-V Server without an export file?
Posted on 2013-05-13
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.