I need the UUID of a disk partition under Linux. The partition is mounted but does not show up under

ls -l /dev/disk/by-uuid

as can happen when duplicate UUIDs exist, for example, following emergency backup using ddrescue.

How can I find the UUID?


The e2fsprogs package offers blkid

$ blkid
/dev/sdb1: UUID="ac115722-c8ce-44d2-ab0c-1d284d6e4d76" TYPE="ext4" 
/dev/sda2: UUID="cd6580d2-9671-4d94-b46f-0301bb563e30" TYPE="ext4" 

In table format

$ blkid -o list
device     fs_type label    mount point    UUID
/dev/sdb1  ext4             /mnt/dmp1      ac115722-c8ce-44d2-ab0c-1d284d6e4d76
/dev/sda2  ext4             /              cd6580d2-9671-4d94-b46f-0301bb563e30

For a specific device

$ blkid /dev/sdb1
/dev/sdb1: UUID="ac115722-c8ce-44d2-ab0c-1d284d6e4d76" TYPE="ext4"

Or with no extraneous information

$ blkid -s UUID -o value /dev/sdb1

Those subsequently wanting to change UUIDs might like these answers for ordinary and LVM partitions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.