bind existing img from an other vm

grefabu

Well-Known Member
May 23, 2018
245
16
58
51
Hi,

how could I bind an disk image from an existing vm to another?

I think it is only editing the vm conf file and paste the image path like:
Code:
sata0: cephpool001:vm-122-disk-0,size=1001G

To the other vm?
And what is the case, if the origin VM has snapshots? Did I see the snapshots in the other VM?

Bye

Gregor
 
What exactly do you mean by bind? Moving it from one VM to another?
 
Hi,

moving or temporaly assign. I will examin the Files from an other System, or copy some files without 've the system online.

Bye

Gregor
 
Then, as you mentioned, you have to
  • Remove the specific line from the VM config
  • Rename (+ depending on storage also move) the file
  • Add the line to the other VM config (or use qm rescan)
For example, if I want to reassign disk-0 from VM 106 to 107 on local-lvm storage:
Code:
➜  ~ qm config 106
boot: order=net0
cores: 2
memory: 4096
name: pve
net0: e1000=0E:64:E2:65:2F:FA,bridge=vmbr0,firewall=1
numa: 0
sata0: local-lvm:vm-106-disk-0,size=16G
sockets: 1
➜  ~ vim /etc/pve/qemu-server/106.conf    # Remove the line with sata0
➜  ~ lvrename pve vm-106-disk-0 vm-107-disk-0
  Renamed "vm-106-disk-0" to "vm-107-disk-0" in volume group "pve"
➜  ~ qm rescan --vmid 107
rescan volumes...
VM 107 add unreferenced volume 'local-lvm:vm-107-disk-0' as 'unused0' to config
➜  ~ qm set 107 --scsi0 local-lvm:vm-107-disk-0
update VM 107: -scsi0 local-lvm:vm-107-disk-0
➜  ~ qm config 107
boot: order=net0
cores: 2
memory: 4096
name: pve
net0: e1000=72:67:5A:60:76:02,bridge=vmbr0,firewall=1
numa: 0
scsi0: local-lvm:vm-107-disk-0,size=16G
sockets: 1
 
Hi,

thank you, I will test it on an Testsystem. It is 'more' than I suspected.

Bye

Gregor
 
Test system sounds good! Making this easily available in the GUI is currently in development, by the way :)