Cloning a VM on Hyper-V without shutting it down
{note: this post is deprecated, it is now possible to do “live cloning” using VMM 2012 R2, See my newer post below}
Create clone of running VM using VMM
My OLD post:
If you use SC VMM’s own VM cloning functionality, you see two major problems:
- You have to shut down that VM, and
- The original VM gets destroyed.
Of course this is not acceptable if you are trying to create a dev VM out of a production VM.
Here is how you can clone a VM without these problems:
- Using VMM, create a checkpoint (snapshot) of that VM. Wait for the process to finish. This quieses the VHD, making it ready to be copied.
- Go the the HV server and copy the VHD to another location, say temp.
- Delete the VM’s snapshot, you do not need it anymore….and is a good practice to delete snaps ASAP.
- Create a new VM, leaving the NIC disconnected. I leave the NIC disconnected because when you boot this VM, there is a possibility that there will be an IP address conflict (not 100% sure about this, though)
- Copy the VHD sitting in temp to the directory which was created by the new VM creation process.
- Attach the VHD you just copied to the new VM
- Boot the VM and logon as local admin
- Run Sysprep from C:\Windows\System32\sysprep
- Check the “generalize” checkbox, choose reboot option (default)
- Change the IP the VM to something unique
- Add to domain, if needed.
- Done!
Notes:
- I am copying the VHD in temp instead of moving it so that I can create more clones. You can just move that VHD if you have no need for more clones.
- Also, it is better to make a VMM template from the copied VHD. I did not have time to do it because people needed the VM like, yesterday
But now that that VM is ready for them, I am free to create a new VM from the VHD in temp, then use VMM to create a template. That syspreps automatically and creates a template in VMM’s library which then can be used to deploy new VM clones easily.