clone linux VM with virtual LVM disk

m.ardito

Active Member
Feb 17, 2010
1,473
16
38
Torino, Italy
If I create a KVM template of a VM (say, ubuntu server) which has its virtual disk configured as (internal) LVM and than convert it to a template, then I can clone it to get several other VMs based on this machine.

Of course VM template internal LVM PVs/VGs/LVs all have their names and UUID like

Code:
  --- Physical volume ---
  PV Name               /dev/vda5
  VG Name               ubuntu-webserver
  ...
  PV UUID               UHqIVU-BKta-3R5x-9HvP-CSNG-r6gH-w87UIi

  --- Volume group ---
  VG Name               ubuntu-webserver
  System ID
  ...
  Free  PE / Size       0 / 0
  VG UUID               pfg6xD-nhx7-ZkJR-D003-mNEz-vg0o-a2w9Vf

  --- Logical volume ---
  LV Name                /dev/ubuntu-webserver/swap_1
  VG Name                ubuntu-webserver
  LV UUID                YngPz7-dFCj-hGNN-6RyY-fxH3-VNHV-HczVbO
  ...

now, If I clone other VM from this tempate, all will get the same PVs/VGs/LVs names/UUID.
since their disks would be an exact clone.

The same would happen if one would restore a VM backup to another VMID and then changing its ssh keys/ip/hostname, etc.
The disk LVM would remain the one of the original VM from which the backup was taken.

Now, would this fact be a problem for the pve nodes hosting them?
Would "reused" PVs/VGs/LVs names/UUID inside several VMs conflict in some way?

I always thought that what's inside a VM (kvm) disk is completely unknown to the host and other VMs/CTs, but I got this hint from another thread, based on another issue.

Then, if troubles could arise from this names/UUID "reuse", what is suggested to do?
vgrename/lvrename and vgchange/lvchange, other?

Thanks,
Marco
 
Hello MArco

Now, would this fact be a problem for the pve nodes hosting them?
Would "reused" PVs/VGs/LVs names/UUID inside several VMs conflict in some way?

No! Recently I made 10 (linked) clones from a debian using (same) LVMs. Works fine. The only one thing I had to adapt (but it´s neither a problem for/frompve nor related to LVM) was the certificate for ssl, because other connected machines in the networked complained that they used the same key.

I always thought that what's inside a VM (kvm) disk is completely unknown to the host and other VMs/CTs, but I got this hint from another thread, based on another issue.

That´s also my understanding (at least for VMs, for CTs it may be different but this has no relevance here) - but I am curios about the thread you mentioned, do you have the link to it?

Kind regards

Mr.Holmes
 

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!