Sunday, June 17, 2012

Export and Import of VMs in Hyper-V (Windows Server 2012)

Export and Import of Virtual Machines in Hyper-V (Windows Server 2012)

This is just a quick blog post highlighting the export/import enhancements in Hyper-V.

I`ve been working with some VMs this weekend on my stand alone Hyper-V server.

I`ve been testing and building some differential disks for a workshop I`m holding before the holidays.

I like that everything is so simple with Powershell, so I have created the easiest script in the entire world to export all my VMs to a folder, once I am happy and satisfied with the configuration.
However, the thing I’d like to mention and show you, is the import process in Windows Server 2012 Hyper-V.

The first thing that is worth mention is that you can import a VM that hasn’t been exported.

That`s right. In Hyper-V in 2008 R2, you would have to have the .exp file along with the VM files to be able to import it. Or else, you would have to re-create the VM and attach the VHDs.

Now, you only need to locate the folder with your VM associated files, and the import wizard is smart and takes it from here. In addition, your user must be a member of the local Hyper-V administrator group on the Hyper-V host where you import.

First, specify the folder where you are certain that your VMs are located.

Select the VM you want to import.

Choose the type of import for perform. If this is a restore, or you are moving the VM from point A to B (since LM is not possible for some reason), choose to use the existing unique ID).

If this is a VM you are copying, create a new unique ID so you don’t have two identical VMs on the same network, in the same domain etc.

Next, decide where to locate the VM. Specify VM config location along with snapshot and smart paging. (Smart paging is a part of dynamic memory in Hyper-V 3.0, letting the VMs use memory on disk when they can’t allocate necessary amount of RAM from the host during a reboot operation (you can specify startup RAM, minimum RAM and maximum RAM now), so that the VM can be able to reboot and eventually delete the pagefile when it returns to minimum RAM usage).

Also, choose where you want to locate the virtual hard disks.

Last, you`ll get a summary of the configurations you have done.

Once you click finish, the process will start.

INFO: If this is a VM that is associated with a different virtual switch than the virtual switch on this Hyper-V server, you will be able to specify/choose connection after this. In my example here, everything is in order so the import process continues as expected.

What happens when the import process starts: 

  •       Creates a copy of the virtual machine configuration file so that if any unexpected restart occurs on the hosts, you are safe and the config is not broken.
  •       Validates the hardware and compares the VM configuration with the physical host. (NUMA is essential here, but I`ll cover the intelligent NUMA placement stuff in a blog post later).
  •       Compiles a list of errors. A list that identifies what need to be reconfigured, and will show you in the wizard.
  •       Display the relevant pages, one category at a time. The wizard explains each incompatibility to help you reconfigure the VM so it is compatible with the new host
  •       Remove the copy of the configuration file. After the wizard does this, the VM is ready to be started.


duitwithsbs said...

interested in the concept that you don't have to 'export' prior to 'importing' vm's - for an in-place upgrade on same hardware of HyperV 2.0 - 3.0. This could save a lot of wasted time and keep businesses from having to be down for such a lengthy process. Thanks for the post.

Patrick said...

Thanks for the nice notice, I was looking for a proper way to export, but seems, just copiing is fine.

Michael Stark said...

Thanks for this nice post.
Import Export Business