Wednesday, March 2, 2011

FAST Win7 KVM VirtIO{Disk-Net} Install

Everyone who has to use Windows, please let's at least keep it contained inside a virtual machine! In this article I'll demo how to "Install Windows7 over Ubuntu 11.04 Natty, using KVM with System Disk over VirtIO". Quoting the libvirt wiki "Virtio is a Linux standard for network and disk device drivers where just the guest's device driver "knows" it is running in a virtual environment, and cooperates with the hypervisor. This enables guests to get high performance network and disk operations, and gives most of the performance benefits of paravirtualization"

Here's a little convenience script to download virtio Windows drivers and launch virt-install to Install Windows. Copy/Paste this script into an empty folder, chmod +x it, and run it.

#!/bin/sh
WINISO=/path/to/win7.iso    #Windows ISO
INSTALLDISK=win7virtio.img  #Disk location. Can be LVM LV
VFD=http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-1.1.16.vfd
DRVRISO=http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-1.1.16.iso

[ -e $(basename $VFD) ]     || wget $VFD
[ -e $(basename $DRVRISO) ] || wget $DRVRISO
[ -e $INSTALLDISK ]         || qemu-img create $INSTALLDISK 30G

sudo virt-install -c qemu:///system --virt-type kvm --name win7virtio --ram 1024 --disk path="$INSTALLDISK",bus=virtio \
--disk $(basename $VFD),device=floppy --os-variant win7 --cdrom $(basename $DRVRISO) --cdrom "$WINISO" --vcpus 2

et voila Windows installer kicks in, we're greeted with the usual

Screenshot-win7virtio - Virt Viewer
Screenshot-win7virtio - Virt Viewer-1
Next the welcome screen, and agree on the license agreement (if you want!)
Screenshot-win7virtio - Virt Viewer-2

In this next screenshot, we see how Windows Installer does not see any "disks". This is because Windows now does not have any drivers for the virtio disk that we attached!
Screenshot-win7virtio - Virt Viewer-3

Let's fix that, clicking "Load Driver" and clicking OK, Windows starts reading the VFD virtual floppy image we attached, and detects the driver
Screenshot-win7virtio - Virt Viewer-3
Screenshot-win7virtio - Virt Viewer-5
Clicking Next, Windows can now see the virtio disk
Screenshot-win7virtio - Virt Viewer-5
Then it's business like usual
Screenshot-win7virtio - Virt Viewer-7
After installation completes, be sure to check the device manager and confirm the disk (and network) are both using optimized virtio drivers
DeviceManager

et voila, Windows in its full glory running over optimized virtio drivers. The only part that sucks is desktop VNC performance, something that I'll probably write about very soon :)

8 comments:

Michael said...

Is this noticeably better than if you were to use Oracle VirtualBox? What is the graphics perfomance like/

Kamal said...

In theory, disk and network performance should be faster yes, but that's hard to prove. I booted the same installation under vbox, and frankly vbox was very fast as well. The graphics part is currently bad (vnc), we'd need to get spice working to get good performance. I'm working on that soon

Unknown said...

what oubout for thos who are using maverik ................????? can wee install it ...

Unknown said...

Hello to the community .... andbig thanks to u the great A.Kamal for ur posts

I wana know the procedures to integrate a new alphabet of a language in ubuntu (EU) OS.
Indeed we have created an alphabet to write our language (West African Fulani).
fonts files are ready. We use almost all Linux so it will be really great to be
able to easily write our language from a keyboard and will be a way for us to develope it fast.

Waiting for answer pls SOS .......

Penelope said...

Ibrahima, are you talking about wanting to translate Ubuntu into your language?

If so, the following links should help you get started:

https://wiki.ubuntu.com/Translations/
https://wiki.ubuntu.com/Translations/QuickStartGuide
https://wiki.ubuntu.com/Translations/KnowledgeBase/StartingTeam

Anonymous said...

Thanks for sharing this. virt-viewer needs to be installed BTW.

Unknown said...

Hi thanks for this blog entry very useful.

But on postinstall if the user updates windows the virtio drivers are lost and a manual installation is required, how can this be overcome ?

Unknown said...

Hi thanks for this blog entry very useful.

But on postinstall if the user updates windows the virtio drivers are lost and a manual installation is required, how can this be overcome ?