How to find the UUID of a disk drive in Linux

- by

There are two ways I know of which will print the UUID of all disk drives attached to the current system:

blkid

/dev/sr0: UUID="2014-12-02-19-30-23-00" LABEL="CDROM" TYPE="iso9660" 
/dev/sda1: UUID="ae55a647-3c57-4ab5-9651-1389703fe6fe" TYPE="ext4" 
/dev/sda2: UUID="bMtCfO-zpDU-7U1t-DcHg-Fe9p-Cy1K-Se0e1I" TYPE="LVM2_member" 
/dev/sdb1: UUID="0982ce66-537a-497b-baaf-99136594f3e8" TYPE="ext4" 
/dev/mapper/VolGroup-lv_swap: UUID="8f0652a8-d79b-453f-aa2d-0ff0b5d0ae7b" TYPE="swap" 
/dev/mapper/VolGroup-lv_root: UUID="5afc1b25-e6cd-45b2-ad20-69f0fed323b9" TYPE="ext4" 
/dev/mapper/VolGroup-lv_home: UUID="94e15e98-1cff-49a9-b76a-a8f3a948e2ea" TYPE="ext4" 

or

ls -la /dev/disk/by-uuid

total 0
drwxr-xr-x. 2 root root 160 Mar 25 00:24 .
drwxr-xr-x. 5 root root 100 Mar 25 00:24 ..
lrwxrwxrwx. 1 root root  10 Mar 25 00:24 0982ce66-537a-497b-baaf-99136594f3e8 -> ../../sdb1
lrwxrwxrwx. 1 root root   9 Mar 25 00:24 2014-12-02-19-30-23-00 -> ../../sr0
lrwxrwxrwx. 1 root root  10 Mar 25 00:24 5afc1b25-e6cd-45b2-ad20-69f0fed323b9 -> ../../dm-1
lrwxrwxrwx. 1 root root  10 Mar 25 00:24 8f0652a8-d79b-453f-aa2d-0ff0b5d0ae7b -> ../../dm-0
lrwxrwxrwx. 1 root root  10 Mar 25 00:24 94e15e98-1cff-49a9-b76a-a8f3a948e2ea -> ../../dm-2
lrwxrwxrwx. 1 root root  10 Mar 25 00:24 ae55a647-3c57-4ab5-9651-1389703fe6fe -> ../../sda1

The UUID is required to permanently mount specific disk drives in /etc/fstab.



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site witout any pesky ads! More details here.

Add your voice!

This site uses Akismet to reduce spam. Learn how your comment data is processed.