Migration of VM

ash

New Member
Jun 5, 2020
11
0
1
34
Hi,

I wish to migrate a vm, is it possible to do so using dd command when th vm is off. If i have a vm in node1 as 1001 and i create a dummy vm 1002 in node2 with same configuration as node1, both vms are stopped and then using dd command can i migrate 1001 to 1002?

I have 2 nodes with a cluster both have same pveversion.

pveversion -v
proxmox-ve: 6.1-2 (running kernel: 5.3.18-2-pve)
pve-manager: 6.1-7 (running version: 6.1-7/13e58d5e)
pve-kernel-helper: 6.1-6
pve-kernel-5.3: 6.1-5
pve-kernel-5.3.18-2-pve: 5.3.18-2
ceph-fuse: 12.2.11+dfsg1-2.1+b1
corosync: 3.0.3-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: 0.8.35+pve1
ksm-control-daemon: 1.3-1
libjs-extjs: 6.0.1-10
libknet1: 1.15-pve1
libpve-access-control: 6.0-6
libpve-apiclient-perl: 3.0-3
libpve-common-perl: 6.0-13
libpve-guest-common-perl: 3.0-3
libpve-http-server-perl: 3.0-4
libpve-storage-perl: 6.1-5
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 3.2.1-1
lxcfs: 3.0.3-pve60
novnc-pve: 1.1.0-1
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.1-3
pve-cluster: 6.1-4
pve-container: 3.0-21
pve-docs: 6.1-6
pve-edk2-firmware: 2.20200229-1
pve-firewall: 4.0-10
pve-firmware: 3.0-6
pve-ha-manager: 3.0-8
pve-i18n: 2.0-4
pve-qemu-kvm: 4.1.1-3
pve-xtermjs: 4.3.0-1
qemu-server: 6.1-6
smartmontools: 7.1-pve2
spiceterm: 3.1-1
vncterm: 1.6-1
zfsutils-linux: 0.8.3-pve1

# cat /etc/pve/storage.cfg
dir: local
path /var/lib/vz
content iso,backup,vztmpl

lvmthin: local-lvm
thinpool data
vgname pve
content rootdir,images

dir: vms_file
path /vms
content images,rootdir

lvm: vg1
vgname vg_prox1
content images,rootdir

lvm: v2
vgname vg_prox2
content images,rootdir

here vg1 is the storage in node1 and v2 is the storage of node2
 
VM migration inside a cluster can be done with one click => Migrate VM.
 
yes i know it is just a click. but i wanted to try out with dd. IS it possible?

yes, but as our migrate command is doing all perfectly I do not see any reason to use dd ..
 
yes, but as our migrate command is doing all perfectly I do not see any reason to use dd ..

I created a VM on node1 and node2, using ls command i am able to view the lvm of my vm. Turned off the VM, using ls command i cannot see the lvm, so when i use dd command dd if=$SOURCE_DISK_PATH | throttle -v -w 2 -m $SPEED | ssh -oStrictHostKeyChecking=no -i /var/virtualizor/ssh-keys/id_rsa -q -p $TO_SSH_PORT root@$TO_IP dd of=$DEST_DISK_PATH i get error stating that the
dd: failed to open the lvm: No such file or directory

Or if i use your migrate option is it possible that i can pass the destination vm where i want to migrate my source vm to?
 
Last edited:
I created a VM on node1 and node2, using ls command i am able to view the lvm of my vm. Turned off the VM, using ls command i cannot see the lvm, so when i use dd command dd if=$SOURCE_DISK_PATH | throttle -v -w 2 -m $SPEED | ssh -oStrictHostKeyChecking=no -i /var/virtualizor/ssh-keys/id_rsa -q -p $TO_SSH_PORT root@$TO_IP dd of=$DEST_DISK_PATH i get error stating that the
dd: failed to open the lvm: No such file or directory

Without the actual values behind the variables and setup on the source and destination, we can only guess what's wrong...
 
Without the actual values behind the variables and setup on the source and destination, we can only guess what's wrong...




when VM is on:
root@master:~# ls -lha /dev/vg_master/
total 0
drwxr-xr-x 2 root root 80 Sep 21 13:04 .
drwxr-xr-x 20 root root 4.3K Sep 21 13:04 ..
lrwxrwxrwx 1 root root 7 Sep 21 11:10 test -> ../dm-6
lrwxrwxrwx 1 root root 7 Sep 21 13:04 vm-1026-d5oqvtklo2kkzvzj-mf2hq1lvyvvguqrl -> ../dm-7

when VM is off:
root@master:~# ls -lha /dev/vg_master/
total 0
drwxr-xr-x 2 root root 60 Sep 21 13:05 .
drwxr-xr-x 20 root root 4.3K Sep 21 13:05 ..
lrwxrwxrwx 1 root root 7 Sep 21 11:10 test -> ../dm-6

if you see dm-7 is not visible when VM is off and hence when i execute the dd command it fails

dd if=/dev/vg_master/vm-1026-d5oqvtklo2kkzvzj-mf2hq1lvyvvguqrl | throttle -v -w 2 -m 1000 | ssh -oStrictHostKeyChecking=no -i /var/virtualizor/ssh-keys/id_rsa -q -p 22 root@10.1.5.23 dd of=/dev/slave_vg/vm-1027-d0fgfdoq2feotmgv-lwnw1kk5mpj5bsus

dd: failed to open '/dev/vg_master/vm-1026-d5oqvtklo2kkzvzj-mf2hq1lvyvvguqrl': No such file or directory
 

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!