How to migrate between storages?

chronos

Member
Apr 11, 2009
54
0
6
What is best way to migrate VM and CT between storages? Web interface allows only migrate between cluster nodes. In such case it will migrate to same storage. But if we want to migrate between node1/storage2 to node2/storage1 or even same node node1/storage1 to node1/storage2 then there isn't such option to select destination storage in migration form.

Maybe there is such possibility using CLI. But at least pct command seems to be not supported such parameter:
USAGE: pct migrate <vmid> <target> [OPTIONS]
Migrate the container to another node. Creates a new migration task.
<vmid> integer (1 - N)
The (unique) ID of the VM.
<target> string
Target node.
-online boolean
Use online/live migration.

So maybe only "official" way is to do backup => scp image to another node => pct restore -storage storage_name. Or for local move just do backup and restore to different storage locally.

As LXC containers root filesystem is located in single file then it should be simple to move file to different storage and then update CT configuration (rootfs parameter in /etc/pve/lxc/vmid.conf) manually.

But it would be better to have such useful option also in web interface.
 

Erk

Active Member
Dec 11, 2009
151
3
38
Live migration requires the same storage, therefore what you are doing is not live migration and can be done a number of ways. Take the VM offline and copy the disk image from storage1 to storage 2, or backup the VM and restore specifying the changed storage.
 

chronos

Member
Apr 11, 2009
54
0
6
To my understanding live migration means that virtual machine is moved without or with minimal downtime so it is not restarted and network connections are preserved. Then there is no reason why it should be performed only between same storages. In case of openvz it was done with using two phase rsync and snapshot.

If virtual image is really copied somewhere depends on used storage model. With network storage it is possible to just sleep virtual machine and wake it on different host with just storing and restoring memory snapshot. But if each cluster node have one or multiple separated storages(disks) then there is need to specify to which storage virtual machine should be really moved. And this is not currently possible with web interface.
 

Q-wulf

Well-Known Member
Mar 3, 2013
608
30
48
my test location
I might be misunderstanding the initial question, but are you asking how to move the VM/CT from one Storage on Node 1 (e.g. local) to another Storage on Node 1 (e.g. NFS) ??

if so, all you really need to do is move the vDisks you have assigned to said VM/CT via the GUI.
VM -> Hardware -> Select HDD -> Move Disk.
the "VM/CT config" is kept on the proxmox Cluster File-system and does not need to get copied anywhere, as long as we are talking about the same Cluster.
 

chronos

Member
Apr 11, 2009
54
0
6
Yes, I see VM KVM disk can be really moved between storages locally. But there is no such option for CT (LXC) yet.
And there is also second scenario: migrate offline/online between two cluster nodes and two different storages. Lets say one storage is spinning disk and second is SSD. Or you can have one storage on smaller but faster disk and another storage on larger and slower disk with lower consumption for keeping backups. Or even one storage as physical local disk and one storage as shared network disk.

Simply if anybody have multiple storages then it would be handy to be able to migrate simply between nodes and different storages.
 

mir

Famous Member
Apr 14, 2012
3,536
106
83
Copenhagen, Denmark
Simply if anybody have multiple storages then it would be handy to be able to migrate simply between nodes and different storages.
This is already supported. You can move a disk between storages while VM is running by simply use the option 'Move disk' from the GUI. You can move to both local and shared storage but remember that as long as the disk is on local storage you will not be able to do online migration of the VM.
 

chronos

Member
Apr 11, 2009
54
0
6
But you can move disk only for VM(KVM), not CT (LXC). There isn't Hardware tab in CT configuration and there is not option to move disk in Storage tab as well.
And also it would be nice to have possibility to migrate VM or CT directly to specified storage on target node. Without such option at least for VM(KVM) it would require two steps: move disk and migrate. And for CT this can't be done yet in GUI.

I don't think that "shared" storage flag have any impact to VM disk move operation. According wiki main purpose is just to tell proxmox that storage is shared between nodes and so there is no need to copy root file over network.

Also OpenVZ CT allowed previously to perform online migration without visible downtime even between two nodes with local storage. Root filesystem was just copied to target in two phases and so it took much longer then online migration on shared NFS storage.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!