How to Get the UUID of a Disk Partition in Linux
UUID is a property of disk partitions used to uniquely identify them. Here are various ways to get the UUID of a disk partition in the Linux command line.
UUID (Universally Unique Identifiers) is a property of disk partitions and is crucial while managing servers with hundreds of drives.
And the easiest way to get UUID is to list the contents of /dev/disk/by-UUID using the ls command:
ls -l /dev/disk/by-uuid/
The highlighted text in light blue color is the UUID of the partition highlighted with yellow color.
That's just one way to know the UUID of a partition. There are couple of more ways as well.
Using the blkid utility to get UUID
The blkid utility is used to get information about data blocks in Linux.
And when used without any options, you get details, including the UUID of every memory block present in the system:
And if you want to get the UUID of a specific block, just specify the block name as shown:
Using the lsblk utility to get UUID
The lsblk utility is mainly used to list block devices but when used with the
-f option, it can get you additional info, including the UUID of every block:
And if you are on Ubuntu or your system is loaded with snap packages, they will be listed here too. In that case, you can filter those results using the grep command:
lsblk -f | grep -v loop
Through this tutorial, I explained how you could get the UUID of a disk partition in Linux. And if you have any other questions, feel free to let me know in the comments.