Find UUID of Storage Devices in Linux

29/12/2020
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.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Mua shadowsocks và hướng dẫn sữ dụng trên window

Đầu tiên tải file này và giải nén ra https://github.com/shadowsocks/shadowsocks-windows/releases/download/4.4.1.0/Shadowsocks-4.4.1.0.zip Bài...
05/01/2024

Nâng cấp MariaDB 10 cho plesk centos 7,8

vi /etc/yum.repos.d/MariaDB.repo [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey...
31/12/2020

50 Best Games for Linux

As a hard core gamer, I had some reservations for installing and using Linux when I was first introduced to it way back...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?
27/05/2024