An export operation packages up a copy of a virtual machine so you can transport it to another Hyper-V host or cluster member and import the virtual machine. Performing that task in Windows Server 2012 R2 (WS2012 R2) is commonly referred to as “live exporting” of virtual machines. In this article, I will explain how WS2012 R2 improved how you can export virtual machines.
Before WS2012 R2 was released, you always had to shut down or power down a virtual machine to do an export of a virtual machine. This isn’t great in a DevOps world, as it would be great to have actual copies of production systems that you can test without bringing down those production systems in the first place.
That would be kind of ironic because the idea of getting a copy of the virtual machine is to test manipulative operations and rollback actions to ensure that production systems are not damaged.
WS2012 R2 brought some new functionality that the community calls a live export. This package of features enables us to do two things:
How to live export a running virtual machine or snapshot from WS2012 R2 Hyper-V. (Image: Aidan Finn)
The process for exporting a virtual machine is pretty simple. Open Hyper-V Manager, right-click on the virtual machine, and select Export. A pop-up window called Export Virtual Machine will appear. Enter the path where you want the export to be saved. The export will start immediately after you click OK, whether the virtual machine is running or not.
In my example (see the previous screenshot), the virtual machine VM01 has multiple nested checkpoints. When I export the virtual machine to D:Exports a new subfolder is automatically created to store the export. This subfolder is named after the virtual machine (D:ExportsVM01). Once the export is complete, I can browse the folder and find a packaged version of my virtual machine in the new subfolder:
In other words, the virtual machine and all of the dependent checkpoints are packaged up when you export a virtual machine.
I can also export a checkpoint. Make sure that there are no outstanding export operations on your virtual machine or its checkpoints, select a checkpoint, right-click the desired checkpoint, and select Export. The same Export Virtual Machine dialog will appear and the process will also create a subfolder named after the virtual machine. However, the export process works a little differently.
Instead of exporting an virtual machine with all of its dependent checkpoints, with this process a virtual machine without any checkpoints is created in the export subfolder from the original checkpoint. It appears that Hyper-V is using the metadata (XML, VSV, BIN) files to create the virtual machine, and performing a merge operating to create a new VHDX file without any AVHDX files (checkpoints). This gives you a nice clean export, but keep in mind that the merge operation might take a little time.
You can later import the virtual machine to the same host or another host. But remember: If this is a copy of a running virtual machine, then you really should place the imported virtual machine on an isolated network. This process is like using Ghost to clone a physical machine and then deploying that image to another computer. You do not want identical identities on the same network.