Hyper-V: Upgrade Hyper-V Server 2008 R2 to Hyper-V Server 2012 R2
Upgrading Hyper-V Server
It is not possible to directly upgrade Hyper-V Server. If you insert the DVD for a later version of Hyper-V Server and run setup.exe from the command line then you are eventually told that it is not possible to do this and the only way to upgrade is to install a new copy of the operating system.
This installation will remove all your virtual machines from the console - so its not really an upgrade, but if you need to upgrade in place then the steps are outlines below.
Recommended: To upgrade is not recommended. It is better to move the virtual machines to a new host that is running the version of Hyper-V Server that you want to use. Then when all the guest machines have been moved, then and only then reinstall the first machine.
Before You Upgrade
If you need to upgrade the server the recommended process is to:
- ensure that you have a backup
- move all the guest virtual machines to known locations. Avoid having configuration files stored in C:\ProgramData as that will get archived.
- document all the virtual machines, settings and VHD file locations
- if you have any static MAC addresses set, make a note of these
- make a note of all the iSCSI targets you have configured and the SAN IP, drive letter or mount point where these are referenced
- recommend creating a text file in the root of each disk saying what drive letter or mount point it should be
- make a backup of the virtual switch configuration on the machine
- backup everything again
The Upgrade Process
Once you know where everything is that you have backup up and documented, you install Hyper-V Server by wiping the server and installing a new copy. There is no upgrade path. The steps to install are very simple and documented elsewhere.
After You Upgrade
Now that you have a newly install Hyper-V Server, its time to restore the configuration:
- configure the server as required (IP address, administrators, domain membership, computer name etc.)
- run the following to enable File and Printer sharing firewall rules:
- netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
- run the following to install the File and Printer sharing roles and services
- dism /online /enable-feature /featurename=File-Services
- from a remote computer running the same version of Windows Server as you have Hyper-V Server installed, or the matching client version (i.e Win 8.1 for Server 2012 R2) enure you have Hyper-V Remote Admin tools installed
- connect to your new server using the Hyper-V Remote Admin Tools
- restore the virtual switch backup you made to return your virtual machine network settings
- connect to your server via Remote Desktop or sit at the console
- Run iscsicpl and reconnect all the iSCSI targets
- Run diskpart and configure the disks as follows
- list disk
- select disk x
- online disk
- attributes disk clear readonly
- and repeat for each disk added where x is the disk number you see in list disk
- list volume
- select volume a {where a is the drive letter found in list volume}
- assign letter=x {where x is the correct drive letter}
- repeat for each volume, and if letters are already assigned then reassign those first
- open each drive and check the file in the root created before upgrade that says what drive letter the disk is and ensure everything matches
- in Hyper-V Management Console right-click the server name and Import a Virtual Machine
- browse to the folder that you have the virtual machine configuration stored in and click Next
- select the correct virtual machine if you have more than one
- choose Register the virtual machine in-place (this will take all the previous settings and add the guest to this host)
- choose the location of the VHD files. If you moved everything to the same location before upgrade then browse to the current path otherwise browse to where you recorded that the VHD files where kept.
- start the virtual machine
- if you did not restore your virtual switch settings then you will be prompted for the network settings, and the guest machines will pick up a DHCP address. If you have static IP addresses then you need to boot the machines (domain controllers and DNS servers first) and reset the IP's back to what they were before the upgrade
On the other hand, you could do what was recommended above and just move the virtual machine to a different host!