How to run Debian on Hyper-V

How to run Debian on Hyper-V

Running a Linux distribution, such as Debian, in a virtual machine on Microsoft Hyper-V is really quite easy now that Linux Integration Services (LIS) has been added to the Linux kernel. Linux Integration Services provides Hyper-V specific drivers for network, video and storage devices, as well as providing Hyper-V services like time synchronisation and guest shutdown.

Create Virtual Machine

There are two specific configuration options required when creating a new Hyper-V Generation 2 virtual machine to run Debian:

  • Secure boot must be disabled, as it is not currently supported by Debian; and
  • Dynamic Memory should be disabled, as the version of Linux Integration Services (LIS) included with Debian does not currently support dynamic memory allocation.

Otherwise, virtual machine sizing (processors, memory, storage, etc) can be as per the Debian System Requirements.

There are two methods of creating a new virtual machine; Hyper-V Manager using a simple wizard-based interface, and Windows PowerShell using an advanced and scriptable command-line interface.

Hyper-V Manager
Windows PowerShell

Install Debian

Once a new virtual machine has been created, Debian can be installed normally – either over the Internet, or from the ISO media.

Virtual Machine Connection: Debian Installer Menu

Virtual Machine Connection: Debian Installer Menu

When the installation is complete, log in as the root user.

Graphical Desktop
Console

Microsoft recommends using the NOOP scheduler for best disk I/O performance. To change the scheduler in Debian, the elevator=noop instruction needs to be added to kernel parameters line in the grub configuration file. The line will appear similar to the following:

GRUB_CMDLINE_LINUX_DEFAULT="quiet elevator=noop"

To make this change, run the following commands from a terminal console or command line:

sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/ s/^\(.*\)\("\)/\1 elevator=noop\2/' /etc/default/grub
update-grub

The virtual machine must be rebooted before this change to the scheduler will take affect.

1 comment

Leave a Reply