Hyper-V Lessons Learned

The past several weeks have been rather hectic and busy. Between work and studying for my Citrix XenServer certification, there’s been a whole lot going on. Virtualization has long been been a passion of mine in the world of IT, and I am certainly getting hands on with lots of virtualization platforms these days (tis one of the many benefits of working for a managed service provider). I have recently been working on a VMware to Hyper-V migration project and have come across a number of interesting gotchas that I figure would be useful to others going through the same process. Some of these lessons range from NTP with Linux, to troubleshooting cluster connectivity, the migration process itself, and some other fun gotchas.

The Conversion Process Itself

Converting virtual machines from VMware to Hyper-V has become and incredibly simple process. First of all on one of your Hyper-V hosts download and install the Microsoft Virtual Machine Convertor (https://www.microsoft.com/en-us/download/details.aspx?id=42497). Once this is downloaded, there is a simple wizard in which you can choose to do a P2V or V2V conversion to either Azure or Hyper-V. From there it is simply a matter of specifying the hostname of the Hyper-V host that will be the destination for the VM, choosing where to store the virtual disk, as well as whether you want fixed disk or dynamically expanding, and VHD or VHDX. At this point the final step is to put in the information from your vCenter server, choose the VM to migrate (powered off beforehand), and follow the wizard to victory. The mechanism by which the conversion takes place is that VMware will export the virtual machine in OVF format, which will then be copied into the Hyper-V workspace and imported into Hyper-V. It’s actually a fairly slick process, however it is time consuming and there are definitely some gotchas. For one the NICs added during the migration process that replace the VMware virtual adapters will be identified as different interfaces on Windows machines so static IPs will have to be re-entered. This is not the case for Linux, as the interfaces file stores the static IP config and there are no issues I have run into during the conversion process with Linux NICs.

Licensing Your Hyper-V Hosts

If you are a primarily a Windows based shop running 2012 R2, I highly recommend setting your Hyper-V hosts up with Datacenter licensing. The Datacenter license covers up to CPU sockets with unlimited VMs on the same hardware. One of the wonderful features of this is that it allows for AVMA or automatic virtual machine activation. Meaning that instead of activating each VM to MS activation servers, you are actually able to activate them to the VM host with Datacenter licensing. Per the following technet article you can activate using an AVMA key (provided in the article) to activate Datacenter, Standard, and Essentials licenses to the host. https://technet.microsoft.com/en-us/library/dn303421.aspx

The activation syntax must be run from an elevated command prompt with the following syntax:

slmgr /ipk <AVMA key>

For this functionality to work, you will also need to ensure that Data Exchange is enabled in the Integration Services for the VM (this is the default behavior)

 

NTP Issues For Linux VMs

I learned the hard way after migrating Linux VMs to Hyper-V that one of the default integration services is time synchronization with the host. I had assumed that NTP would override this behavior but I assumed incorrectly. In VMware when you create a VM if you choose a Linux OS profile it actually turns off this time sync behavior, however in Hyper-V there are not OS specific defaults for hardware, so this feature is on by default all the time for all hosts. If the linux host is running Ubuntu 14 or newer, Debian 8, or Centos/RHEL 7 (really anything that uses systemd) you can run the command timedatectl to see if NTP is running and if it is synchronizing. I found that NTP would not sync if time sync was enabled in the integration services for the VM. To avoid countless annoying Nagios emails about NTP drive I simply chose to disable this functionality in the interest of consistent time and less email.

ntp sync no

 

NTP not synchronized due to time synchronization integration services being enabled.

time sync setting

 

Uncheck the Time Synchronization Options to corret

ntp sync yes

 

NTP synchronized switches to yes after making changes to integration services

Converting Windows VMs with Multiple Disks

One of the more obscure things I have discovered with migrating from Vmware to Hyper-V is that windows VMs with multiple disks import both disks properly and both show in the settings for the VM, however in the OS the additional disks are not enabled by default. To remedy this you simply need to go into disk management (diskmgmt.msc) and right click the disk and choose to bring it online. Once this is complete the disks will show properly.

Drive Cloning With CloneZilla

We’ve all had that moment in time when we realized we were out of space and needed a bigger drive. I don’ think this has ever been more true than the past 2-3 years as SSD performance has caused many of us to switch to smaller high performance drives. With the price of storage rapidly decreasing and larger SSDs becoming more affordable it’s become rather attractive to move to a larger driver, but not many of us want to go through the pain of reinstalling our OS from scratch. Older tools like Ghost and commercial solutions can have annoying licensing terms, funky quirks, or just aren’t really an accessible option. I’ve personally found great success in using clonezilla to clone hard drives and figured I would create a quick tutorial to illustrate just how easy it is to clone a driver with clonezilla.

 

Step 1: Gather The Prerequisites

To successfully clone your drive with Clonezilla you will need the following:

  • The clonezilla ISO from  http://clonezilla.org/downloads/download.php?branch=stable
    • choose the appropriate architecture (this will be AMD64 for most of you) and ISO as the file type
  • A USB drive 4GB should be sufficient
  • Pendrive Linux Universal Installer from http://pendrivelinux.com
  • A USB to SATA converter (something along these lines: http://www.amazon.com/Patuoxun-Converter-Adapter-Cable-Drive/dp/B008ASF5MC/ref=sr_1_4?s=electronics&ie=UTF8&qid=1430442966&sr=1-4&keywords=usb+to+sata)
    • Some newer devices use mSATA drives not regular SATA drives. Please double check this so that you can buy the appropriate drive and drive adapter for your device.

A larger hard drive than what is currently in your machine

Step 2: Create a Bootable USB

  • Insert your USB stick you will choose to use for clonezilla (please be aware that installing this will format the USB drive and will clear any information currently on it.
  • Open the Universal USB Installer you downloaded from pendrivelinux.com
  • Choose clonzilla in step one of the USB creator, browse to the ISO you downloaded for step 2, and select your flash drive for step 3, then press create

create usb

 

Once the live USB creation process has completed, you can unplug the USB drive from your computer and plug it into the machine you are going to be cloning.

Step 3: Boot Your PC From USB

Once the USB is plugged into the machine we will be cloning, you will want to also plug in your USB to SATA converter with your new hard drive attached. After this you can power on the machine (if the computer is currently running shut it down). Upon boot choose the boot menu, this will vary by manufacturer but is typically F11 or F12 on most devices. If this fails you can alternatively try ESC or DEL to boot into the BIOS and change the boot order to start from USB. If your machine boots properly from the live USB, you should see the following screen, if so, proceed to the next step.

czmain

Step 4: Proceed Through Clonezilla Menus & Start Clone

  • From the menu screen shown above, choose the Clonezilla Live options (this should be the first option).
  • After a black and white window of scrolling text goes by, you will be placed on a blue screen with a language selection box, choose your language
  • Next you will be prompted about keymap, choose the default option to not touch keymap

keymap

  • On the next screen choose start clonezilla

startcz

 

  • Choose device to device for cloning options

d2d

 

  • Choose beginner mode
  • Choose disk to local disk in the next option

d to ld

 

  • Choose your old hard drive as the source (this will typically be the smaller drive that’s larger than the flash drive you’re using)

source

 

  • Choose the destination (this should be the largest drive in the list)
  • Choose the skip checking/repairing option
  • Press Enter
  • When the warning message pops up, make sure it shows the larger drive you’re cloning to, press y followed by enter

warn

 

  • When you receive the second warning prompt press y and hit enter again
  • Next you’ll be asked if you want to clone the bootloader, press y and hit enter

clone bl

 

  • At this point partclone will run a few assessments and then begin cloning your drive. This will take some time depending on the speed of the drives and whether your using USB 2.0 or 3.0 with your USB to SATA adapter.

partclone

 

  • Once the drive cloning process is complete a few checks will be run and you will see the screen below. Press enter

done

 

  • Choose Poweroff and wait for your machine to turn off

poweroff

Step 5: Remove The Old Drive, Install the New Drive

  • Now that drive cloning has completed, you can safely remove the Clonezilla USB and the USB to SATA converter
  • Remove your old hard drive and replace it with the newly cloned drive
  • Power on and proceed to the next step

Step 6: Expand the Partition in Windows

Once your machine is powered on there is one final step we must take, which is to expand the partition. This will be done through the built in disk management tool in windows.

  • Press the windows key  and R to bring up the run box. Type diskmgmt.msc into the run box and press enter.
    • Alternatively you can type this into the search box on Windows 7 or on the start screen search in Windows 8/8.1
  • You should see your C drive followed by unallocated space

unallocated

  • Right click the C drive (portion in blue above) and choose extend volume, then click through the wizard with the defaults. Now you should see the C drive has been extended

finished

  • With that ladies and gents we are done!

 

Thank you for checking out this blog post, I will likely create a video to demonstrate this process in the near future. In the meantime please feel free to leave any questions or comments.