A few notes on best practices regarding [http://qemu.org|qemu] or the (still) standalone [http://linux-kvm.org|kvm].
The default CPU emulated by qemu is meant to be as compatible as possible.
This has the drawback that certain, possibly useable features of the host
system's CPU will not be available for the guest to use. So when there is no
need to migrate between host CPUs of different type, one can enable all
possible features by use of the -cpu
parameter:
-cpu host
Especially useful for mouse-based OS, when emulating a USB tablet device as mouse pointer, qemu doesn't need to grab mouse and keyboard for clicks to work. In order to do so, add these parameters to the qemu commandline:
-usb -usbdevice tablet
This works out of the box at least with windows xp.
Best performance for guest network and storage is reached using VirtIO for both. KVM only!
The host system's kernel needs some options being set for VirtIO. Networking
support needs CONFIG_VHOST_NET
, storage support seems to do well with just
CONFIG_VIRTIO
.
As usual, Windows needs some drivers first. Best get the ISO here or the original ZIP files here.
Installing the VirtIO NIC driver is quite straight-forward, as that can be done at any time as long as a VirtIO NIC is being enabled via qemu commandline. Moving an existing installation to using VirtIO as the system storage backend is not as trivial due to the henn-egg-problem of having to boot Windows from a disk it has no driver for in order to install the later one. The trick is to boot with a secondary (dummy) disk which uses VirtIO only to install the driver for it, then switching the system storage backend afterwards. Summing all up, boot the existing windows installation about like that:
kvm -cdrom NetKVM-and-viostor.iso \ -drive file=/dev/mapper/lvg-windows,cache=none \ -drive file=/tmp/dummy,cache=none,if=virtio \ -net nic,model=virtio -net tap -boot c