linuxvirtual-machinevirtualizationuuidbios

Is there a UUID type of value in Linux that can uniquely identify an instance of a VM?


I have an app that runs in Linux. Each one will try to get a UUID from OS and report to a centralized server. I want to make sure all instance are running with globally unique UUID.

If the linux is on bare metal, it can just read the UUID (say, from dmidecode command). But if it's on VM, the UUID (from dmidecode) can potentially be equal since the VM can be copied or moved.

Any ideas?

By the way, for Linux running on physical hardware (not on VM), if user changes memory, NIC etc, will UUID change?

Thanks in advance.


Solution

  • If the linux is on bare metal, it can just read the UUID (say, from dmidecode command). But if it's on VM, the UUID (from dmidecode) can potentially be equal since the VM can be copied or moved.

    This is not actually the case for VMware products. The BIOS UUID (the one returned by dmidecode) is used as the inventory UUID property of ESX hosts and vCenter, and duplication of the UUID is not allowed on the same system. This means only one machine can have that UUID per vCenter, or per host if there is no vCenter. I've used this UUID as an identifier in the past with success.

    To run your program more than once, they'd have to install it in a VM on a separate host, or in an entirely different vCenter. That's an awful lot of resources required just to run more than one of your program, and I think it's well beyond the diminishing returns of license enforcement.

    Workstation uses the same data layout as ESX/vCenter, so I expect that it has the same restriction.