Windows XP Guest Notes
This page is a collection of notes for configuring and performance tuning Windows XP guest virtual machines.
IMPORTANT: I've tried to be as accurate as possible, but I'm doing a "brain dump" very quickly. Use these notes at your own risk and always take backups of your VM's before attempting any system level modifications like these.
Use VirtIO Drivers
When you build an XP guest VM, chances are you use the IDE driver to get up and running right away. The IDE driver works OK for locally stored VMs, but performance will degrade significantly when accessing disk files over the network. Below are (rough) steps to switching to the Red Hat virtio drivers in a Windows XP guest.
- Build your Windows XP VM using the IDE disk driver and the rtl8139 NIC driver. These are both recognized by default on Windows XP.
- Boot the XP VM and verify that Internet access works.
- Download and install wincdemu inside the XP guest.
- Download the latest virtio-win iso from Fedora's server into the Windows XP VM.
- Note: It's a good idea to leave this iso stored inside your VM. You may need it outside of this original setup.
- Shut down the XP VM.
- In the Proxmox web admin, click on the VM, and then on it's Hardware tab.
- Add an ethernet device, and select virtio as the model.
- Add a hard disk, select qcow2 (faster creation than raw) as the format and virtio as the bus.
- Boot into the XP VM.
- The "found new hardware wizard" should appear. Leave this window open, you need to mount the virtio driver iso first.
- Locate the virtio iso, right-click on it and click Select drive letter & mount. It defaults to the V: drive - click OK.
- Go back to the "found new hardware wizard". Click next and verify its looking for the ethernet controller. Point the drivers to V:\NetKVM\XP\<arch> (where <arch> is either amd64 or x86). Finish the driver installation, click Continue when asked if you want to install an unsigned driver.
- Go through the same process for the virtio scsi controller. Drivers are in V:\viostor\WXp\<arch> (it looks like only x86 is currently available, as of 2011-01-13).
- Shut down the XP VM.
- Delete the second (virtio) disk and remove it (it's not needed).
- Delete the primary IDE disk (doesn't actually delete it, it just removes it from being used by the VM).
- Add a new hard disk, and in the lower section, choose the original IDE disk file. Change the bus to virtio and save it.
- Boot the XP VM.
- You may be prompted to install the virtio storage driver again. Do so.
- Reboot the XP VM to ensure that your virtio drivers are working without issue.
- If you remove the realtek network adapter, you may be prompted to reinstall the virtio network driver on reboot. Do so.
Shrinking Qcow2 Disk Files
Over time the *.qcow2 disk files can grow larger than the actual data stored within them. This can also happen faster if you defragment the drives within the XP VM itself. In order to shrink the *.qcow2 files, you'll need to zero out all free space of the drives within the XP VM first. Below are (very rough) notes on how to do this:
- Download and install the latest Eraser inside the XP VM.
- Load Eraser.
- Edit main settings. Change default file erasure and unused space erasure methods to British HMG IS5 (Baseline) (1 pass). This will zero out space instead of using random data.
- Create a new job under Erase Schedule and add the free space from the C:\ drive (and any other drive you want to shrink).
- Run the job.
- Note: I've had Eraser crash during this process. If this happens, it will leave a directory under the root of your drive with all sorts of random data in it. You'll want to delete this folder and start the process again. Keep running the process until it goes through without crashing. Hopefully the folks at Eraser are working on the stability of this new version.
- Shut down the VM.
- Log into the Proxmox shell and go to the VM's disk storage directory.
- Shrink the disk file:
- Note: These next two steps assume that source is your original disk and shrunk us the new shrunken disk. Change the file names to meet your needs.
qemu-img convert -c -O qcow2 source.qcow2 shrunk.qcow2
- Backup the original disk file and move the shrunken disk into its place:
mv source.qcow2 source-bak.qcow2 mv shrunk.qcow2 source.qcow2
- Boot your VM and verify all is working.
- When you verify all is well, it should be safe to either delete the backup of the original disk, or move it to an offline backup storage.