Efficient VM Migration Between Proxmox Servers Using Rsync

Two servers with a visual representation of VMs transferring between them via the Rsync protocol, showcasing efficiency.

Introduction

Migrating Virtual Machines (VMs) between Proxmox servers can be a routine task, but doing it efficiently and securely is crucial. This guide will walk you through how to use rsync for VM migration, which offers both efficiency and security.

Why Use Rsync?

Rsync is a utility for efficiently transferring and synchronizing files across systems. It only sends the differences between the source and destination files, reducing the amount of data transferred. This is particularly useful for migrating large VMs.

Prerequisites

  • SSH keys set up for password-less authentication between the source and destination servers.
  • Root access to both the source and destination Proxmox servers.

On the Source Proxmox Server

Step 1: Shutdown VM

qm stop [VM_ID]

Step 2: Export VM Configuration

qm config [VM_ID] > /tmp/vm_[VM_ID].conf

Step 3: Rsync Disk Image

rsync -av --progress /var/lib/vz/images/[VM_ID]/ root@[DEST_IP]:/var/lib/vz/images/[NEW_VM_ID]/

Step 4: Rsync Configuration File

rsync -av --progress /tmp/vm_[VM_ID].conf root@[DEST_IP]:/tmp/

On the Destination Proxmox Server

Step 1: Create New VM

Create a new VM but don’t start it. Make sure the storage and network configurations match the source VM.

Step 2: Import Configuration

cat /tmp/vm_[VM_ID].conf > /etc/pve/qemu-server/[NEW_VM_ID].conf

Step 3: Fix Permissions

chown root:root /var/lib/vz/images/[NEW_VM_ID]/*

Step 4: Start VM

qm start [NEW_VM_ID]

Step 5: Verify

Log into the VM to ensure everything is functioning as expected.

Conclusion

Using rsync for VM migration between Proxmox servers not only makes the process more efficient but also more secure. By following this guide, you can ensure a smooth migration process while minimizing the risk of data loss or corruption.

Picture of admin

admin

Leave a Reply

Sign up for our Newsletter

Get the latest information on what is going on in the I.T. World.