Stable disk identifiers prevent mounts, services, and boot processes from depending on device names that can change between reboots. A UUID (Universally Unique Identifier) attached to a partition or block device remains consistent even if /dev/sdX numbering shifts, keeping storage configuration predictable.

On Linux systems, the udev subsystem exposes these identifiers as symbolic links under /dev/disk/by-uuid while tools such as lsblk and blkid read superblock metadata to show UUID, file system type, label, and PARTUUID information. Configuration files like /etc/fstab can reference these stable values instead of raw device paths to ensure the correct partitions mount every time.

Enumerating and using UUID values relies on access to the underlying block devices, which often requires elevated privileges and careful distinction between system disks and removable media. Confusing system partitions with external drives or writing incorrect UUID entries into /etc/fstab risks failed mounts or an unbootable system, so cross-checking outputs before making changes remains essential.

Steps to find disk and partition UUIDs:

  1. Open a terminal with sudo privileges.
    $ whoami
    user
  2. Display block devices and existing file systems including UUID columns with lsblk.
    $ lsblk -f
    NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
    sda
    ├─sda1 ext4   root  11111111-2222-3333-4444-555555555555 /
    ├─sda2 swap         66666666-7777-8888-9999-AAAAAAAAAAAA [SWAP]
    sdb
    └─sdb1 ext4   data  BBBBBBBB-CCCC-DDDD-EEEE-FFFFFFFFFFFF /mnt/data

    The UUID column in lsblk output provides a quick overview of identifiers already visible to the system.

  3. Inspect symbolic links under /dev/disk/by-uuid to see how each UUID maps to a concrete device node.
    $ 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

    Each UUID symlink points to a device such as /dev/sda3, providing a stable identifier even when kernel device ordering changes.

  4. List all known identifiers using blkid to include file system type and PARTUUID information.
    $ blkid
    /dev/sda1: LABEL="root" UUID="11111111-2222-3333-4444-555555555555" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
    /dev/sda2: UUID="66666666-7777-8888-9999-AAAAAAAAAAAA" TYPE="swap" PARTUUID="ffffffff-1111-2222-3333-444444444444"
    /dev/sdb1: LABEL="data" UUID="BBBBBBBB-CCCC-DDDD-EEEE-FFFFFFFFFFFF" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="99999999-0000-aaaa-bbbb-cccccccccccc"
    /dev/sr0: BLOCK_SIZE="2048" UUID="2020-10-22-14-30-30-00" LABEL="Ubuntu 20.10 amd64" TYPE="iso9660" PTTYPE="PMBR"

    blkid reads on-disk metadata to report UUID, file system type, and related tags for each detected block device.

  5. Query a specific partition by passing its device file to blkid when only one UUID is needed.
    $ blkid /dev/sda3
    /dev/sda3: UUID="a7d71686-0a65-4402-b6e6-b58430ef8351" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="0ea90c96-1b56-4c51-b07a-02e09285f291"

    Replace /dev/sda3 with the actual device node to retrieve a single partition’s UUID and related details.

  6. Cross-check discovered UUID values against entries in /etc/fstab to understand how partitions are configured to mount at boot time.
    $ grep UUID /etc/fstab
    UUID=11111111-2222-3333-4444-555555555555 /     ext4  defaults  0 1
    UUID=BBBBBBBB-CCCC-DDDD-EEEE-FFFFFFFFFFFF /mnt/data ext4 defaults  0 2

    Incorrect UUID entries in /etc/fstab can prevent critical file systems from mounting and may render the system unbootable.

  7. Re-run lsblk -f after any changes to confirm that partitions and their UUID values align with the intended configuration.
    $ lsblk -f
    NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
    sda
    ├─sda1 ext4   root  11111111-2222-3333-4444-555555555555 /
    ├─sda2 swap         66666666-7777-8888-9999-AAAAAAAAAAAA [SWAP]
    sdb
    └─sdb1 ext4   data  BBBBBBBB-CCCC-DDDD-EEEE-FFFFFFFFFFFF /mnt/data

    Matching UUID values across lsblk, /dev/disk/by-uuid, and /etc/fstab confirms consistent identification of disks and partitions.

Discuss the article:

Comment anonymously. Login not required.