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.
A template is a master copy of a virtual machine that can be used to create and provision virtual machines. Templates cannot be powered on or edited, and are more difficult to alter than ordinary virtual machine. A template offers a more secure way of preserving a virtual machine configuration that you want to deploy many times.
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.
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. You will have three options to choose destination disk format
Same format as Source – Use the same disk format as the source VM
Thin Provisioned – To save space on the datastore
Thick – To reserve all of the datastore space for the virtual hard disk.
6. Also You can choose Storage Policy if required or choose default and Click Next
7. 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.