Sometimes you encounter a situation where you have a VM configuration that you need to duplicate exactly. Maybe it's to deploy servers, or maybe it's for testing.
And in the same sense, it's wise to create templates if you create similar VMs regularly. The templates will allow you to create VMs with a predefined configuration.
The difference between clone and template is that in clone, you have an exact replica of an existing running VM (and everything inside it such as installed applications). The template, on the other hand, is a way to create fresh VMs with the same system resources and configurations.
In this article, I'm going to show you how you can clone virtual machines and containers, as well as create a template for them in Proxmox.
Cloning a Virtual Machine in Proxmox
This one goes without saying. If you want to clone a VM, you need to have a VM first.
I hope you already have created a virtual machine in Proxmox.
Now, here, I have a VM running and I can see it in Proxmox. A VM cannot be cloned while it's running. You need to shut it down first so that it's state is saved.
Do this by clicking the "shutdown" button at the top right-hand corner while you have selected the desired VM.
Once the virtual machine is shut down, right-click on it and click the option "Clone". A box will appear with configuration options.
The only configuration you really need to do here is give your cloned VM a new name. Click "Clone" when finished. If you have more than one storage device you can select which disk the clone will be created on here as well.
The virtual machine will duplicate itself and give a "TASK OK" signal when complete.
You can now fire up and use your newly cloned VM. Be aware that the hostname will stay the same as the old VM, so if you're going to be using them at the same time, you may want to change this for clarity purposes.
Creating Templates in Proxmox
Templates are great for when you have that perfect configuration that you want to save so you can quickly spin up a VM or container to use at a later time. Here's how to create one with Proxmox.
Here I have an Ubuntu 22.04 VM that I like, and I want to make it into a template so I can recreate the same VM whenever I want. I'm going to start by shutting down the VM, and then going over to the top right-hand corner and selecting "More" followed by "Convert to Template"
Select "Yes" at the confirmation box, and you'll end up with a screen that looks something like this:
From here on out you can clone this template and it will either create a linked clone or a full clone. A linked clone shares storage with the original template, while a full clone is self-contained.
Right click on the newly created template, and enter the name of the new clone and the type. If everything looks good, then hit "clone" and your clone will be created from the template.
You can now start the newly cloned VM, and work with it as normal.
As you can see, you did not need to shut down any VM in this process.
Cloning and templates make the task of duplicating desired configurations in Proxmox super convinient. This is also one of the reasons why I like Proxmox so much.
Both cloning and templating are easy to accomplish and they make scaling VMs a hell lot simpler.
Join me for my next tutorial as I show you how to cluster Proxmox nodes, along with configuring high availability.