Proxmox Remote Migration

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

These instructions describe a specific procedure for the migration of virtual machines (VMs) and containers (LXC) of a Proxmox host to another node without being a part of a whole cluster.

Function

The remote migration in Proxmox describes the process, in which a virtual machine (VM) or container (LXC) is transferred from one Proxmox host to another, without the hosts involved being part of a common cluster.

The migration takes place over the network, with the VM data being transferred from the source host to the target host. This method is especially helpful in environments, in which a central cluster administration is not possible or not desired, for example, in distributed locations, isolated systems or for migrations between physically separated systems.

Preparation

An API token must be created on the target host for the remote migration in Proxmox. This happens via "Datacenter" → "API-Tokens", where any name can be chosen as the ID and root@pam as the user. Token ID and Secret should be stored securely after creation, as they will be needed for the migration.

After this, the permissions are adapted via "Datacenter" → "Permissions" → "Add" → "API Token Permission". Here, the root directory / is selected as path, the previously created token is stated and the role "Administrator" is assigned.

The fingerprint of the target server is needed at the end. This fingerprint can be called up as follows:

openssl x509 -fingerprint -sha256 -noout -in /etc/pve/nodes/$(hostname)/pve-ssl.pem

Execution

After the command has been executed, the migration runs automatically.

Once the above mentioned preparation steps have been completed, you can now start the migration of the VMs to the other node. To migrate the desired VMs or containers, the following command must be executed from which the VMs are migrated:

qm remote-migrate <VMID_QUELLE> <VMID_ZIEL> 'host=<ZIEL_IP>,apitoken=PVEAPIToken=<BENUTZER>@pam!<TOKENNAME>=<API_TOKEN>,fingerprint=<FINGERPRINT>' --target-bridge <NETZWERK_BRIDGE> --target-storage <ZIEL_STORAGE> --online

  • <VMID_QUELLE>: ID of the migrated VM on the source server
  • <VMID_ZIEL>: desired ID of VM on the target server
  • <ZIEL_IP>: IP address of target Proxmox host
  • <BENUTZER>: username, for example root
  • <TOKENNAME>: name of API token
  • <API_TOKEN>: generated API key
  • <FINGERPRINT>: previously requested fingerprint
  • <NETZWERK_BRIDGE>: for example vmbr0
  • <ZIEL_STORAGE>: for examplelocal-lvm

Example of a command:




Author: Harald Peterhansl

Harald Peterhansl has been working at Thomas-Krenn.AG since 2022. As an employee in the Hardware Service department, he is responsible for setting up test environments, testing a wide range of server components, and repairing defective customer systems.


Translator: Alina Ranzinger

Alina has been working at Thomas-Krenn.AG since 2024. After her training as multilingual business assistant, she got her job as assistant of the Product Management and is responsible for the translation of texts and for the organisation of the department.


Related articles

Cloud Init Templates in Proxmox VE - Quickstart
Creation of Proxmox Ubuntu 24.04 server VM
ESXi VM importer - Proxmox VE Storage Plugin