Migrating VM's.

SamTzu

Renowned Member
Mar 27, 2009
511
16
83
Helsinki, Finland
sami.mattila.eu
Since migrating containers from one host to another is still a work in progress I thought I would share an easy way to migrate a virtual machine called "test" (with ID 100) from a "local" disk on a cluster host1 to a disk2 on a host2. (This functionality is still missing.)

First we create /media/data2 LVM drive and folder and add them to proxmox storage. (Not part of this short tutorial.)
Then we bind mount the /var/lib/vz dir as a root on host2 with command
mount --bind /media/data2 /var/lib/vz
And then we migrate the container normally to host2 and it's "local" storage.

After migration is done from host1 to a different storage on host2 we unmount the temporary "local" storage, mount the new data2 folder (for real this time) and remount the real "local" storage again.
Then we change the /etc/pve/openvz/100.conf content to point to data2.
VE_ROOT="/var/lib/vz/root/100"
VE_PRIVATE="/media/data2/private/100"

Now the virtual machine is ready to be started on a different storage on a different host.
The benefit of this approach compared to just backing up and restoring a client is that this way the down time is actually quite small compared to backing up and restoring a 50Gb VM.
 

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!