With Windows 2008, running Linux as guest OS on hyper-v was sometime difficult. If you wanted to install old version of Ubuntu or a Network Virtual Appliance like pfsense you had to use Emulated device and/or to manually load hyper-v driver. Performance was sometime poor.

It’s now part of History. In July 2009, Microsoft released Hyper-v drivers for Linux under GPLv2 license. There was 7 drivers vmbus, storvsc, blkvsc, netvsc,utils and timesource in Hyper-v 2008 R2, much more in Windows 2012 R2 and Windows 2016. Modern Linux version can now run in the same way as Windows Guest and offer performance near bare metal version.

Now most feature available in windows 2012 R2 as guest are available in the latest version of major linux distribution and some of FreeBds/Linux based network virtual appliance.

Secure boot, the anti-rootkit in generation 2 VM, work with Ubuntu 16 on Windows 2016 (you have to choose “MicrosoftUEFICertificateAuthority” as secure boot template).

Here the functions available in Linux and FreeBsd: https://technet.microsoft.com/fr-fr/library/dn531031.aspx

You can find more information about feature and Ubuntu: https://technet.microsoft.com/fr-fr/library/dn531029.aspx

Installing modern Linux OS on Hyper-V 2012 R2/2016 is as simple as installing Windows Server OS.

But there are some best practices to follows.

When using dynamic disk with windows, you may need to create the VHDX file in Powershell. You can use a 1 MB block size for the VHDX file (not the logical or physical sector size).

PS> New-VHD –Path x:\localion\VMLinux.vhdx –SizeBytes 80GB –Dynamic –BlockSizeBytes 1MB

Doing so will prevent the growing of the VHDX file because of the free space used in some Linux Filesystem. Inside a VM you should always use ext4 You should also change de way how Linux schedule I/O to first in first out to pass the schedule choice to the hypervisor.

$sudo nano /etc/default/grub

Change the line 



GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"


$sudo update-grub

And restart 

You will need to modify the GRUB menu too if the VM has more 8 vcpu or more or more than 30 GB


$sudo nano /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop numa=off" /// Than /// $sudo update-grub ///

Also if you find that the resolution in the vconnect is too small for your need you can add this to the GRUB video=hyperv_fb:XXXxXXX

Don’t forget to update the GRUB and restart the server

If you had Linux VM into a hyper-v Cluster, you may need to use static MAC address. During fail over the new mac address can trigger network restart on the guest.

If you use Ubuntu LTS 14.04, 16.04 or 12.04 you can in update the kernel with the latest Hardware Enablement.

16.04 $sudo apt-get update $sudo apt-get install --install-recommends linux-virtual-lts-xenial

14.04 $sudo apt-get update $sudo apt-get install --install-recommends linux-virtual-lts-wily

12.04 $sudo apt-get update $sudo apt-get install --install-recommends linux-generic-lts-trusty

Then you need to add hyper-v daemons

16.04 $sudo apt-get install --install-recommends linux-tools-virtual-lts-xenial linux-cloud-tools-virtual-lts-xenial

14.04 $sudo apt-get install --install-recommends hv-kvp-daemon-init linux-tools-virtual-lts-wily linux-cloud-tools-virtual-lts-wily

12.04 $sudo apt-get install --install-recommends hv-kvp-daemon-init linux-tools-lts-trusty linux-cloud-tools-generic-lts-trusty

Rarely kernel update can do more arms than good. Last year in September, the Kernel triggered network and I/O problems.

hv_netvsc vmbus_0_12 eth0: unable to send receive completion pkt (tid XXXX)...retrying 4


Automation There are no sysprep equivalent in the linux world, so how it’s possible to spawn a VM without installing it from the DVDRom. There is a solution, most Linux distribution provides cloud image, OS image optimized for cloud hosting.

from Ubuntu http://cloud-images.ubuntu.com/xenial/

It’s possible to use this version with Hyper-V. Then you have cloud-init, a tool used in Open-Stack to enable cloud automation. In Hyper-v we can’t not use cloudinit as it’s used in Open-Stack. We need to relay on CDRom to enter information.

You can check this sample on GitHub


You just need to remember that the user in: password: $($GuestAdminPassword) is Ubuntu

You can setup the IP address for the server

instance-id: iid-abcdefg network-interfaces: | auto lo iface lo inet loopback

iface eth0 inet static address network netmask broadcast gateway 192.168.1O.1 hostname: MyServer