Best Practices for running Linux on Hyper-V
Updated: October 21, 2014
Applies To: Hyper-V Server 2012, Hyper-V Server 2012 R2, Microsoft Hyper-V Server Technical Preview, Windows 10 Technical Preview, Windows 8, Windows 8.1, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview
This document contains a list of recommendations for running Linux virtual machine on Hyper-V.
Linux virtual machines that will be deployed using failover clustering should be configured with a static media access control (MAC) address for each virtual network adapter. In some versions of Linux, the networking configuration may be lost after failover because a new MAC address is assigned to the virtual network adapter. To avoid losing the network configuration, ensure that each virtual network adapter has a static MAC address. You can configure the MAC address by editing the settings of the virtual machine in Hyper-V Manager or Failover Cluster Manager.
Configure and use the virtual Ethernet adapter, which is a Hyper-V-specific network card with enhanced performance. If both legacy and Hyper-V-specific network adapters are attached to a virtual machine, the network names in the output of ifconfig –a might show random values such as _tmp12000801310. To avoid this issue, remove all legacy network adapters when using Hyper-V-specific network adapters in a Linux virtual machine.
The Linux kernel has four different I/O schedulers to reorder requests with different algorithms. NOOP is a first-in first-out queue that passes the schedule decision to be made by the hypervisor. It is recommended to use NOOP as the scheduler when running Linux virtual machine on Hyper-V. To change the scheduler for a specific device, in the boot loader’s configuration (/etc/grub.conf, for example), add elevator=noop to the kernel parameters, and then restart.
Linux virtual machines configured to use more than 7 virtual processors should add numa=off to the GRUB boot.cfg to work around a known issue in the 2.6.x Linux kernels. Linux virtual machines configured to use more than 30 GB RAM should also add numa=off to the GRUB boot.cfg.
In case the dump capture kernel ends up with a panic on boot, reserve more memory for the kernel. For example, change the parameter crashkernel=384M-:128M to crashkernel=384M-:256M in the Ubuntu grub configuration file.