How to clone a virtual machine in Hyper-V?

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:

  1. Export/import a virtual machine
  2. 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

  1. Right click the virtual machine. Select “Export”.
  2. Specify a folder to export virtual disk and configuration files. Click “Export”.
  3. In Hyper-V Manager, select “Import Virtual Machine”
  4. Follow the wizard to import the machine you have exported in the first step.
  5. Select “Copy the virtual machine (create a new unique ID)” in “Choose Import Type” window.
  6. 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.
Clone virtual machine in Hyper-V
Cloned machine should be in a different folder than the source machine

Copy the virtual disk and create a new machine

  1. Go to the folder that Hyper-V stores the virtual machines (by default: C:\Users\Public\Documents\Hyper-V\Virtual hard disks).
  2. Copy and paste the virtual disk that is used by the virtual machine you want to clone.
  3. In Hyper-V Manager, select “New -> Virtual Machine”.
  4. 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.
  5. 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.
Clone virtual machine in Hyper-V
Use an existing virtual hard disk to create a new virtual machine

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.

Leave a Reply