Information Technology Headline Animator

Information Technology

Thursday, April 15, 2010

Server 2008 : How to clone a VM in Hyper-v

There are two ways you can clone a VM in Hyper-V.

1. Using the import/export VM feature available in Hyper-V

2. Copying a Virtual Hard Disk and create a new VM using that Hard Disk.

1. Import/Export feature to clone a VM in Hyper-V
This is a simple and easy way to clone a Virtual Machine (VM). But, the only low side of it is that the import of VM will only work on any VM which was exported from a Hyper-V Virtual system.
Export VM
From the Hyper-V Manager, right-click on the VM and select Export. Choose a location where the exported VM will be saved. It is important to note that when you import this VM back from that location, its Virtual machine and virtual Hard Disk location will be set as this location and not the default location.




While exporting a VM, you can choose to export only the VM and not its Virtual hard Disk (VHD). This can be particularly useful when you want to create a new VHD and perform fresh install.




Import VM
To import the Virtual Machine (VM), click “Import Virtual Machine” from the Action menu in the right of the Hyper-V Manager. Browse to the location where the VM was exported to and then click Import.




Again, it is important to note that the location is the exact location to where original VM was exported to and not any of its sub-directories.
Once, the VM is imported, you can change the settings as you would with any other VM. If you bring this VM online in the same Virtual Network as that of the original VM and that the original VM is still live on that network then it would be ideal to disable the network on this newly imported VM and change the hostna,e,IP Address settings from within the VM to avoid any network issues.


2. Copy VHD and Create new VM
This is quick way doing a clone on a VM. Simply make a copy of the VHD from the original VM and use it when creating a new VM instead of creating a new VHD for that VM.

How to create a new VM and use existing VHD, that will be available in next Post

3 comments:

  1. I have made the above changes and I now cannot RDP into my original vm. I can login via the host and it is still serving out web pages, but I can't ping it in the network.

    I was attempting to make a development server, but feel I should have done it differently. I suspect a DNS issue, but I do not see the web server listed in our internal DNS. It is in our DMZ.


    Thoughts?

    ReplyDelete
  2. Hi @pedalgrl,

    Please check the firewall, if the firewall is enabled on this vm then in that case you won't be able to ping or rdp so you need to set an exception for both ICMP and RDP.

    ReplyDelete