Search Windows and Linux Networking

Saturday, February 15, 2014

How to upgrade Windows 2008 R2 SP1 Hyper-V to Windows 2012 R2 Hyper-V (step-by-step)

I am planning to move my Hyper-V environment to latest Windows 2012 R2 from my current Windows 2008 R2 SP1 environment. For that I created test environment as my current to test several things. During that I came across lots of challenges, especially with export-import method and with the VM’s having checkpoints taken in a running states.

After doing some testing I found two methods to do the up-gradation.

1) First method is to use an intermediate server (this can be used if you already exported your VM and deleted the original VMs). In this method you will export the VM from the 2008R2 host and then import in 2012 Hyper-V host (no need to start it up) and then export it again from the 2012 Host and import it in 2012 R2 host.

2) The Easiest way will be to turn off the VM on the hyper-V 2008R2 host and stop the VMM service on the host server as well to unlock all VM files. The next step is to copy all Virtual Machine files/folder including the VHDs, XML, etc. to the server 2012R2 and import them directly.

I decided to go with second method to avoid use of another Hyper-V server and perform format & reinstall method, so that it will stop VMM Service while format. There is a critical prerequisite for this approach. None of the virtual machines files should reside on the C: drive. Sadly, the designers of Hyper-V continue to use a subfolder on the C: drive as the default locations to store The VM XML files & Virtual Hard Disks.
(I will highly recommend trying upgrade in your test environment first & having a backup while doing anything in your production environment).

I created my test setup as below.

Installed Windows 2008 R2 SP1 with Hyper-V role, made sure that management OS partition and VM storage are on different drives.
Created test VM with three snapshots. First two snapshots (Snap1 & Snap2) taken while VM in running state & third snapshot (Snap3) taken while VM in stopped state.

I performed below Step-by-step to complete my test upgrade.

1) Make sure that all your VMs are in “Off” state.
2) Insert Windows 2012 R2 installation disk in to DVD drive and install Windows 2012 R2 by formatting existing Windows 2008 R2 SP1 OS drive. (Make sure that you are keeping your VMs on different drive other than OS drive.)
3) After installing the OS, install Hyper-V role, create virtual switch and also install latest windows patches.
4) Now open Hyper-V Manager in newly installed Windows 2012 R2 hyper-V server.
5) Click on Import Virtual Machine in Actions pane. It will open Import Virtual Machine wizard. Click next on below screen.
6) On next screen provide the path where VM to be imported is stored. Click next.
7) On below screen select the VM to be imported. Click Next.
8) Select “Register the virtual machine in-place (use existing unique ID)” and click next.
9) On below screen select the location where VM hard disks are stored (in my case it was same). Click next.
10) If you are having snapshot of VM taken in running state, during VM loading process it will give you below “Saved State Error “, Click on “Delete Saved State”.
(I have got this warning for first two snaps, as I took them while vm in running state.)
10) If you have configured virtual network switch with different name than that was in Windows 2008 R2 SP1 Hyper-V, it may ask you to specify VM network to connect to. Specify the same and click next.
11) On summary page, review summary and click finish. It will import the VM.

Post Import tests & tasks.

12) After completing these steps, I performed some tests. Like starting VM.
13) Applying Snap1 (you will need to start VM after applying Snap as saved state has been deleted).

14) Applying Snap2
15) Finally you will also need to upgrade Guest OS Integration Components for each VM.

Hope this will be helpful to you. Also share if you have any suggestions