Zarządzanie dyskiem

Find UUID of Storage Devices in Linux

Find UUID of Storage Devices in Linux
UUID is a unique identifier used in partitions to uniquely identify partitions in Linux operating systems. UUID is a property of the disk partition itself. So, if you install the hard drive containing the partitions on another Linux computer, the partitions will have the same UUID as before. So, that's a good thing.

The UUID of a partition is required mainly for mounting the partitions correctly in a computer system where hundreds of hard drives are installed. If you mount the hard drives or SSDs using UUIDs, there is almost zero changes of the wrong hard drive getting mounted and causing serious data loss.

Our usual computers and laptops where mostly 1 or 2 hard drives are installed and we need limited number of partitions won't benefit much from UUIDs.

In this article, I will show you how to find the UUID of storage devices such as hard drive or SSD partitions in Linux. So, let's get started.

Finding UUID with blkid:

You can find the UUID of all the disk partitions on your Linux system with the blkid command. The blkid command is available by default on most modern Linux distributions.

To find the UUIDs of your disk partitions, run the following command:

$ sudo blkid

As you can see, the filesystems that has UUID are displayed. A lot of loop devices are also listed.

In the earlier output, you have seen a lot of unnecessary loop devices. If you want to only list the filesystems that has UUID set, you may filter the output of the blkid command as follows:

$ sudo blkid | grep UUID=

You should be able to get a clean filtered output. Only the filesystems that has UUID set are listed.

Finding UUID with ls:

In Linux, all the devices including the storage devices are represented as files. So, the partitions with UUID set are also represented as files. You can list all these files with the ls command.

To list all the partitions and their UUIDs, run the following command:

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

As you can see, the partition name (i.e. sda1, sda2) and their UUIDs are listed.

Finding UUID with lsblk:

You can also list the UUID of your partitions with the lsblk command:

For example, to list UUID of your partitions with the lsblk command, run lsblk as follows:

$ sudo lsblk -f

As you can see, the UUIDs of the partitions are listed.

You can filter out all the loop devices to make the output cleaner as well. To do that, run the lsblk command as follows:

$ sudo lsblk -f | grep -v loop

As you can see, only the partitions with UUID are listed. The output is now much cleaner.

Where to Go Next:

Now that you know how to find the UUID of the storage devices in Linux, you can learn how to mount the partitions with UUID. I have written a dedicated article on how to mount partitions with UUID using the /etc/fstab file. You can read it at https://linuxhint.com/mount_partition_uuid_label_linux/

So, that's how you find the UUID of storage devices in Linux. Thanks for reading this article.

How to reverse Mouse and Touchpads scrolling direction in Windows 10
Mouse and Touchpads not only make computing easy but more efficient and less time-consuming. We cannot imagine a life without these devices, but still...
How to change Mouse pointer and cursor size, color & scheme on Windows 10
The mouse pointer and cursor in Windows 10 are very important aspects of the operating system. This can be said for other operating systems as well, s...
Gry Darmowe i otwarte silniki gier do tworzenia gier na Linuksa
Darmowe i otwarte silniki gier do tworzenia gier na Linuksa
Ten artykuł zawiera listę darmowych i otwartych silników gier, których można używać do tworzenia gier 2D i 3D w systemie Linux. Istnieje wiele takich ...