One of the most underrated features in Windows Server 2012 R2 Hyper-V is the ability to create a clone of a running...
virtual machine. In this article, I'll explain why this feature is worth paying attention to and how you can go about using it.
The benefits of live cloning
Hyper-V has had the ability to clone virtual machines (VMs) for quite some time --via the export feature -- so live cloning might not initially seem like that big of a deal. However, there are situations in which live cloning can be very useful. Suppose, for instance, that you have a Web server and you need to scale the Web application that the server is running. You really don’t want to take the server offline to make a copy of it to run on another server. Instead, you could just clone the running Web server and then run the copy on another host server to improve application scalability.
Live cloning is also good for troubleshooting. If a mission-critical VM is having problems, you really don’t want to have to take that VM offline to fix the problem, nor do you want to use trial and error troubleshooting methods on a production VM. Instead, you could make a clone of the VM, diagnose the problem in a lab environment using the clone and then apply your fix to the production VM.
Some administrators have even sysprepped a running VM and then cloned the sysprepped image. This technique makes it easy to deploy a large number of new VMs with minimal effort.
Some important things to know
There are a couple of important things to know before you attempt to clone a running VM. First, although checkpoints and differencing disks are the underlying mechanism that makes cloning possible, the clone does not maintain a differencing disk relationship to the original VM. As such, the clone will consume the same amount of storage as the VM from which it was created.
The other important thing to know is that the clone truly is an exact copy of the original VM. This means that the clone will have the same IP address, computer name, security identifiers and other settings as the original VM. That being the case, you cannot run a cloned VM in its unaltered form on the same network segment as the original VM. If you want to run an unmodified clone, you will have to do it on an isolated network segment.
Cloning a running VM
The process of creating a clone from a running VM is surprisingly simple. First, open the Hyper-V Manager, right click on the VM that you want to clone and choose the Export command from the shortcut menu, as shown in Figure A.
Next, Hyper-V will prompt you to specify the location where you want to save the exported copy. Enter the new VM path and click the Export button. When you do, Hyper-V will begin the export process. You can track the progress through the Hyper-V Manager’s Status column, as shown in Figure B. It is also worth noting that the cloning process can take some time to complete.
The exported virtual machine will be placed into the location that you specify -- in a folder bearing the name of the VM. For example, I cloned a VM named Lab15DC and placed it in a folder called F:\Clone, so Hyper-V put the VM into a folder named F:\Clone\Lab15DC.
If you need to import a VM clone, right click on the name of your Hyper-V host within the Hyper-V Manager and select the Import Virtual Machine command from the shortcut menu. It is worth noting that when you import a clone, the Date Created field will display the date that the original VM was created, not the date when the clone was created.
As you can see, Microsoft makes it very easy to create a clone of a running VM. As a best practice, you should avoid placing a clone into the same folder as the original VM.