How to Create VMware TemplatesBy Petra Jorgenson
VMware vCenter Server allows you to create templates from existing virtual machines. You can use templates to reduce the amount of time spent building and implementing new servers, cutting down the provisioning process to just a few hours.
vCenter Server uses one of two methods to build templates. The first method, Clone to Template, duplicates a virtual machine and changes it to the template format. Unlike Convert to Template, which I’ll cover in just a moment, Clone to Template leaves the original virtual machine intact.
During the cloning process, you’ll have the option to change the format of the virtual disk(s). You can either configure the disk to fill all of the space in the datastore (thus enabling the template to maintain the same level of performance as the source VM), or use the thin provisioned format to compress the disk space so that the template uses only as much of the datastore as it needs.
Of course, when vCenter clones the source virtual machine, it doesn’t just duplicate the virtual disks, but also creates a copy of the .vmx file. The .vmx file holds the data used to configure the VM. Thus, before you run Clone to Template, you should remove any unwanted settings from the .vmx file associated with the source VM.
Convert to Template, the other method used to create templates in vCenter, is much faster than Clone to Template, because it doesn’t create a duplicate of the source VM; instead, it just changes the VM to the template format. Convert to Template is more flexible than Clone to Template because you can change the template back to a virtual machine at any time. For example, software installed to templates created through Clone to Template can’t be updated. With Convert to Template, however, you can temporarily change the template to a virtual machine and install updates to the software, then change the VM back to template when done.
Preparing for Template Creation
Before creating a template in vCenter, you’ll need to install Sysprep to VMware if you intend to clone or convert Windows-based virtual machines. Each release of Windows (including service packs) requires its own version of Sysprep; you can find the appropriate files on the operating system CD/DVD or on the Microsoft Download Center website. Find and double-click deploy.cab, and then extract the contents of the compressed file to the following location: %allusersprofile%\vmware\vmware virtualcenter\sysprep
If you’re running Windows Server 2003 or below, extract the contents to: %allusersprofile%\application data\vmware\vmware virtualcenter\sysprep
There are also a few things to keep in mind before you create your source virtual machine (the virtual machine on which the template will be based). Components like Active Directory and Microsoft SQL Server should be excluded from the template, as these can interfere with the template creation process or cause problems after the fact. Also, if you’re running VMware Infrastructure 3.5 or later, you can perform a hot clone of a virtual machine using the Clone to Template method. Hot cloning enables you to keep the source VM active during the cloning and conversion process.
Once you’ve installed Sysprep and created the source virtual machine, you can begin building templates.
Creating a Template with Clone to Template
1. Right-click the source virtual machine. Point to “Template,” then select “Clone to Template” from the context menu.
2. Create a name for the template and then choose an Inventory location from the folder list. Click “Next.”
3. Select the ESX host or cluster where the template should be stored. Click “Next.”
4. Select a datastore with enough available space to accommodate the template. Click “Next.”
5. Click “Same as Source” to use the same disk format as the source VM; click “Thin Provisioned” to save space on the datastore; click “Thick” to reserve all of the datastore space for the virtual hard disk. If you select “Thin Provisioned,” make sure to allocate the virtual disk to a VMFS3+ datastore. Click “Next.”
6. Review your selections on the Ready to Complete screen. Click “Finish” to create the new template in VMware vCenter Server.
Create a Template with Convert to Template
1. Power off the source VM. Right-click the virtual machine, and then point to “Template.”
2. Click “Convert to Template.” Select “Home.” Go to VMs and Templates view to locate the new template.
3. Right-click the template and then click “Convert to Virtual Machine” to return the template to its original state whenever necessary.
You can also create new templates from existing templates. Right-click the source template and then click “Clone” to begin the duplication process. The steps in the wizard are identical to those in Clone to Template.
Create a Virtual Machine from a Template
After you finish creating a template, you can run the Deploy Template Wizard to create a new virtual machine.
1. Switch to VM and Templates view. Right-click the template and select “Deploy Virtual Machine from This Template” from the context menu.
2. Name the virtual machine and select a folder location. Click “Next.”
3. Select the ESX host and/or cluster on which the VM will run. Click “Next.”
4. Choose which resource pool the new virtual machine will use. Click “Next.”
5. Select which datastore or datastores will accommodate the virtual machine. Click “Next.”
6. Choose the appropriate disk format and then click “Next.”
7. Click “Do Not Customize,” “Customize Using the Customization Wizard,” or “Customize Using an Existing Customization Specification,” depending on your preferences. You won’t see this screen if you didn’t load Sysprep into vCenter. If you selected the second or third option, follow the on-screen instructions to configure the template.
(Note: If the OS installed to the source virtual machine requires an OEM product code, select option two and then enter the information into the appropriate field when prompted.)
8. Click “Edit Virtual Hardware” to make changes to the VM configuration, if necessary. Click “Finish” to deploy the new virtual machine.
About the Author
Petra Jorgenson is a professional writer with over six years of IT experience. She specializes in computer architecture, operating systems, networking, virtualization and web design. She has written support documentation for a leading BSS/OSS system and has over 100 published articles addressing a multitude of technology-related topics. Jorgenson is working on obtaining her MCITP certification.
- How to Create Users and User Templates in Windows Server 2008 Active Directory
- How to Create a Team in VMware Workstation
- How to Create a New Virtual Machine with Hyper-V
- VMware Server: Creating a Virtual Machine
- How to Use VMware’s Virtual Disk Manager
- New course: T4 Templates
- How to Use VMware Player for Training, Testing and More
- How Do I Create and Mount a VHD in Windows 7
- How to Install VMware ESX Server
- Working with the VMware Tools