How to Find UUID in Linux

UUID (Universally Unique identifier) is a 128-bit unique number standardized by the Open Software Foundation. UUID helps to identify partitions in Linux systems. It is generated by using the libuuid library (used by e2fsprogs) which is part of util-linux available by default in Linux from kernel version 2.15.1.

UUIDs are unique among all UUIDs created on the local system, and among UUIDs created on other systems.

The benefit of UUID comes If your system uses many data storage such as SAN, ISCSI, etc. Each time you move storage you don't have to worry about updating /etc/fstab.

In this tutorial, we will learn how to find UUIDs of storage drives in the Linux system.

Format of UUID

UUID is displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters.

For example:

9c79364e-99e1-42a8-ada1-86c31ad1fa76

How to find UUIDs

You can find the UUID of all the disk partitions of the Linux system using the command blkid.

To find UUIDs of your disk partitions connected to your system, run the following command.

$ sudo blkid

You will get the output as:

Listing UUIDs of connected device partitions.

Using lsblk command

You can find UUIDs of device partitions using lsblk command. To list out the UUID of device partitions run the following lsblk command.

$ sudo lsblk -o PATH,SIZE,RO,TYPE,MOUNTPOINT,UUID,MODEL

Output:

Listing UUID using lsblk command

Using ls command

Linux system represents all the devices including storage devices as files. So, the partitions with the UUID set are also stored as the file.

You can list all the UUIDs of partitions using the ls command, type:

$ sudo ls -l /dev/disk/by-uuid

Output:

Listing UUID using ls command

Using dumpe2fs

Dumpe2fs display the super block and blocks group information for the filesystem.

To print UUID of a specific disk, run:

$ dumpe2fs /dev/sda | grep UUID

Output:

dumpe2fs 1.45.5 (07-Jan-2020)
 Filesystem UUID:          b77fc34c-88c5-4ffc-94da-ee56195ee00f

Conclusion

Remember UUID won't be much helpful on laptops or home desktops where normally won't use high-end storage devices.

In this tutorial, I have covered a basic explanation of UUID in Linux system. You have learned about how to find UUID of connected device partitions in Linux system. Any feedback and response will be highly appreciated.

Leave a Comment