How to find UUID of disk in Linux

UUID or Universal Unique Identifier is a universal unique identifier that can be used to uniquely identify a specific device of the computer. On Linux operating systems, the UUID is often used to identify partitions in Grub or in /etc/fstab. It is very convenient, because if you remove the disc or connect it to another SATA connector, its name in the system will change, but the UUID will remain the same.

But this method has a drawback. The UUID is calculated on the basis of the metadata partition or disk, so if you resize it, the UUID will change too, which will lead to breakage of the system and you will not be able to load. The situation can be corrected only by entering the correct UUID.

How to find UUID of disk in Linux

1. ls

Let’s look at how to find the UUID of a disk in Linux. All disks and partitions are listed in the virtual directory /dev/. There is a subdirectory /dev/disk/by-uuid/ where you can see the UUID identifiers are all connected to the system disks. To do this, run:

ls-la /dev/disk/by-uuid/

Line consisting of a large number of numbers and letters, highlighted in turquoise is the UUID.

2. blkid

Yet to see the UUID you can use the blkid utility. It must be run as root, but it shows information only for the desired section. For example, to view the UUID for the partition /dev/sda6 run:

sudo blkid /dev/sda6

Here the UUID displayed in this format:

UUID="b386d309-05c1-42c8-8364-8d37270b69e0"

This line can already be fully inserted into /etc/fstab or the boot loader configuration grub. The utility allows you to view information for multiple devices:

sudo blkid /dev/sd*

3. lsblk

Another option is that lsblk utility, which can show UUID:

lsblk -o +uuid,name

4. GUI

If you don’t want to use the terminal, you can always see the UUID in the GUI. To do this, use the Gnome Disks utility. It can be found in the main menu of the operating system:

To see the UUID simply select the desired hard drive and click on the section for which to view information:

Insights

The UUID is often used when working with partitions in Linux despite the fact that the usual section names much easier to remember. I hope this information was useful for you.

Source: losst.ru

(Visited 1,451 times, 23 visits today)