Skip to main content
RunBook Academy

LinuxXIII · Disks and Block DevicesPersistent naming

Persistent naming - UUIDs, labels, and stable paths

Foundation⏱ ~8 minbashblkidlsblkfindfs

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

Not yet marked complete on this device.

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

Read-only / Safestable identifiers
$ blkid -o device,uuid,label,partuuid /dev/sda1 /dev/sda2
/dev/sda1: 1a2b-3c4d-... system-boot
/dev/sda2: 5e6f-7a8b-...
IdentifierSet byStable acrossUse for
/dev/sda1Kernel probe orderNoDebugging only
UUID=...Filesystem at mkfsReformat, but not hardware/etc/fstab (default)
LABEL=...Filesystem at mkfsReformat, not hardwareRemovable media
PARTUUID=...Partition table at creationRepartition, not hardwareIdentifying a specific partition
LVM UUIDLVM metadataReformat of PVfstab for LVM
/dev/disk/by-uuid/...udevHardware changesSymlink for scripts

The /etc/fstab pattern

Read-only / Safeproduction fstab
$ cat /etc/fstab
UUID=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 0

When 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.
Configuration changeset label
$ e2label /dev/sdc1 BACKUP-2026

Knowledge check

Knowledge check · 3 questions

  1. Q1. Why should /etc/fstab use UUID= instead of /dev/sda1?

  2. Q2. Labels are unique across the system; you cannot have two filesystems with the same label.

  3. Q3. Which of the following are correct for persistent disk identification? Select all that apply.

Passing score: 75%. Answers are checked in this browser.