Moving disk image from one KVM machine to another
Disk Image to Migrate
Find out what disk image you want to migrate and which tags it has with the command:
lvs -o +lv_tags
This will give you something like:
:~# lvs -o +lv_tags LV VG Attr LSize Origin Snap% Move Log Copy% Convert LV Tags data pve -wi-ao 38.12G root pve -wi-ao 16.75G swap pve -wi-ao 8.38G vm-101-disk-1 pve-compartido -wi-a- 80.00G pve-vm-101 vm-102-disk-1 pve-compartido -wi-ao 35.00G pve-vm-102 vm-104-disk-2 pve-compartido -wi-a- 50.00G pve-vm-104 vm-105-disk-1 pve-compartido -wi-ao 50.00G pve-vm-105 vm-106-disk-1 pve-compartido -wi-ao 22.00G pve-vm-106 vm-108-disk-1 pve-compartido -wi-ao 32.00G pve-vm-108 vm-108-disk-2 pve-compartido -wi-ao 150.00G pve-vm-108 vm-113-disk-1 pve-compartido -wi-ao 2.00G pve-vm-113 vm-113-disk-2 pve-compartido -wi-ao 2.00G pve-vm-113 vm-108-disk-3 pve-pulpo -wi-a- 300.00G pve-vm-108 vm-108-disk-4 pve-pulpo -wi-a- 50.00G pve-vm-108
Substitute tags for new VM
Once you know exactly which disks want to migrate and the volume group they are allocated to and their tags, we delete the tags from the disks and then add the tags for the new VM with a command like:
lvchange --deltag @pve-vm-108 pve-pulpo/vm-108-disk-3 pve-pulpo/vm-108-disk-4
In this example, I am moving vm-108-disk3 and vm-108-disk-4 from VM 108 to VM 101.
Add tags for both VMs
Now add the tag for VM 101 to both disks:
lvchange --addtag @pve-vm-101 pve-pulpo/vm-108-disk-3 pve-pulpo/vm-108-disk-4
Note : you can do steps 2 and 3 in one command :
lvchange --addtag @pve-vm-101 --deltag @pve-vm-108 pve-pulpo/vm-108-disk-3 pve-pulpo/vm-108-disk-4
As a convenience, it's better to rename the disk images to reflect the machine they belong to:
lvrename pve-pulpo/vm-108-disk-3 pve-pulpo/vm-101-disk-1 lvrename pve-pulpo/vm-108-disk-4 pve-pulpo/vm-101-disk-2
Delete Disk in Old VM
Using Proxmox Web Admin, delete the disks from the "old VM" and on the new one the disks are now available as "unused", so we can add them.
Credits : From kawarmc in Proxmox Forums