Skip to content

Creating VMware Virtual Machine Templates for Microsoft Operating Systems

May 4, 2012

On a recent VMware implementation, I was tasked with creating several virtual machine templates for an enterprise customer.  During the initial phase of the implementation the customer would be running on a skeleton virtual infrastructure with just enough equipment to host the several virtual machines that they plan on deploying.  There are several small changes that can be made to virtual machine templates that can help reduce overhead of the virtual machines you create within your virtual infrastructure to can help optimize CPU, Memory, and Disk usage.

The easiest way to conserve ESXi host resources is to right-size your virtual machines.  When you use the Create New Virtual Machine wizard, VMware provides default recommendations for the number of CPUs and Memory for the Guest OS.  As an example, VMware recommends 1 vCPU and 4096 MB of memory for a Windows Server 2012 (64-bit) Guest OS. Increasing these recommendations requires additional overhead to run the virtual machine, here is an example of the amount of overhead that is required.  If the applications that you intend on running on your virtual machine don’t require additional CPU and Memory resources, stick with the defaults and monitor the performance of the virtual machine.

The table below provides a sample of memory overhead values and does not attempt to provide information about all possible configurations.
Memory (MB) 1 vCPU 2 vCPUs 4 vCPUs 8 vCPUs
256 20.29 24.28 32.23 48.16
1024 25.90 29.91 37.86 53.82
4096 48.64 52.72 60.67 76.78
16384 139.62 143.98 151.93 168.60
Once you have created your virtual machine disable logging for the Guest Operating System, it can always be enabled if required for troubleshooting at a later date.  To disable see Disable Logging for the Guest Operating System

Next disable unncessary hardware such as the Serial Ports, Parallel Port, and the Floppy disk controller.  See VMware Knowledge Base Article Disabling COM and LPT from the Virtual Machine BIOS (1737)

Disk alignment is often overlooked when virtual machines are created even though just about every storage vendor has published a whitepaper on the topic.  Cormac Hogan consolidated several of the vendor documents in the bottom of his VMware bLOG article Guest OS Partition Alignment.  IBM was one of the first vendors to post information on the topic in their Technical report: Storage Block Alignment with VMware Virtual Infrastructure and IBM System Storage N series.  Alignment is typically done prior to installing the operating system by attaching a .VMDK file to a virtual machine you have already created and using the diskpart utility.  However 3rd party vendors such as EMC, DELL/Quest, and NetApp provide post installation alignment tools that can be used with your existing virtual machines.  See Nicholas Weaver’s UBERAlign, DELL/Quest’s vOptimizer Pro, or NetApp’s mbralign.

Once the disk has been aligned, install the Operating System and VMware Tools.

After installing the OS and VMware Tools begin customizing the Guest Operating System.  VMware’s Matthew Honigford created the presentation “Golden Master” Best Practices with View back in 2009 and I have found it to be one of the most comprehensive documents on Windows OS Optimization recommendations.

If you don’t have time to apply all of the recommendations above, at least consider disabling screen savers which can turn idle virtual machines into heavy CPU consumers. Don’t forget the logon screen saver 😉  See Disabling the Windows Logon Screen Saver (9275881)

Remember that making these changes when creating your Templates will ensure that all future virtual machines created from the Template are optimized.  There are several tools available today that can help you automate these changes.  Take a look at the VDI Optimizer .vbs script created by Richard Smith here Optimising Windows 7 Images for use in VDI and the The FREE Quest vWorkspace Desktop Optimizer

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: