1. VM Clone Overview
A clone is a copy of an existing virtual machine. The existing virtual machine is called the parent of the clone. When the cloning operation is complete, the clone is a separate virtual machine — though it may share virtual disks with the parent virtual machine according to clone type).
- Changes made to a clone do not affect the parent virtual machine. Changes made to the parent virtual machine do not appear in a clone.
- A clone’s MAC address and UUID are different from those of the parent virtual machine.
If you want to save the current state of the virtual machine, so you can revert to that state in case you make a mistake, take a snapshot. If you want to make a copy of a virtual machine for separate use, create a clone.
Cloning a virtual machine creates a point-in-time duplicate of the virtual machine with the same configuration and installed software as the original.
Optionally, you can customize the guest operating system of the clone or use a customization specification to change the virtual machine name, network settings, and other properties if VMware Tools is installed in the virtual machine.
There are two types of clone:
- A full clone is an independent copy of a virtual machine that shares nothing with the parent virtual machine after the cloning operation. Ongoing operation of a full clone is entirely separate from the parent virtual machine.
- A linked clone is a duplicate of a virtual machine that uses the same base disk as the original, with a chain of delta disks to track the differences between the original and the clone. Actually, a linked clone is a writable snapshot. This conserves disk space, and allows multiple virtual machines to use the same software installation.
Linked clone cannot be created, configured or deployed from the vSphere client or ESXi CLI, they do not get a great deal of exposure. vCloud Director and VDI now use linked clones for faster deployments of VMs, as well as saving disk space by avoiding complete clones of VMs from a vApp Template.
2. Taking Clones
2.1 User Configuration Steps:
- Enter a virtual machine name
- Select a location (datacenter and/or folder)
- Select a host or cluster on which to run the new virtual machine
- Select a resource pool in which to run the virtual machine
- Select the datastore location where you want to store the virtual machine files
- Optionally, select the format for the virtual machine’s disks (default is the same as source; each virtual disk can be individually customized through the advanced configuration button)
- Optionally, select a guest operating system customization option (VMware Tools should be installed)
- Optionally, select whether to power on the virtual machine or edit virtual machine settings
2.2 vSphere Working Steps:
- Creating snapshot of Virtual Machine
- Copying Virtual Machine files
- Creating the new Virtual Machine
- Powering on Virtual Machine (if user selected to power on the VM after cloning)
3. Application-consistent Clone
By default, the cloning operation firstly creates a quiesced application-consistent snapshot and then performs the copy to achieve an application-consistent clone.
When heavily loaded applications, such as load generators, are running in the guest operating system during a clone operation, the virtual machine quiesce operation can fail and VMware Tools might be denied CPU resources and time out. So if a load generator is running in the virtual machine, stop it before you perform the clone operation.
When creating a hot clones of VMs that have high I/O you may encounter the following error (http://www.vsysad.com/2013/02/high-io-on-vm-causes-clone-to-fail/):
Cannot create a quiesced snapshot because the snapshot operation exceeded the time limit for holding off I/O in the frozen virtual machine
This is s common issue when trying to perform clones of very busy production servers such as SQL Server or Exchange Server. As these applications perform constant reads/writes the usual quiescing function (when initiating a clone or snapshot fails to flush all of the operations to disk.
A quick and dirty fix if you simply want to clone the VM is to stop the VMware Tools Service on the guest and then re-run the clone. It should complete OK. This basically bypasses the quiescing of the file system and produces a crash-consistent clone.
VMware KB article 1018194 highlights this issue and prescribes various fixes depending on your circumstance.
4. Cloning VM using vStorage APIs for Array Integration (VAAI)
VMware’s Storage APIs for Array Integration (VAAI) is an API for storage partners to leverage that permits certain functions to be delegated/offloaded to the storage array, thus greatly enhancing the performance of those functions.
It is the hardware-accelerated Full Copy primitive defined in VAAI that enables the offloading of VMware (Full) clones to the storage array.
In addition to deploying new virtual machines from a template or through cloning, Full Copy is also utilized when doing a Storage vMotion. When a virtual machine is migrated between datastores on the same array the live copy is performed entirely on the array.
The VAAIs are enabled (Hardware Acceleration) by default on both the storage arrays and ESX server.
5. Cloning across datacenters
Prior to VMware ESX 4 (vSphere) it was not possible to clone a running virtual machine to another datacenter, or to a virtual machine data store that wasn’t available on the source host. Now with VMware vSphere it is possible to clone a running virtual machine to another datacenter, even if the destination data store is not presented to the source host.
How does this work when the target hosts volume isn’t even accessible on the originating server?
The answer is in the Service Console network. When source and destination disk volumes are present, then it will initiate a disk to disk transfer (over iSCSI or fibre channel). However, when the target storage is unavailable it will now use the Service Console network to transfer the data. Magic!
This is an excellent feature, as prior to ESX 4 I had to temporarily present the target volume to the source host during the migration or cloning process. Now I can keep storage between my datacenters seperate.
Why the Service Console Network?
Providing the service console network is used for management only, this is the best option. You certainly wouldn’t want the VMkernal network to be saturated with traffic generated from a storage migration, as this would impact VMotion.
6. Cloning VM with RDMs
For physical mode RDMs: Cloning of VMs that use physical mode RDMs is not supported; For virtual mode RDMs: Cloning of VMs that use virtual mode RDMs will convert RDMs into VMFS virtual disks (regardless if you choose to change the format or not) and RDM contents will be copied into the virtual disks.
- vSphere Virtual Machine Administration