Proxmox: replication of VMs between 2 Proxmox servers

In this tutorial, we will see how to set up the replication of a virtual machine or an LXD container between two Proxmox servers.

Overview of Replication

Proxmox allows you to set up the replication of virtual machine disks between two Proxmox servers which are members of the same cluster (Datacenter).

Replication is carried out according to a configured schedule which can be every 15 minutes or once a day for example.

In the case where a virtual machine is a member of a High Availability (HA) group and it is configured to be started, in the event of a shutdown of the source node, the virtual machine will be automatically started on the destination node and the direction of replication reversed.

Required prerequisites to set up replication

The storage used for the virtual disks of the VM or CT must be ZFS type which supports snapshots.

The storage must also have the same name.

Both servers must be in the same cluster.

Prerequisites for replication in HA mode

If you want the replica to start automatically, the VM must be a member of a High Availability group.

Configuration in HA mode can lead to data loss; as soon as the source server is unavailable, the destination server which has the replica will start the virtual machine and reverse the direction of replication.

If you restart, for example, the source Proxmox server to apply updates, the replica will be started on the other server and if the last replication is for example 1 hour away, you will lose an hour of data.

Configure the replication of a virtual machine in Proxmox

To illustrate this tutorial, I will set up replication on VM 103.

From the VM options, go to Replication 1 and click on Add 2.

Indicate the target server 1, configure the schedule 2 then click on the Create 3 button.

VM 103 will be replicated on the s-pve-1 server every 10 minutes.

The replication job is created.

We can see that the replication job is waiting for the initial replication.

After a few minutes of waiting, the replication has taken place and we can times the duration of the replication and when the next one will take place.

If we look on the destination server in the storage, we find the disk of the replicated virtual machine.

Replication is in place.


Replication should not replace backups, if your VM is encrypted at source, replication will be too.

Failover of a virtual machine to HA

VM 103 as can be seen in the screenshot below is in HA in group HA-1 and configured to start automatically.

To simulate a failure, I will shut down the s-pve-2 server which hosts the VM.

The s-pve-2 server is offline.

Updating VM and CT information takes a little time in the web interface.

After a few minutes, VM 103 is switched to the s-pve-1 server and started automatically.

If we look at the replication configuration, we can see that the direction has been reversed, the target is now s-pve-2.

Once the second one is online (s-pve-2), replication resumes normally.

Virtual machines without High Availability – HA

In the case of machines that are not in HA, when the offline node is available again, replication resumes normally.

If the source server is permanently lost, you will need to recreate a virtual machine and attach the replicated disk.

You now know how to set up virtual machine replication with Proxmox.

Leave a Comment