Disk UUID on cloned/template VMs

jmjosebest

Renowned Member
Jan 16, 2009
192
38
93
Hello, we have automated the installation of new KVM type VMs with the templates.

The problem we see that all disks of different VMs have the same UUID.

In principle this has never been a problem for us, but I would like to correct it.

The approach I have is:

- With the VM off
- Generate a new UUID at node level.
- Assign that UUID to the VM disk/partition
- Mount the VM partition on the node.
- Edit the VM fastab modifying the UUID
- Unmount the partition
- Boot the VM

It doesn't seem to me the most correct way, but I can't think of any other way.

Any idea / recommendation ?

Thanks!
 
If you really need to do this, a much easier way would be to either:
a) Change the fstab in your template to use LVM path rather than uuid. Then there is no dependency if uuid changes later.
Add a startup script that autogenerates new uuid and assigns it on first boot.
b) Create a startup script that on first boot generates uuid, updates the partition, updates the fstab, reboots the client.

Both (a) and (b) can be done with CloudInit or other host automation tools. Mounting VM partition on a host seems icky.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox