[KVM] Installing Virtio drivers in a KVM Windows guest VM

KVM provides a Virtio interface for the virtual hard disk and NIC. To use them in a Windows guest VM, the drivers from Fedora (you only need the ISO file) must first be installed into Windows. To install them in a Windows guest VM, it must also be started with these interfaces so that Windows can detect them. While the Windows guest could be started with the Virtio NIC without any problems, we can not start with the Windows image (i.e. the virtual hard disk image where Windows is installed on your guest VM) using the Virtio hard disk interface (until the driver is installed, Windows will not know how to use the Virtio hard disk interface). The easiest solution to this problem is to create another virtual disk that can use Virtio:

qemu-img create -f qcow2 <image name> <size>

Now, start the Windows VM with the Virtio interfaces:

qemu-kvm \
    -hda <path to your Windows guest image> \
    -drive file=<your guest image file>,if=virtio \
    -drive file=<path to Virtio driver ISO>,media=cdrom,index=1 \
    -net nic,model=virtio \
    -net user \
    -boot d \
    -vga std \
    -m 1024

When Windows is loaded in your guest VM, go in to the Device Manager. Under Other Devices, there should be two entries – one for the SCSI controller to the the temporary virtual hard drive and the other for the Virtio network card.

On one of the items, right click on it and select Properties, go to the Driver tab. You should now see the following:

Click on Update Driver. In the next dialog, choose to specify a location and install the Red Hat Virtio drivers. The dialogs for installing the drivers will vary, depending on the installed version of Windows. It should be fairly easy to work how to install the drivers, but installing the drivers for Windows 7 and Windows XP are here if you need them ( skip to instructions for Windows 7).

Installing the Drivers on Windows XP

For Windows XP, choose Install from a list or specific location on the first prompt.

On the next set of options, choose Search for the best driver in these locations and ensure that Search removable media is ticked and click on Next again.

When installing the hard disk controller, you might be prompted, at this point, to choose a driver. At this point, choose the one in the wxp directory.

Eventually, you will probably be warned that you are installing an unsigned driver. Select Continue Anyway to install the driver.

When installation is complete, you should get a confirmation, similar to the following:

After repeating the steps for the other driver, you use the Virtio interface on your Windows hard disk image (see After Installing the Drivers…).


Installing the Drivers on Windows 7

For Windows 7, choose Browse my computer for driver software.

On the next screen, choose the drive for your CDROM. You should be able to let Windows search the CD for the drive.

When prompted, confirm that you want to install the driver.

There will be a confirmation that the driver was installed, similar to this one:

Close the dialog and repeat the steps for the other driver.


After Installing the Drivers…

After both drivers are installed, the device manager should contain a Red Hat VirtIO device for the SCSI controller and another one for the ethernet adapter.

Next time you start the guest VM, you can use the Virtio interface for the Windows image:

qemu-kvm \
    -drive file=<path to your Windows guest image>,if=virtio \
    -net nic,model=virtio \
    -net user \
    -vga std \
    -m 1024 

Your Windows VM is now using the Virtio interfaces for your Windows virtual hard drive and NIC. If you wish to know more about Virtio and how it works, I suggest having a read of the article Virtio: An I/O virtualization framework for Linux.

About these ads

6 Responses to [KVM] Installing Virtio drivers in a KVM Windows guest VM

  1. Pingback: Instalar un guest windows en KVM con virtio drivers | Gonzalo Marcote | Open source, open mind

  2. Fashion says:

    thank you for guidance install drivers on my windows.

  3. Popi says:

    Thank you so much! I’ve been looking for a simple and clear tutorial like this one for ages!

    Keep up the good work!

  4. Pingback: Installing VirtIO drivers for Windows Guest VM on KVM host … | Ian Works Here

  5. Mayur says:

    Thanks you for this article. It was very useful.

  6. Jobin says:

    Hi, thanks for the informative blog. However, I am not able to understand what the parameter should be for the first “-drive” option in

    qemu-kvm \
    -hda \
    -drive file=,if=virtio \
    -drive file=,media=cdrom,index=1 \
    -net nic,model=virtio \
    -net user \
    -boot d \
    -vga std \
    -m 1024

    I have an image file create using the “qemu-img” command, so I am using that as the parameter to “-hda”. So are the parameters to “-hda” and the first “-drive” the same?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: