Configure Linux Kernel on Hyper-V Hosted VMs

Ubuntu (since 12.04) is supported as a guest virtual machine in Hyper-V. I used to run a separate KVM host server to run Linux VMs, but since Ubuntu (as well as CentOS since 6.4) can run under Hyper-V, I've switched to running just Hyper-V on the host. After the initial install of the OS, I run the following commands as noted on the Supported Ubuntu Virtual Machines page.

sudo apt-get update
sudo apt-get install -y --install-recommends linux-virtual
sudo apt-get install -y --install-recommends linux-tools-virtual linux-cloud-tools-virtual

Use I/O scheduler NOOP for better disk I/O performance. 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. In the console, enter the command: sudo nano /etc/default/grub. In the editor window, use the arrow keys to move the cursor to the line beginning with “GRUB_CMDLINE_LINUX_DEFAULT” then edit that line, adding elevator=noop to the text inside the double-quotes after the words “quiet splash” if present. Save the file and then close the editor window.

Then execute the following:

sudo update-grub
 
sudo reboot