3 Ways To Get the UUID of a Disk Partition in Ubuntu Linux

Get UUID Disk Partition Linux Ubuntu Techhyme

A Universally Unique Identifier (UUID) is a 128-bit number used to identify unique items or objects. In Linux, UUIDs are used to uniquely identify partitions and file systems. They are commonly used in place of traditional device names (such as /dev/sda1) to ensure that the correct file system is mounted in the event that the device name changes. UUIDs can be generated using the uuidgen command in Linux.

1. Using ls command

The command ls -l /dev/disk/by-uuid/ will list all the available UUIDs of storage device on the system.

Get UUID Ubuntu Techhyme

2. Using blkid command

The blkid command (short for “block ID”) is a command-line utility in Linux that is used to display information about block devices, such as partitions and file systems.

It can be used to determine the type of file system a device is using, as well as other information such as the UUID (Universally Unique Identifier) and LABEL of the device.

The blkid command can also be used to locate a device by its UUID or LABEL, which can be useful in identifying the correct device to mount. The command can be run without any arguments and it will list all the available block devices and their properties.

The blkid command is part of the util-linux package.

Get UUID Ubuntu Techhyme

And if you want to get the UUID of a specific block, just specify the block name as shown:

Command: blkid /dev/sda2

Get UUID Ubuntu Techhyme

3. Using lsblk command

lsblk is a command-line utility in Linux for displaying information about block devices, similar to the blkid command. It lists all the block devices on the system, including disk partitions and storage devices such as hard drives and USB drives.

The output of the lsblk command is organized in a tree-like format, showing the hierarchical relationship between different block devices. Each device is listed along with its major and minor number, size, type, filesystem type, mount point, and other information.

The command can be used to quickly identify the name, size, and type of a device, as well as whether it is currently mounted and where it is mounted. It is also part of the util-linux package.

Get UUID Ubuntu Techhyme

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:

Command: lsblk -f | grep -v loop

Get UUID Ubuntu Techhyme

 

You may also like:

Related Posts

Leave a Reply