Move all vm's to another cluster

repa

Renowned Member
Nov 18, 2010
37
4
73
hi,

we have a proxmox cluster with local storage only.

for maintenance, we have to move all vm's from one host to another.

with "qm migrate <id> <host> --online --with-local-disks" we can migrate vm by vm.

How can we migrate all VMs from hostA to hostB with one command?
 
One way is backup/restore (but this is not just "one" command).
 
hi,

we wan't to move the VM's from one host to another inside the cluster, so i dont think backup / restore is needed when we can use the "qm migrate" command?
 
you can use qm migrate. "with local disk" is pretty new and sometimes not 100 % stable (at least in my tests).
 
Yes, i know this command, but how can i move ALL vm's from one host to another?

instead of moving every single vm with "qm migrate <id>" is it possible to "qm migrate <sourcehost> <dest host>"?
 
qm list | awk '{print $1}' | while read VMID; do qm migrate $VMID <DST_HOST> -online --with-local-disks; done

Instead of <DST_HOST> insert your destination host (without brackets).
 
thanks, but that command will move ALL vm's right?

we have a 4 node cluster and we need to migrate from nodeA to nodeB for example.

not all VM's from all hosts to one node.
 
It will move all vm's only from local host where you run the command.
 
Hi All,

In the command above, we can see that it is faulty and needs to be fixed. (with echo test only)
root@proxmox01:~]$ qm list | awk '{print $1}' | while read VMID; do echo qm migrate $VMID proxmox02 -online --with-local-disks; done
qm migrate VMID proxmox02 -online --with-local-disks
qm migrate 102 proxmox02 -online --with-local-disks
qm migrate 107 proxmox02 -online --with-local-disks

This is the right:
qm list | egrep -v VMID | awk '{print $1}' | while read VMID; do qm migrate $VMID proxmox02 -online --with-local-disks; done
[root@proxmox01:~]$ qm list | egrep -v VMID | awk '{print $1}' | while read VMID; do echo qm migrate $VMID proxmox02 -online --with-local-disks; done
qm migrate 102 proxmox02 -online --with-local-disks
qm migrate 107 proxmox02 -online --with-local-disks

Regards
 
Last edited:
  • Like
Reactions: DataCollector

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!