Setup a ZFS Pool replication in a Proxmox Two-Node cluster

setup-zfs-pool-replication-proxmox-two-node-cluster-01

Because a ZFS datastore in a Proxmox Two-Node cluster operates locally rather than as a shared storage pool, ZFS Pool replication is required to synchronize data between nodes.

To protect running virtual machines against unexpected hardware failures, implementing automated ZFS Pool replication is the key to keep your business running.

 

Create the ZFS datastore

To proceed with the creation of the ZFS datastore, ensure you have a Proxmox Two-Node cluster in place.

Because ZFS is a local file system where multiple nodes cannot write to the same ZFS Pool simultaneously, unlike a shared SAN or Ceph cluster, Proxmox uses incremental replication to synchronize virtual machine and container data between separate nodes. 

Proxmox's built-in GUI replication engine operates strictly per guest (VM or Container) rather than at the whole-pool level. This means every time you create a new VM, you manually have to add a replication job for it.

ZFS Pool replication 1

 

Create ZFS datastore on Node 1

Login to your Proxmox cluster and select Node 1. Navigate to the Disks section to verify that the disks you want to use for the ZFS Pool are detected.

ZFS Pool replication 2

Access the ZFS section and click Create ZFS.

ZFS Pool replication 3

Enter a Name for the datastore, make sure Add Storage is checked, and choose the desired RAID Level. In this example, the Single Disk option is selected since only one disk will be used. Select the disk and click Create.

ZFS Pool replication 4

Once the ZFS datastore has been created it will also be displayed in the available resources in the selected node.

ZFS Pool replication 5

 

Create ZFS datastore on Node 2

Select Node 2 > ZFS and click Create ZFS.

ZFS Pool replication 6

Enter the exact same Name given to datastore on Node 1, uncheck Add Storage and choose the required RAID Level (Single Disk in the example). Select the disk to use and click Create.

ZFS Pool replication 7

The ZFS datastore has now been created but is not yet listed as an available resource on Node 2.

ZFS Pool replication 8

Go to Datacenter > Storage and select the ZFS datastore you just created. Click Edit.

ZFS Pool replication 9

From the Nodes drop-down menu, select Node 2 and click OK.

ZFS Pool replication 10

The ZFS datastore is now available for Node 2 as well.

ZFS Pool replication 11

To verify your pools, open the Shell of Node 1 and check the available ZFS Pools.

# zpool list

ZFS Pool replication 12

Do the same for Node 2.

# zpool list

ZFS Pool replication 13

 

Create the ZFS Pool replication

Create a new virtual machine and choose the ZFS datastore as the target Storage.

ZFS Pool replication 14

To ensure data is available on both nodes in case one fails, you need to set up replication. Go to Datacenter > Replication > Add.

ZFS Pool replication 15

In the CT/VM ID field enter the ID of the VM or container you want to replicate. Specify the Target node and the desired Schedule (every 15 minutes in the example). Click Create.

ZFS Pool replication 16

The replication job has now been created.

ZFS Pool replication 17

Until the replication job is triggered for the first time, the target node will display the VM's disk with a size of 0 bytes.

ZFS Pool replication 18

At scheduled time, the replication runs and the disk data is securely copied to the target node.

ZFS Pool replication 19

After the initial synchronization, Proxmox copies only the incremental changes (deltas) during every subsequent replication run.

 

Test a Node failure

If the node where the VM is running fails (Node 1 in the example) and you are just using basic ZFS replication without Proxmox HA configured, the VM will not automatically boot up on Node 2. It will remain offline because Node 1 only holds a passive replica disk.

To automate the boot process, you need to configure HA for the protected VM. Select Datacenter > HA and click Add.

ZFS Pool replication 20

Select the VM you want to protect and click Add.

ZFS Pool replication 21

HA for the selected VM is now enabled.

ZFS Pool replication 22

 

Node failure

Node 1 experiences a sudden power outage.

ZFS Pool replication 23

When HA is triggered by the cluster, the VM is moved to Node 2 and automatically booted.

ZFS Pool replication 24

When Node 1 comes backup online, the VM is migrated back according to the HA settings (the Failback option is enabled).

ZFS Pool replication 25

The VM is now running on Node 1 again.

ZFS Pool replication 26

Keep in mind that when a node fails and the VM is booted to the secondary node, any data written inside the VM between the last completed ZFS Pool replication and the moment node failed will be lost.

signature

Leave a Reply