How to Get UUID of Hard Disks

Valic —  December 27, 2012 — Leave a comment

The Universally Unique Identifier(UUID) is used to identify a hard disk independent form its device name or mount point. Is mostly used to access a device not by name, for example in /etc/fstab file.

There are many ways to get the UUID. I will show you two ways to do that.

Use the following command to show you all hard disk partitions by UUID:

ls -l /dev/disk/by-uuid

lrwxrwxrwx 1 root root 10 Dec 27 20:02 25c8851a-494b-49f8-a1ac-3df97ca16a5e -> ../../sda5
lrwxrwxrwx 1 root root 10 Dec 27 20:02 2a554679-b975-4f5d-bb41-97374d640f6a -> ../../sda3
lrwxrwxrwx 1 root root 10 Dec 27 20:02 ed57f181-75e7-4fc6-aebe-2865b358da84 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Dec 27 20:02 f6385c06-925a-426f-b689-21a210908ae0 -> ../../sda1

The second way is to use blkid tool:

blkid /dev/sda1
/dev/sda1: UUID="f6385c06-925a-426f-b689-21a210908ae0" TYPE="ext3"

blkid /dev/sdb1
/dev/sdb1: UUID="ed57f181-75e7-4fc6-aebe-2865b358da84" TYPE="ext4"

Enjoy.

Page 1 of 11