Install Windows Server 2008 on KVM/VirtIO

An example how to install a Windows Server 2008 guest on KVM with VirtIO (on a LVM volume in the example). Besides the installation medium you need the VirtIO drivers for windows in order to be able to access the disk device. You can get signed binary drivers here. Then set up a Windows VM with a command like this:

$ virt-install --connect qemu:///system --arch=x86_64 -n win2k8 -r 1024 --vcpus=2 
--disk pool=vmstore,size=50,bus=virtio,cache=none -c /path/to/win2k8.iso --vnc 
--noautoconsole --os-type windows --os-variant win2k8 --network network=subnet,model=e1000 
--disk path=/path/to/virtio-win-1.1.16.iso,device=cdrom,perms=ro

When the guest is running, shut it down and edit the os section of the XML file to look like this (otherwise Windows setup won’t let you install on the disk):

$ virsh destroy win2k8
$ virsh edit win2k8

Change the XML as follows:

<os>
  ...
  <boot dev='cdrom'/>
  <boot dev='hd'/>
</os>

Start the guest again:

$ virsh start win2k8

Connect to the VNC console and start the installation process. When you reach the form to select a disk device you won’t see any devices available. Click on “Load drivers” at the bottom left and load the drivers from E:\viostor\wlh{amd64|x86}. After the drivers are installed, you’ll see a disk device and can continue with the installation.

Sources

  • http://profiles.google.com/yasirdrabu Yasir Drabu

    Thanks for this. However, I already have Win 2008 KVM guest on Ubuntu. I did get the ISO, but am not sure how to convert the Disk and Network to use VirtIO drivers. Any help would be appreciated. What kind of performance/throughput improvement did you see?

    • http://ailoo.net Mathias

      Hmm maybe you could try to follow the steps needed for physical machines when changing hardware like the motherboard, and additionally install the VirtIO drivers before you change KVM’s settings. I used VirtIO just for the Disk, though.

      I didn’t do any benchmarks as it’s only a development machine I host for SQL Server, but it feels quite snappy with 1GB RAM and 2 VCPUs.