Saturday, March 28, 2009

Improving I/O performance in Windows XP virtual machines

This article applies to Windows XP running on VMware Workstation 6.5.1 but the information can be applied to other guest operating system such as Windows 2000 and other the other products in VMware family.

About VMware Workstation

VMware Workstation provides an ideal solution for testing new applications or operating systems at work or even home.

When a software company releases a new application, it tests it against all supported operating systems. In the past they used to have at least one physical computer for each operating system or combination of operating system and other software (Windows 2000, Windows XP Home with IE6, Windows XP Home with IE7, Windows XP Professional, etc). Resetting all these computers to the original configuration for a new set of tests was difficult and required many IT resources. Nowadays, in almost all software fields, the testing computers where replaced with virtual machines. Virtual machines are easier to deploy and maintain.

Home users usually take advantage of virtualization technology in various ways. Geeks use it for testing or running different OS simultaneous (eg. running Linux on top of Windows) without doing any change or interfering in any way with the host operating system. Other users use virtualization for setting up a secure environment in which they can browse unsafe sites or test new software without trashing the host OS. Since VMware Workstation virtualizes the hardware itself, the guest OS is completely isolated of the host OS without any interaction whatsoever.

Windows XP in VMware Workstation

VMware Workstation provides 2 major disk types that can be used by guest virtual machines: IDE and SCSI. If you choose SCSI, you’ll have to decide between LSI Logic and BusLogic. A detailed comparation of these 2 SCSI devices is found on VMware website. Please note that this is independent of your host hardware. You don’t need to have SCSI on your host to select SCSI for virtual machines.

VMware implementation for SCSI offers better I/O performance with less CPU resources utilized. In regard to SCSI, usually people prefer LSI Logic over BusLogic.
Anyway, if you try to create a new machine for hosting Windows XP, you’ll notice that VMware workstation wizard recommends you to use an IDE virtual harddrive for installing the guest operating system. The recommendation is not the same if you try to install Windows 2003 server as a guest. The reason is that, even if LSI Logic SCSI virtual harddrive offers better performance, Windows XP doesn’t has drivers for this type of device.


Updating an existing Windows XP virtual machine to use LSI Logic

Usually people that read this article, they already have existing Windows XP virtual machines. They just want to improve the I/O performance without spending too much time required by a full guest OS reinstallation.

First check using VMware VM configuration tool if you virtual machine uses IDE harddrives. If this is the case then follow the next instructions. If you already have SCSI devices, but Bus Logic, then you can still use these instructions but you can skip the step with cloning the harddrive.

Add a new hardware to the virtual machine: a SCSI drive of size at least equal to the IDE drive you want to replace. Do not remove the older drive.

Using notepad, edit the .vmx file and look for a line that looks like: scsi0.virtualDev = "vmxlsilogic" (you may have a different number instead of 0). If you don’t find that line, then add it (eg. after scsi0.present = "TRUE").

Power the virtual machine and log into guest Windows OS. Windows will tell you that a new device was detected and prompts you to install drivers for it.

Go to http://www.lsilogic.com and look for the LSI20320 SCSI adapter driver for Windows XP. Make sure you download the drivers for Windows, and not the drivers that you use during Windows installation (eg the WHQL 1.20.18.00 package should be fine).

Extract the drivers somewhere in the guest OS and install them.
If everything was correctly done, the guest Windows XP OS should be able to see the SCSI disk in Disk Manager tool.

Power off the machine.

Download Clonezilla live CD image. If you prefer you can use other cloning tools (eg. Ghost).

Edit virtual machine properties and make the virtual CDROM use the the Clonezilla CD image.

Boot the virtual machine and quickly press Esc or F2 in order to access the boot menu of the virtual system. Select from here the CD as the first boot device.

Once Clonezilla is loaded, go and issue a disk – to – disk clone operation: from the older IDE drive to the newly attached SCSI. Wait until cloning is finished.

Power off the machine and edit the configuration. Remove the IDE drive, leaving only the SCSI one and also dissociate the Clonezilla ISO from the virtual CDROM.

Boot the virtual machine.

Installing Windows XP with LSI Logic SCSI drives

Create a new virtual machine with LSI Logic controller and SCSI drives. Make sure you attach also a virtual floppy drive.

Download LSI Logic drivers from http://www.lsilogic.com (look for the LSI20320 SCSI adapter driver for Windows XP). Make sure you download the drivers that are used during Windows XP installation.

If the physical computer has a floppy drive or you have an USB one, just extract the drivers on a blank floppy, otherwise use a program such as WinImage to create a floppy image (.flp) where you’ll inject the unzipped downloaded drivers. If you don’t have WinImage, you can put the drivers on a .flp image from other virtual machine.

Associate the virtual floppy drive with either physical drive or the .flp image.

Power on the virtual machine and proceed to install Windows XP from the CD. Make sure the virtual machine boots from the CD and not from the attached floppy.

On the initial blue setup screens, when prompted, press F6 to select additional SCSI drivers.

Select the LSI Logic driver and continue installation normally.