Linux Device Uniqueness

Problem

Determining Linux Devices Uniqueness

Uniqueness in Linux has 2 possible uniqueness combinations, strong and weak. The most appropriate uniqueness is applied based on the OS version and whether certain commands exist or not.

Solution

Strong

Strong uniqueness is based on identifying the root partition/drive and retrieving its BLKID. This BLKID is unique to a drive and is retrieved by the following command:

cat /etc/fstab

This command lists the drives currently installed on the device. We then parse this output and attempt to identify the root drive “/”. If we cannot identify a root drive or if the cat /etc/fstab command returns the error code 127 we enable the weak uniqueness flag for the device. If we do identify the root drive, we then parse out its label and use the blkid command. The blkid command is run in 2 variations in attempt to support different Linux OS’s and to removing caching issues.

blkid 
or blkid 
<root drive>

Weak

If weak uniqueness has been enabled we use the ifconfig command to identify the first MAC address. This returns a list of all active network cards and their associated information.

ifconfig

Filter by label

There are no items with the selected labels at this time.