Problem solve Get help with specific problems with your technologies, process and projects.

Troubleshooting Hyper-V R2 VM import and export

Completing a Hyper-V R2 VM import and export may be more complex than necessary, but this tip explains how to work around issues such as being unable to move VMs after an import.

Solution provider's takeaway: Microsoft Hyper-V R2 VM imports and exports can be quirky and hard to handle. Find out how to troubleshoot potential customer problems with the import-export process using this step-by-step approach.

Do you have customers running virtual machines (VMs) atop Microsoft Hyper-V? If this is the case, then you probably also have customers who've been burned by its VM export and import idiosyncrasies.

To move or copy a VM from one Hyper-V host to another, each VM must go through an export and import process. The initial stage of this procedure requires you to export the VM from the old host. by doing this, you create a copy of its configuration and ivirtual hard disks as well as any snapshots to a location that you identify during the export.

Once the export is complete, a subsequent import is required to associate that VM with its new host.

How to Complete an VM Export
Both export and import actions are exposed in the Hyper-V Manager console. Start the process by right-clicking the VM and clicking Export. To complete the export, you'll need to provide a location where the VM's data will be copied That location can be anywhere on your network.

Unlike Hyper-V R1, Hyper-V R2 supports the ability to export individual snapshots of a VM. This ability creates a fully functional VM based on the configuration in the snapshot.

The VM can be imported to a different virtual host or used for storage or data backups. Right-click any snapshot in the Hyper-V Manager's Snapshots pane and choose Export to begin the process.

Simplifying the VM Import Function
One of the biggest difficulties when importing VMs in Hyper-V R1 revolves around its import function. In Hyper-V R1, importing a VM from a location on disk made it impossible to move the VM after importing it.

This usually meant that an exported VM would then need to be file copied or moved to its appropriate target location before starting the import process. What made this process particularly difficult was that there was no reminder given to administrators that imported VMs effectively locked that VM into its location on disk.

Microsoft has altered this process slightly in Hyper-V R2, but your customers could easily miss this subtle change. Clicking the Import Virtual Machine link in the Hyper-V Manager's Actions pane opens a wizard to complete the task.

This wizard will ask where the VM's exported files are located. It also provides a set of options for selecting import settings. One of those import settings is a checkbox labeled "Duplicate all files so the same virtual machine can be imported again".

Selecting this checkbox is important if you intend to create multiple copies of a VM or if you don't want to lock the folder to the VM. Microsoft added this checkbox in Hyper-V R2 to eliminate the import-copy-export steps previously required in R2. This checkbox is also useful if you wish to provision VMs from a reference image, sometimes called a "golden image". Start this process by:

1. Creating the reference image within Hyper-V Manager

2. Generalizing the image with an image preparation tool such as Sysprep

3. Exporting the generalized image to a file server somewhere

4. Importing a copy of the VM back into a Hyper-V host when a new server is needed.

If you intend on using scripting, Microsoft has also exposed a greater set of configurations in Hyper-V R2. With R2, VM parameters like VHD paths, network connections and authorization settings (via AzMan) can be modified during a VM import.

Three code samples for importing, exporting and performing a configuration-only export can be found on Microsoft's TechNet site. Those familiar with the configuration-only export functionality previously exposed in the Hyper-V R1 UI should know that this functionality has not been removed from Hyper-V. But it has been removed from the Hyper-V UI. As a result, configuration-only exports in Hyper-V R2 can only be triggered through its scripting API.

About the author Greg Shields, MVP, vExpert, is a partner with Concentrated Technology. Get more of Greg's tips and tricks at www.concentratedtech.com.


This was last published in December 2010

Dig Deeper on Server virtualization technology and services

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

MicroscopeUK

SearchSecurity

SearchStorage

SearchNetworking

SearchCloudComputing

SearchDataManagement

SearchBusinessAnalytics

Close