Continuing with the cloning virtual machines in vSphere series, today I am going to write about the full clone, how it works and some useful information about it.
So, let’s talk about clones… but just full clones.
How does it work?
As you probably know a full clone is an exact copy of a source VM, meaning that, everything from the parent VM is copied (VM settings, disks, files, etc.).
This action can be performed if the parent VM is powered off or powered on and, if it has snapshots it will consolidate them once the clone is done.
When you clone a VM be aware that, all data will be identical so, if you power on the clone without performing any customization, probably you will have conflicts with IPs, MAC addresses, SIDs (Windows), etc.
The great thing about a full clone is that, after the cloning operations are performed the clone will be an independent copy of a virtual machine that doesn’t share anything with the parent virtual machine (we are talking about from a compute and storage perspective within vSphere).
Ways to do it
First of all, you will need VMware vCenter to do it.
There are other ways (not official) like copying all data related to the virtual machine (.vmdk and .vmx files) and then register the «new» VM with another name.
Let’s continue with the usual ways:
vSphere Web Client
You can do it through vSphere Web Client, as simple as, right-click a VM -> «Clone to Virtual Machine…» :
Once it finishes, it takes some time (depends on the storage that the source VM has allocated) but in the end, you will have your new clone.
Likely you are more familiar about deploying templates…
Deploying a template is the same as cloning but. aside from copying the same data from the parent virtual machine, vSphere lets you customize the deployed VM for creating many clones and with different configurations as you wish.
Of course, you can do it with PowerCLI. These are the minimal parameters needed to perform it (Disk Storage Format parameter is optional but recommended because, by default, it will convert all disks to Thick Provision Eager Zeroed):
In the previous screenshot, you can see the minimum parameters required to perform a full clone, if you want to see more options you can check it here.
As you can see in the code, it’s similar to deploying a template, isn’t it?
The main use case is deploying from a template, maybe we are not aware but, deploying from a template is just cloning our source VM (Master template) and then customizing it.
I saw many customers use it as a «rollback» when they have to perform a destructive task within the Guest OS. In this way, just shutting down the parent VM and powering on the clone.
If you think a snapshot can do the same as a clone well, not always… some applications don’t handle well doing a quiesced snapshot.
This is why, as a solution, you can create a full clone when the virtual machine is powered off and then, have a copy that will be consistent and without corruption.
Another use case could be to perform a full clone to use it in other environments. Although there are better ways to do this (with other products), when the Guest OS has many customizations, this can be an alternative solution of re-creating the entire virtual machine.
Benefits and limitations
The benefits of a full clone were mentioned before:
- If the cloning operation is executed when the source VM is powered off, it can be used as a rollback in many cases (there are better options like a VM backup but, it can help a lot).
- Creation of an independent VM that shares nothing with the source VM.
- Used in templates, so, they are very useful!
These are some limitations instead of disadvantages that we can find:
- It takes some time to create a full clone (it depends on the allocated storage) as it has to copy all storage from the source VM.
- It can only be performed with VMware vCenter (there are other ways as I explained before but they are not official).
- If done when the VM is powered on, it has an impact on the source VM that can be noticed by the business so, isn’t the best option to do it while the virtual machine is in running.
To sum up, a full clone is a great way to have an identical copy of another VM to use it as a permanent virtual machine once you configure it accordingly.
As said before, is the same as deploying a template because you are just cloning a VM (deploying a template) and then customizing it.
It usually takes some minutes to finish the clone (depending on the storage allocated in the parent VM), this is why there are other ways to deploy clones in a faster way (on the next posts!).