How to Find a Disk's UUID in Linux

Practice



So, we have Linux, and we want to find out the UUID of some connected disk. Looking in /dev/disks... won't work, since partitions can appear not only after a system reboot, but can also be attached online, right while the OS is running. For example, this is how we can attach iSCSI disks, etc.

To find out the UUID of any disk, you just need one small, simple command:
$ sudo blkid

In response you'll see something like this:
/dev/xvda3: LABEL="/" UUID="13abb28c-cf37-481b-bf3d-9df1f30adc3e" TYPE="ext3"
/dev/xvda2: LABEL="SWAP-xvda2" TYPE="swap"
/dev/xvda1: LABEL="/boot" UUID="82f2bd4b-ece2-4a4b-8506-dbe7bd02506b" TYPE="ext3"
/dev/xvdb1: UUID="e9bcdb18-2f8d-4ca9-bfe1-f6ce05400666" TYPE="ext3"

From here everything is clear - the correspondence between the UUID and the device file in /dev.

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "LINUX operating system"

Terms: LINUX operating system