There are a few ways to get disk partition UUID (Universally Unique Identifier) in Linux, but some requires installation of additional software or packages.
The following 2 method would normally work on any Linux system.
UUID information is normally available in the
/dev/disk/by-uuid/ directory. The
UUID is a symlink to the device itself. The information can be viewed using the
shakir@anduril:~$ ls -l /dev/disk/by-uuid/ total 0 lrwxrwxrwx 1 root root 10 Nov 13 12:54 0AFAADB9FAADA185 -> ../../sda1 lrwxrwxrwx 1 root root 10 Nov 13 12:54 860e4946-19a2-40ee-837a-4eca537b0ec1 -> ../../sda4 lrwxrwxrwx 1 root root 10 Nov 13 12:54 a2b17bd1-3d94-48f5-93a2-c5f0f0fffc70 -> ../../sda2 lrwxrwxrwx 1 root root 10 Nov 13 12:54 d85c31d6-8ccc-45e2-add8-6d44330714c3 -> ../../sda3
The other method is to use the
blkid utility, which is normally installed by default in any Linux system. Specify the device name as an argument to view
UUID of specific device, or run it without argument to view
UUID information of all disk devices.
shakir@anduril:~$ sudo blkid /dev/sda4 /dev/sda4: UUID="860e4946-19a2-40ee-837a-4eca537b0ec1" TYPE="ext4" shakir@anduril:~$ sudo blkid /dev/sda4: UUID="860e4946-19a2-40ee-837a-4eca537b0ec1" TYPE="ext4" /dev/sda1: UUID="0AFAADB9FAADA185" TYPE="ntfs" /dev/sda2: UUID="a2b17bd1-3d94-48f5-93a2-c5f0f0fffc70" TYPE="ext4" /dev/sda3: UUID="d85c31d6-8ccc-45e2-add8-6d44330714c3" TYPE="ext4"
You'll need to use
sudo or run as the
root user to get the information.
Found a typo? Something is wrong in this article? Has something to add? Just edit it!Edit