A Universally Unique IDentifier (UUID) is a randomly generated 128-bit value assigned to partitions or block devices in Linux systems. UUIDs provide a more stable and reliable method of identifying partitions than traditional device names, such as /dev/sda1. UUIDs can be used for mounting filesystems via /etc/fstab by specifying the UUID value in a special block device (the first field).
UUIDs are typically symbolic links to the actual device names within the /dev directory. To retrieve a partition's UUID, you can browse the /dev/disk/by-uuid/ directory or use various command-line utilities available in Linux.
$ ls -l /dev/disk/by-uuid/ total 0 lrwxrwxrwx 1 root root 9 Feb 27 06:29 2020-10-22-14-30-30-00 -> ../../sr0 lrwxrwxrwx 1 root root 10 Feb 27 06:23 9B8B-2022 -> ../../sda2 lrwxrwxrwx 1 root root 10 Feb 27 06:23 a7d71686-0a65-4402-b6e6-b58430ef8351 -> ../../sda3
The absolute path for ../../sda3 is /dev/sda3
$ blkid /dev/sda3: UUID="a7d71686-0a65-4402-b6e6-b58430ef8351" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="0ea90c96-1b56-4c51-b07a-02e09285f291" /dev/sr0: BLOCK_SIZE="2048" UUID="2020-10-22-14-30-30-00" LABEL="Ubuntu 20.10 amd64" TYPE="iso9660" PTTYPE="PMBR"
blkid is installed by default in most Linux distributions.
$ blkid /dev/sda3 /dev/sda3: UUID="a7d71686-0a65-4402-b6e6-b58430ef8351" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="0ea90c96-1b56-4c51-b07a-02e09285f291"
More options for blkid:
$ blkid --help Usage: blkid --label <label> | --uuid <uuid> blkid [--cache-file <file>] [-ghlLv] [--output <format>] [--match-tag <tag>] [--match-token <token>] [<dev> ...] blkid -p [--match-tag <tag>] [--offset <offset>] [--size <size>] [--output <format>] <dev> ... blkid -i [--match-tag <tag>] [--output <format>] <dev> ... Options: -c, --cache-file <file> read from <file> instead of reading from the default cache file (-c /dev/null means no cache) -d, --no-encoding don't encode non-printing characters -g, --garbage-collect garbage collect the blkid cache -o, --output <format> output format; can be one of: value, device, export or full; (default: full) -k, --list-filesystems list all known filesystems/RAIDs and exit -s, --match-tag <tag> show specified tag(s) (default show all tags) -t, --match-token <token> find device with a specific token (NAME=value pair) -l, --list-one look up only first device with token specified by -t -L, --label <label> convert LABEL to device name -U, --uuid <uuid> convert UUID to device name <dev> specify device(s) to probe (default: all devices) Low-level probing options: -p, --probe low-level superblocks probing (bypass cache) -i, --info gather information about I/O limits -S, --size <size> overwrite device size -O, --offset <offset> probe at the given offset -u, --usages <list> filter by "usage" (e.g. -u filesystem,raid) -n, --match-types <list> filter by filesystem type (e.g. -n vfat,ext3) -h, --help display this help -V, --version display version For more details see blkid(8).
Comment anonymously. Login not required.