Bobcares

Clone a VM in Proxmox – Here’s how to safely duplicate your VM

by | Mar 13, 2019

Can I clone my Proxmox VM? I want multiple VMs like my existing Proxmox VM.

That was a recent support ticket received at our Infrastructure Management Services department where we monitor and manage our customer servers.

When you need to setup many individual VMs all of a sudden, it becomes a tiresome task. That’s where you can use the cloning process in Proxmox.

Today, we’ll discuss how our Support Engineers efficiently clone a Proxmox VM.

Why you need a Clone?

Before going into the details, let’s first see the need of cloning a Proxmox VM.

For server providers, installing guest operating system and applications is a time consuming task. With clones, servers owners can create VMs from a single installation and configuration process.

And, this becomes really helpful when you need to install VMs to a group or create identically configured VMs in Proxmox clusters.

Similarly, on VMs running critical websites, cloning brings in redundancy, because it creates an exact copy of the live servers.

However, one downside is that cloning is applicable only for KVM based VMs, not for OpenVZ containers.

 

Clone VM in Proxmox – How to do it?

Now, let’s see how our Dedicated Support Engineers clone a VM in Proxmox.

1) Prepare Proxmox VM

We usually do the cloning process from Proxmox GUI. So, we make sure we’ve the root logins to GUI or other user has the privilege to create VM.

Secondly, we ensure that the existing VM has all the required configuration such as memory, disk space, CPU, etc. Because, all clones created from this VM will have identical configurations.

In addition to that, we check the versions of all software running on the Proxmox VM prior to the cloning process.

 

2) Clone the VM

The actual cloning process happens in this step. We follow the below series of steps to clone the Proxmox VM,

  • Select the VM from the Proxmox GUI and right click on it.
  • Click Clone to open a cloning dialogue box.
  • Select the options such as target node, new VM ID, VM name, cloning mode, etc.
  • Click on Clone to start the cloning process.

We can select the cloning mode as either Linked Clone or Full Clone.

A Full clone VM is a complete and independent copy of the original VM. So, it requires the same disk space as original.

On the other hand, Linked clone VM is a copy of the VM and shares the disks with the parent virtual machine. So, it requires less disk space.

 

3) Changes after Cloning

There are some issues that can pop up after the cloning process. That’s why, our Support Engineers maintain a checklist of problems that may occur after cloning and fix it.

We mainly see that duplicate VMs have the same hostname, MAC address, SSH keys, etc. of the original VM. So, if the original VM and the clones are running on the same network, it can create problems.

Let’s see how our Support Experts take care of these issues.

i) Correct hostname

We login to the cloned VM terminal as root user and change the hostname of the server. On Linux VMs, we change the hostname from /etc/hostname file. In addition to that, we make sure that the new hostname reflects in the files /etc/hosts and /etc/network/interfaces.

Further, we reboot the server to reflect these changes.

 

ii) Change MAC address

When we duplicate an existing VM, the MAC address also gets duplicated. This may create serious problems. In such cases, our Support Experts remove the virtual NIC(eth0) and create a new one. This will create a new MAC address for the VM. Further, we restart the VM and confirm if everything works fine.

 

iii) Change SSH keys

The SSH host keys should be identical for each VM to ensure security. So, it’s important to regenerate the SSH keys after cloning a virtual machine. For example, on a Linux VM, we regenerate the SSH keys using the following steps.

  • Login to VM via terminal as root user.
  • Remove the previous SSH keys from the location “/etc/ssh/“.
  • Reconfigure Openssh. For example, see the below command.
dpkg-reconfigure openssh-server

 

Considering the above problems that can happen while cloning an existing VM, our Support Engineers sometimes opt the option of creating the VMs from a template. Let’s discuss that case too.

A template is a pre-configured operating system image that can be used to deploy KVM virtual machines. However, a VM that’s converted to a template can’t be powered on or roll back to functioning state.

We follow the below steps to convert a VM to a template.

  • Install the VM with all the drivers and software packages.
  • Remove the user data, password and keys and power off the VM.
  • Right click on the VM and click Convert to template.

Then, we can go ahead with creating a new VM from this template. These steps are identical to the VM cloning process without a template. But. it prevents the overhead of changing the hostname, MAC address, etc. of the new VM.

 

proxmox clone vm

How to clone Proxmox VM from template?

 

[Need an expert to clone your Proxmox VM? Our experienced Server Experts can do it for you.]

Conclusion

In short, the process of cloning a VM in Proxmox involves a series of steps. Today, we’ve discussed how our Dedicated Support Engineers effectively clone a Proxmox VM.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

4 Comments

  1. florian

    hello.

    “Select the VM from the Proxmox GUI and right click on it. Click Clone to open a cloning dialogue box.”

    is it possible do create clone, but in hypervisor shell ? I have to clone 40 times a container to create all my needed continers.
    best regards.

    Reply
    • Hiba Razak

      Hi,
      Please contact our support team via live chat(click on the icon at right-bottom)

      Reply
  2. sam

    Pretty much all of what you said for doing a full-Clone worked for me.
    The reconfigure of OpenSSH / SSH keys and “The authenticity of host warning” was cleared after rebooting the new VM.
    One issue for me, was when i did df -h in the new VM, my output showed /dev/mapper/oldVMname-root same for mount. (both commands used under Linux/from Debian Bullseye)

    Reply
    • Hiba Razak

      Hi Sam,
      To resolve the issue, you can update the filesystem UUIDs and labels, edit /etc/fstab to reflect the changes, update GRUB configuration, and then reboot the VM.
      Please contact our support team via live chat(click on the icon at right-bottom) if you need any assistance.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF