LinuxXIII · Disks and Block DevicesPersistent naming
Persistent naming - UUIDs, labels, and stable paths
What you'll learn
- Explain why /dev/sd* names are not stable across reboots
- Use UUIDs in /etc/fstab for reliable mounting
- Use labels for human-readable identification
- Recognise when to use filesystem UUID, LVM UUID, or partition UUID
Prerequisites
Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09
A common production failure is a host that does not boot
because /etc/fstab referenced /dev/sda1 and a hardware
change made the disk /dev/sdb1 after reboot. The fix is to
use stable identifiers that survive hardware changes.
Why /dev/sd* is not stable
Device names like /dev/sda are assigned by the kernel in
probe order. The first SATA device found is sda; add another
disk and it might become sdb. The order depends on:
- SATA port numbers in the firmware
- USB device insertion order
- Hotplug events
- BIOS enumeration quirks
Any of these can change between reboots. Using /dev/sd* in
/etc/fstab is a recipe for “the host does not boot” after the
next hardware change.
The three stable identifiers
$ blkid -o device,uuid,label,partuuid /dev/sda1 /dev/sda2/dev/sda1: 1a2b-3c4d-... system-boot
/dev/sda2: 5e6f-7a8b-...| Identifier | Set by | Stable across | Use for |
|---|---|---|---|
/dev/sda1 | Kernel probe order | No | Debugging only |
UUID=... | Filesystem at mkfs | Reformat, but not hardware | /etc/fstab (default) |
LABEL=... | Filesystem at mkfs | Reformat, not hardware | Removable media |
PARTUUID=... | Partition table at creation | Repartition, not hardware | Identifying a specific partition |
| LVM UUID | LVM metadata | Reformat of PV | fstab for LVM |
/dev/disk/by-uuid/... | udev | Hardware changes | Symlink for scripts |
The /etc/fstab pattern
$ cat /etc/fstabUUID=1a2b-3c4d-... /boot ext4 defaults 0 2
UUID=5e6f-7a8b-... / ext4 defaults,noatime 0 1
UUID=9a8b-7c6d-... /var ext4 defaults 0 2
UUID=f1e2-d3c4-... swap swap defaults 0 0When to use labels instead
Labels are human-readable and useful for:
- Removable media that you want to identify by purpose (LABEL=DATA, LABEL=BACKUP).
- Multi-OS hosts where the same disk is used in different contexts.
- Build artifacts (live USB sticks, rescue disks) where the UUID is unknown at boot time.
$ e2label /dev/sdc1 BACKUP-2026Knowledge check
Knowledge check · 3 questions
Q1. Why should /etc/fstab use UUID= instead of /dev/sda1?
Q2. Labels are unique across the system; you cannot have two filesystems with the same label.
Q3. Which of the following are correct for persistent disk identification? Select all that apply.
Passing score: 75%. Answers are checked in this browser.