If you are using virtualization, you might have asked this question at some point in your journey: How to clone a virtual machine in Hyper-V? Cloning a virtual machine in Hyper-V is slightly different than cloning them in VMware or VirtualBox. It is technically possible but you need to use a detour. There is no “Clone” button you can click on.
Virtual machines help us saving time and reducing costs especially in enterprise companies where hundreds of servers and client machines are required to run daily operations. In order to create a farm with numerous virtual machines, you need to find an easy way to create them in bulk which is where cloning comes in the picture.
Some hypervisors such as VMware and VirtualBox provides a cloning feature out-of-box. In general, you can clone a machine by right clicking on it and selecting “clone”. The approach is a little different in Hyper-V but it is still possible to clone virtual machines.
Clone a virtual machine in Hyper-V
There are two ways to clone a virtual machine in Hyper-V:
- Export/import a virtual machine
- Copy the virtual disk and create a new machine with the copied disk
Follow the steps below to clone a virtual machine by the ways mentioned above.
Export/import a virtual machine
- Right click the virtual machine. Select “Export”.
- Specify a folder to export virtual disk and configuration files. Click “Export”.
- In Hyper-V Manager, select “Import Virtual Machine”
- Follow the wizard to import the machine you have exported in the first step.
- Select “Copy the virtual machine (create a new unique ID)” in “Choose Import Type” window.
- In “Choose Folders to Store Virtual Hard Disks” window, select a folder that is different than the folder in which your original virtual machine. Hyper-V doesn’t allow storing both source and copied virtual machines in the same folder.
Copy the virtual disk and create a new machine
- Go to the folder that Hyper-V stores the virtual machines (by default: C:\Users\Public\Documents\Hyper-V\Virtual hard disks).
- Copy and paste the virtual disk that is used by the virtual machine you want to clone.
- In Hyper-V Manager, select “New -> Virtual Machine”.
- In “Connect Virtual Hard Disk” window, select “Use an existing virtual hard disk” and specify the folder of the virtual disk you copied in step 2.
- Complete the wizard by following the instructions.
Are you getting “The unsigned image’s hash is not allowed (DB)” error message while creating a new virtual machine? Check this post out.
Note: If you want to add the cloned virtual machines to the same Active Directory domain as source virtual machine, make sure to use Sysprep.exe. It changes the unique identifiers of the virtual machine such as SID, computer name, and IP address.
Thanks Tech Journey for this comprehensive post.
1 thought on “How to clone a virtual machine in Hyper-V?”