AskME4Tech

We Do the best to understand Technology

You are here:

Moving Virtual machine from one HYPER-V host to another

Sometimes maybe need to move one of our Virtual Machine from one HYPER-V host to another hardware and HYPER-V Host. I wll not explain why must be done because everyone has the own reasons to do it. But The most common reasons that need to move your Virtual Machine are to free up space, free up resource of your HYPER-V Host or to change the hardware of your HYPER-V Host

Before start to explain how can move the Virtual Machine we must be careful with some consideration. These are :

  • How downtime involved in process?
  • How long the migration will be take?
  • Do we have the resources in the new HYPER-V Host for the Virtual Machine?

The reason is that we don't want to have any problem while moving the Virtual Machine and the process must be done as fast as possible with little or no downtime of Virtual Machine.

We have different ways to move a virtual machine in another HYPER-V Host that i will explain all of them in feature articles. The most possible ways to do it are:

  1. Copy VM files
  2. Export/Import VM
  3. Live Migration
  4. Replication
  5. Backup and Restore

I will start with the first Way that i use it sometimes because it's very easy without High Risk. The  disadvantages of this ways  are 

  •  you must perform the process after hours because you will have downtime in both HYPER-V Hosts.
  • HYPER-V Settings of the Destination Server must be the same. For example if your Virtual Switch Name in the destination server has different name then the VM will failed to start.

Let's start!!

  • Open the HYPER-V Manager from the source server.
  • Click in the right side HYPER-V Settings.

  • Locate Virtual Hard Disks and Virtual Machines Path.

  • Click from the right side Stop Service to stop the Hyper-V Management Service.

  • Open the folder of Virtual Hard disks and locate the hard disk of the VM that you want to move.
  • Open the folder of Virtual Machines and locate the xml file and the SID folder  which is the same name with the xml file. To identify quickly the xml file and folder go back in the Virtual Hard disks. Right click in the hard disk and select Properties. Click on Tab Security and find a alphanumeric group like 45BHR657-5T6Y-XXXX-XXX..........This is the name of the file and folder which related to the specific VM. 

  • Copy the vm hard disk,xml file and SID folder in the new Location of Virtual Machibes and Virtual Hard disks in the destination HYPER-V Host.
  • In the destination Server open the Cmd with Run as Administrator.
  • Type the following commands to give the appropriate permissions. If you don't give the permissions the VM will faile to start:
    icacls <path of xml fie> /grant "NT VIRTUAL MACHINE\<Virtual Machine SID> ":F
    For example: icacls "C:\Programm Data\Micrsoft\Windows\Hyper-V\Virtual Machines" /grant "NT VIRTUAL MACHINE\48C5CA29-71A8-4096-9222-C1121C7D7677":F
    icacls <path of virtual hard disk> /grant "NT VIRTUAL MACHINE\Virtual Machine SID ":F
    For example: icacls "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\windows8.1.vhdx" /grant "NT VIRTUAL MACHINE\48C5CA29-71A8-4096-9222-C1121C7D7677":F

  • Open the HYPER-V Manager in the Destination Server.
  • From the right side clcik Stop Service and Start Service again.

  • Now yo can see the Virtual Machine that copy in this Server.

  • Start the Virtua Machine without problem. If face any problem while start the VM verify that the appropriate permissions have give it in vm hard disk and SID folder.
  • Also one of the problem that face when start the VM was with Virtual Switch Name. If the Virtual Switch Name is different in the destination you must change it to be the same name as the source server.

 

This is the older method of all  and diffcult. It's an appropriate for small VM'S because you don't need lot of time to complete the transfer in the new destination HYPER-V Host.

It will be my pleasure if you have your own recommendations or questions or different opinion to be share in our commented system. You can help others or help yourself. 

 

Best of 2016: 

Similar Posts

Export & Import Virtual Machine in HYPER-V

Before almost a month i wrote an article for

Export & Import Virtual Machine in HYPER-V with Powershell

Last week i wrote an article with full details how can export & Import Virtual Machine in

Keep in Touch with Askme4Tech

Twitter icon
Facebook icon
Google+ icon