c++clinuxuuid

Get unique identifier of a system (not the MAC-address)?


I need to get a unique identifier of a Linux system that does not change when the system is rebooted (but may change when the user replaces nameable amounts of the hardware or formats harddisk).

Following solutions are NOT possible:

So...any other idea how a system could be identified uniquely?


Solution

  • I think the answer to your question will depend on what you consider to be a "permanent" part of the system. Let's assume you decide that the hard drive partitions are semi-permanent from your applications perspective, then calculate some sort of hash of the contents of /proc/partitions.

    That's something like:

    #!/bin/sh
    </proc/partitions sha1sum|cut "-d " -f1