I have a fairly unique situation where I am trying to uniquely identify USB devices that are plugged into a Raspbian Linux system. I have a pool of physical devices and any combination of them may be attached to the system at any time.

I am currently making use of the device serial number to determine which devices are present which works fantastic for 9 out of 10 devices, however, it would seem that not all USB devices have unique serial numbers and some devices don't have serial numbers at all.

I am looking for an alternative solution that I can use to "fingerprint" a USB device in such as way as to uniquely identify it's presence when plugged into the system.

  • What type of USB devices are we talking about? Mass storage? HID? As you discovered, USB serial numbers are generally worthless because most device makers cannot be bothered to actually set unique values.
    – Daniel B
    Nov 13, 2018 at 19:55
  • I'm really hoping to be able to say any type of device. I'm currently dealing with license dongles, logic analyzers, and several different types of serial interfaces. But I envision that the scope of the system will grow to include other, arbitrary USB devices in the future.
    – julienj
    Nov 13, 2018 at 19:57
  • Ah yes you’re basically out of luck then. USB devices in general don’t have enough identifiable information to uniquely distinguish devices of the same make and model. Except for the serial number.
    – Daniel B
    Nov 13, 2018 at 20:01
  • And you better hope that the serial number is unique, or present at all. Nov 13, 2018 at 20:28

1 Answer 1


What you are searching is called uuid or Universal Unique Identifier. It's assigned to devices on Linux for the purpose of identification.

You can get those uuid by running the following command:

$ sudo blkid /dev/sda1
/dev/sda1: UUID="2A64794864791831" TYPE="ntfs"

If you have multiple devices, just run

$ sudo blkid
  • 3
    This is a great option for storage devices but I'm dealing with a mixture of other device types (license dongles, serial interfaces, logic analyzers). Is there some way that I can assign such a UUID to arbitrary devices?
    – julienj
    Nov 13, 2018 at 19:56
  • @julienj Unfortunately no. It's not a Linux feature, but filesystem property. Results will differ between filesystems (eg. FAT32 will have much shorter, 4-byte UUIDs). These values can also easily be changed and they will change when device is formatted.
    – gronostaj
    Nov 14, 2018 at 6:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .