Thursday, December 16, 2010

VMware View, VDI, Windows XP Pro optimization

I have to do a fairly big VDI installation and I wanted to make sure I did all I could to optimize the Windows XP template that is going to be used.

In order to make the performance the best it can be, you need to:

  • Align the guest OS disks on a 64k boundary
  • Use 32K cluster sizes when formatting the disk.

However, you can’t do either by default when installing Windows XP. By the way, this is not an issue when installing a Windows 7 machine as it correctly aligns the disk during installation.

Why is alignment important?  Read this: http://www.yellow-bricks.com/2010/04/08/aligning-your-vms-virtual-harddisks/

The short answer is that if the disks aren’t aligned, some sectors will cross sectors that wouldn’t have to if they were aligned and this causes extra disk access in order to read that sector. Depending on your application, you could get up to a 30% improvement in performance.

With regard to 32K cluster sizes, I have found that Windows XP under VMware vSphere has better performance using this cluster size….but test for yourself.

One annoying thing is that you cannot boot from a partition that has 32K Cluster sizes on Windows XP.  What you have to do is create a small 100 MB (yes megabyte) partition that has standard 4k cluster sizes and then a 2nd larger partition of whatever size you like that has 32k cluster sizes. During the installation, pick the larger partition to install onto. The installer will automatically use the smaller disk as the “boot” partition, but Windows will be installed onto the larger disk. As a side effect, you will end up with your main drive being D: instead of C:. If this is a problem for you, then forego changing the cluster sizes and just do the disk alignment.

In order to do both these tasks in one go, the simplest solution is to create a new VM for use with Windows XP. ESX will create a IDE disk by default – you don’t want this as you cannot resize a IDE disk. Also, the SCSI driver will outperform the IDE driver. So…after you have created the VM, go back into the settings for the VM, delete the hard disk and then add a new one. Choose SCSI and change the type to be LSI Parallel. Save your changes.

Now….use a Windows 2008 VM and add a new hard disk….add an existing disk and choose the hard disk that you just created in the step above (the Windows XP disk). It will now become a new extra disk on the Windows 2008 VM. We will now use the Windows 2008 VM to partition and align the disk correctly.

First, open a command prompt in the Windows 2008 VM. Type in diskpart

If you want to only do the alignment, and not the 32K cluster size fix, then skip this first step and only perform the “2nd partition” command below. Then LIST DISK and then SELECT DISK 1 (or whatever number the correct disk is). Next, type create partition primary size=100 align=64

You just created the 100 MB “boot” partition. Make sure you have the right disk selected or you will destroy your Windows 2008 VM disk.

Now type: create partition primary align=64

You have now created a 2nd partition that uses up all the rest of the space.

Now use the Disk management tools in Windows 2008 to format both partitions – make sure to use a 4K cluster size (the default) on the 100 MB partition. Then use the 32K cluster size on the larger disk if you want to use that option, or the 4K cluster size if you don’t.

Detach the disk from the Windows 2008 VM and power on the Windows XP VM with a installation ISO attached to the CDROM. Make sure you press F6 during the boot and use the LSI.FLP image in the floppy drive for the LSI Driver. When you get to the part where it asks you about the hard disk, choose the option to leave the filesystem intact (no changes) and choose to install on the larger disk.

That’s it! You now have a properly aligned Windows XP template with 32K cluster sizes for optimal performance.

Enjoy!

Jim

1 comment:

falsehope said...

Worked like a charm. I was thinking about doing this exact thing when I ran across your post.

Followed it, no issues!

Thanks!!! So Easy!