Tip

Creating a VM clone for a virtual machine template

A VM clone is a complete duplicate of a particular virtual machine (VM) at that precise moment in time.

Cloning a virtual machine is not intended for backup, disaster

    Requires Free Membership to View

recovery (DR) or other data protection purposes. The most common use of a VM clone is in the mass deployment of standardized VMs. Cloning a virtual machine that is appropriate for a new workload and tailoring it for specific needs is more efficient than creating new VMs manually and then installing their operating systems and applications.

VM cloning is also useful for test and development. A workload may be cloned from the production environment and placed on another server in the lab, which allows development personnel to work with a real workload without interfering with production.

More VM clone resources:
Cloning a VM on an ESX server

Creating virtual machine clones and templates

The traditional process of cloning a virtual machine normally starts by quiesceing and then creating a VM snapshot backup of the source. It is not typically necessary to snapshot the source VM's memory, so disabling that option can usually speed up the snapshot process. Once the snapshot is complete, the original VM should leave the quiesced state and return to normal operation with little (if any) perceivable disruption to users.

In a VMware environment, the next step is to create a new VM using the virtual infrastructure (VI) Client. When configuring the resources for this new VM, do not assign a physical NIC. Assign a virtual switch instead, and stick with the default hard drive size. Do not activate the new VM just yet.

Now, use the command line interface to delete the virtual disk files for the new VM. Open the folder where the new VM resides and delete all of the VMDK files, leaving you with a new (but empty) VM.

At this point, go to the folder containing the snapshot of the original VM. Copy the snapshot to the new VM folder using the command line interface and the "vmkfstools" command. That places the content of your original VM into the new VM instance. The VI Client will allow administrators to activate the new VM. As long as the new VM is not running on a real physical NIC, it will not interfere with the original production VM.

Perform a little housekeeping by deleting the snapshot, which is no longer needed. Deleting the snapshot frees up unneeded disk space and minimizes file clutter. The VM clone will now function exactly like the original workload, and it can be migrated to other servers if needed.

Today, virtualization platforms have automated much of the process of cloning a virtual machine.


 

This was first published in January 2010

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.