Mount Linux Filesystems with UUID and Labels

Tested on RHEL 10.2 (Coughlan)
Package util-linux 2.40.2-18.el10
coreutils 9.5-8.el10_2
systemd 257-23.el10_2.2
Applies to Ubuntu, Debian, Kali Linux, Linux Mint, Pop!_OS, Raspberry Pi OS, elementary OS, Zorin OS, Parrot OS, MX Linux, RHEL, Rocky Linux, AlmaLinux, Oracle Linux, CentOS Stream, Fedora, Arch Linux
Privilege sudo or root for mount, fstab edits, and label changes
Scope Persistent local mounts with /etc/fstab; UUID and LABEL identifiers; mount options; mount -a and findmnt verification; single-entry mount; bad-entry recovery. Does not cover partitioning, formatting, NFS exports, autofs, or ISO/USB/network mount workflows.
Related guides Create and mount filesystems
Linux mount command
lsblk command
LVM in Linux
RHCSA tutorial
IMPORTANT
This guide covers persistent mounting of already formatted local filesystems with /etc/fstab. It does not walk through creating partitions, mkfs, NFS server setup, or autofs maps—those live in separate storage articles linked where they apply.

A mount /dev/sdb1 /data command lasts until reboot. To keep /data after every boot, you register the filesystem in /etc/fstab with a stable identifier—usually UUID=—so the mount survives when the kernel reorders disks. The walkthrough below uses a spare data disk on the lab host; if you still need partitioning or mkfs, start with create and mount filesystems first.


How Persistent Filesystem Mounting Works

Linux separates three ideas beginners often conflate:

Concept What it is
Block device A disk partition or logical volume such as /dev/sdb1 or /dev/mapper/rhel-root
Filesystem The formatted data structure on that device (XFS, ext4, swap, and so on)
Mount point A directory where the filesystem tree is attached, such as /data. The directory does not have to be empty, but existing contents are hidden while another filesystem is mounted there

A temporary mount runs mount once. The kernel attaches the filesystem until you umount or reboot. A persistent mount adds a line to /etc/fstab so boot tools and mount -a know which source, type, and options to apply at /data every time.

Device paths like /dev/sdb1 are not stable identifiers. BIOS order, new disks, or USB insertions can shift names so yesterday's /dev/sdb1 becomes /dev/sdc1. UUID and LABEL identify the filesystem (or swap area) itself, which is why Anaconda writes UUID lines on RHEL installs.

On the lab host, Anaconda already registered root, boot, and swap by UUID:

bash
head -15 /etc/fstab

Sample output:

output
#
# /etc/fstab
# Created by anaconda on Mon Aug  3 05:57:29 2026
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=96b3becc-49da-4746-89b4-6b44cc1daf47 /                       xfs     defaults        0 0
UUID=cbd838ad-a342-4b56-b65f-da022e195971 /boot                   xfs     defaults        0 0
UUID=78531da6-a389-46e8-9bad-267572940826 none                    swap    defaults        0 0

Those comments remind you that stable symlinks live under /dev/disk/ and that systemd reads the same file.


/etc/fstab Quick Reference

Keep this table nearby while you edit. Field meanings are expanded in the next section.

Example line shapes:

text
UUID=<uuid>  /data   xfs   defaults  0  0
LABEL=backup /backup ext4  defaults  0  2
Task Command
Show filesystem UUIDs and types lsblk -f
Inspect one block device blkid /dev/sdb1
List active mounts findmnt
Mount all fstab entries mount -a
Reload generated mount units systemctl daemon-reload
Show source for one mount point findmnt /data
Validate fstab before reboot findmnt --verify

Understand the Six /etc/fstab Fields

Each non-comment line has six fields separated by whitespace or tabs:

text
<identifier>  <mount point>  <type>  <options>  <dump>  <fsck>
  1. Device or filesystem identifierUUID=…, LABEL=…, /dev/mapper/…, or a device path. Prefer UUID for local data disks.
  2. Mount point — Directory path where the filesystem attaches (or none for swap). Existing files in the directory are hidden while another filesystem is mounted on that path.
  3. Filesystem typexfs, ext4, swap, vfat, and so on. Use auto only when you understand the risk.
  4. Mount options — Comma-separated flags such as defaults or rw,noatime.
  5. dump0 skips the legacy dump backup tool; 1 includes the filesystem. Almost always 0 today.
  6. fsck order0 skips boot-time fsck for this filesystem. 1 is traditionally the root filesystem on ext4. 2 checks other ext4 filesystems after root. On RHEL, XFS fstab lines use 0 in this column—fsck.xfs is only a compatibility stub and XFS does not perform a traditional boot-time fsck. The lab's XFS root, boot, and data examples all use 0 0.

Device Name vs UUID vs LABEL

Identifier Points at Stable when disks reorder?
/dev/sdb1 Partition device node No
UUID=… Filesystem superblock Yes
LABEL=… Filesystem label in superblock Yes, if unique
PARTUUID=… Partition table entry Partition stable, not filesystem
/dev/disk/by-uuid/… Symlink to device Same as UUID

PARTUUID identifies the partition slot, not the filesystem inside it. After reformatting the partition, the PARTUUID may stay while the filesystem UUID changes.

Stable symlinks on the lab host map UUIDs to block devices:

bash
ls -la /dev/disk/by-uuid/ | head -6

Sample output:

output
total 0
drwxr-xr-x. 2 root root 100 Aug  8 15:08 .
drwxr-xr-x. 7 root root 140 Aug  8 15:08 ..
lrwxrwxrwx. 1 root root  10 Aug  8 15:08 78531da6-a389-46e8-9bad-267572940826 -> ../../dm-1
lrwxrwxrwx. 1 root root  10 Aug  8 15:08 96b3becc-49da-4746-89b4-6b44cc1daf47 -> ../../dm-0
lrwxrwxrwx. 1 root root  10 Aug  8 15:08 cbd838ad-a342-4b56-b65f-da022e195971 -> ../../sda2

Before any labeled filesystem existed, /dev/disk/by-label/ was absent on this VM—labels appear only after you set them on a formatted filesystem.


Find a Filesystem UUID

List friendly columns for every block device:

bash
lsblk -f

Sample output (lab host, trimmed):

output
NAME          FSTYPE      FSVER    LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda2        xfs                        cbd838ad-a342-4b56-b65f-da022e195971      1.4G    26% /boot
└─sda3        LVM2_member LVM2 001       kK0T8E-lrVU-PAkS-fdwT-wIlJ-S32a-VaNd7X
  ├─rhel-root xfs                        96b3becc-49da-4746-89b4-6b44cc1daf47     15.8G    37% /
  └─rhel-swap swap        1              78531da6-a389-46e8-9bad-267572940826                  [SWAP]
sdb

Read FSTYPE for the filesystem type, LABEL when set, UUID for fstab, and MOUNTPOINTS for where it is already attached.

For one partition, blkid prints the exact strings you paste into fstab:

bash
blkid /dev/sda2

Sample output:

output
/dev/sda2: UUID="cbd838ad-a342-4b56-b65f-da022e195971" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="148448c7-94ed-4278-b445-c84cc78e4a22"

That UUID matches the /boot line in /etc/fstab and the findmnt source below.


Assign and Use Filesystem Labels

Labels are optional human-readable names stored in the filesystem superblock. They must be unique among filesystems on the same machine if you mount by LABEL=.

Brief tool reference:

Filesystem Set or change label
XFS xfs_admin -L newlabel /dev/sdb1 — unmount the filesystem first
ext4 e2label /dev/sdb1 newlabel or tune2fs -L newlabel /dev/sdb1
VFAT fatlabel /dev/sdb1 NEWLABEL

On the lab data disk the XFS label was set during formatting with mkfs.xfs -L labdata. To read it later:

bash
xfs_admin -l /dev/sdb1

Sample output:

output
label = "labdata"

Duplicate labels make LABEL= mounts ambiguous—always verify with blkid after changes.


Mount a Filesystem Temporarily by UUID

Before you edit fstab, confirm the UUID mounts cleanly. Create the mount point if it does not exist:

bash
mkdir -p /data

Mount by UUID (use the value from blkid):

bash
mount UUID=276aa1ee-3141-49fc-a2d3-8b631bbc281a /data

mount prints nothing on success. Confirm the attachment:

bash
findmnt /data

Sample output:

output
TARGET SOURCE    FSTYPE OPTIONS
/data  /dev/sdb1 xfs    rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota

The source shows /dev/sdb1 even though you passed UUID—findmnt resolves the device node.


Create a Persistent Mount with UUID

This is the central workflow. The lab used /dev/sdb1 with XFS and label labdata on a spare 10 GiB disk—filesystem creation is out of scope here; see create and mount filesystems if you still need that step.

Capture the UUID you will paste into fstab:

bash
blkid /dev/sdb1

Sample output:

output
/dev/sdb1: LABEL="labdata" UUID="276aa1ee-3141-49fc-a2d3-8b631bbc281a" BLOCK_SIZE="512" TYPE="xfs" PARTLABEL="primary" PARTUUID="7bbbdf4f-1690-4167-b852-f866a80a2ce5"

Back up fstab before every edit:

bash
cp -a /etc/fstab /etc/fstab.bak

Add one line (tabs or spaces between fields):

text
UUID=276aa1ee-3141-49fc-a2d3-8b631bbc281a /data xfs defaults 0 0

Run systemctl daemon-reload so systemd regenerates .mount units from the edited fstab. That step updates generated unit definitions for the running manager—it does not perform the mount test.

mount -a is independent: the mount utility reads /etc/fstab itself and tries to attach every entry that is not already mounted. Run both after a normal fstab edit; they answer different questions (unit regeneration versus whether the lines actually mount).

bash
systemctl daemon-reload

If /data was mounted manually during testing, unmount so mount -a exercises the fstab line:

bash
umount /data

Apply every fstab entry that is not already mounted:

bash
mount -a

mount -a exits silently when all entries succeed. Verify:

bash
findmnt /data

Sample output:

output
TARGET SOURCE    FSTYPE OPTIONS
/data  /dev/sdb1 xfs    rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota

Run the fstab verifier:

bash
findmnt --verify

Sample output:

output
Success, no errors or warnings detected

On a maintenance host, reboot once and run findmnt /data again to confirm the mount returns without manual mount. The shared lab skipped reboot to avoid disrupting other work; mount -a plus findmnt --verify is the minimum gate before you reboot production systems.


Create a Persistent Mount with LABEL

Replace only the first fstab field when the label is unique:

text
LABEL=labdata /data xfs defaults 0 0

Advantages: readable in findmnt and logs. Limitations: labels are user-assigned and can collide; UUIDs are globally unique by design. Many teams use UUID in fstab and labels only for operator notes.

Test LABEL mounts without fstab first:

bash
umount /data

Mount by label to confirm the name resolves to the intended filesystem:

bash
mount LABEL=labdata /data

Confirm:

bash
findmnt /data

Sample output:

output
TARGET SOURCE    FSTYPE OPTIONS
/data  /dev/sdb1 xfs    rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota

After you trust the label, swap the fstab identifier field, run systemctl daemon-reload and mount -a on a booted system, then findmnt --verify.


Understand Common Mount Options

The fourth fstab field is a comma-separated list. defaults on RHEL is typically rw,suid,dev,exec,auto,nouser,async.

Option Effect
defaults Distribution default bundle—usually read-write with normal device and suid behavior
ro / rw Read-only versus read-write
noexec Block executable binaries from this filesystem
nosuid Ignore setuid bits on files
nodev Block device nodes on this filesystem
noatime Skip updating file access times on read (can reduce write load)
nofail Boot continues if this mount fails—useful for optional data disks

This article is not a hardening guide—pick options that match how the data is used. nofail is common for non-critical volumes so a missing USB disk does not drop the system into emergency mode.


Mount Only One /etc/fstab Entry

When the line exists in fstab, mount can take only the mount point:

bash
umount /data

Pass only the mount point so fstab supplies the UUID, filesystem type, and options:

bash
mount /data

Confirm the entry mounted from fstab:

bash
findmnt /data

Sample output:

output
TARGET SOURCE    FSTYPE OPTIONS
/data  /dev/sdb1 xfs    rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota

The same pattern works for /boot on the lab system—fstab already maps UUID to mount point:

bash
findmnt /boot

Sample output:

output
TARGET SOURCE    FSTYPE OPTIONS
/boot  /dev/sda2 xfs    rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota

Verify /etc/fstab Before Rebooting

Editing fstab and rebooting immediately is how administrators learn emergency mode. Validate first on a normally booted system:

  1. systemctl daemon-reload — regenerate systemd .mount units from the saved fstab
  2. mount -a — let the mount utility read fstab and surface UUID, type, or option errors
  3. findmnt on each new mount point
  4. findmnt --verify when available

daemon-reload does not mount filesystems; mount -a does not refresh systemd units. Both are worth running before reboot because they test different layers.

Skipping mount -a means the first boot attempt becomes the test. A wrong UUID or missing mount point can stall boot until you fix fstab from rescue or rd.break.


Change an Existing /etc/fstab Entry

Common edits and what they require:

Change Typical workflow
/dev/sdb1UUID= Edit fstab, daemon-reload, then mount -a on a running system—no umount if UUID points at the same filesystem
New mount point path Create directory, update fstab, umount old path, mount -a
Add noexec or ro Edit options, umount and mount that entry (or reboot) so new flags apply
Wrong filesystem type Fix type field, mount -a—will fail until type matches blkid

LVM logical volumes keep the same /dev/mapper/rhel-root path and UUID when you extend the LV—see extend an LVM partition for growth without fstab changes.


Troubleshoot /etc/fstab Errors

Symptom Likely cause Fix
mount -a reports wrong fs type TYPE in fstab does not match blkid Correct the third field
can't find UUID Typo or filesystem replaced Re-run blkid, update first field
mount point does not exist Missing directory mkdir -p the mount point
already mounted Duplicate entry or manual mount findmnt, remove duplicate line or umount first
Two LABEL= with same name Duplicate labels Change label on one filesystem
Boot drops to emergency mode Bad root or required mount line Fix or comment line; see recovery section
mount -a works but boot fails nofail missing on optional disk that was offline at boot Add nofail or ensure disk is present
findmnt --verify warnings Deprecated paths or bind mounts Read verifier message; align with UUID

Recover from a Bad /etc/fstab Entry

When boot hangs after an fstab edit, you need console access—not SSH.

  1. Interrupt GRUB and boot with rd.break or select recovery media if the system does not reach login—see reset root password on RHEL for the GRUB edit pattern and systemd targets for rescue versus emergency semantics.
  2. In rd.break: mount -o remount,rw /sysroot, then chroot /sysroot.
  3. Comment the bad fstab line with # or fix the UUID, mount point, and type.
  4. Inside the chroot, run mount -a to test the corrected file. Do not rely on systemctl daemon-reload here—you are not in the normally booted systemd environment.
  5. Exit the chroot and initramfs shell, then reboot so the installed system boots with the fixed fstab.
  6. After a normal boot, run systemctl daemon-reload and findmnt --verify, then confirm mounts with findmnt.

Keep a known-good fstab.bak on the system or in your change ticket so recovery is a copy operation under pressure.


UUID and Label Examples

Use case Identifier example Notes
Data disk UUID=276aa1ee-3141-49fc-a2d3-8b631bbc281a Spare partition XFS on /data
Boot partition UUID=cbd838ad-a342-4b56-b65f-da022e195971 Matches /boot on lab host
LVM root UUID=96b3becc-49da-4746-89b4-6b44cc1daf47 Filesystem UUID on /dev/mapper/rhel-root
Swap UUID=78531da6-a389-46e8-9bad-267572940826 none mount point, type swap
Removable USB UUID=… with nofail Optional mount; may be absent at boot

Network filesystems and autofs use different configuration files—see NFS client setup and autofs guides when the mount is not a local block device. Temporary ISO, USB, and network mounts belong in Linux mount command rather than duplicated here.


References


Summary

Persistent mounts on Linux live in /etc/fstab, not in your shell history. A temporary mount /dev/sdb1 /data disappears at reboot; a UUID line tells the boot stack which filesystem to attach at /data every time. UUID is the usual choice for local disks because it follows the formatted filesystem when kernel device names shuffle.

The safe edit path on a running system is backup, add the line, systemctl daemon-reload (regenerate systemd mount units), mount -a (test fstab through the mount utility), findmnt, and findmnt --verify—then reboot when you have a maintenance window. LABEL mounts work the same way when labels are unique, but duplicate labels break mount in ways UUIDs avoid.

When mount -a fails or boot lands in emergency mode, fix or comment the offending line from console access before you reboot again. Partitioning and mkfs belong in create and mount filesystems; NFS, autofs, and one-off mount targets belong in their dedicated guides—not mixed into every fstab lesson.


Frequently Asked Questions

1. Should I use UUID or LABEL in /etc/fstab?

UUID is the default choice for local filesystems because it identifies the formatted filesystem and survives partition renumbering. LABEL is readable in logs but must be unique on the system. Device paths such as /dev/sdb1 break when disk order changes.

2. What does mount -a do?

mount -a reads /etc/fstab and mounts every entry that is not already mounted and not marked noauto. It is the standard pre-reboot test after editing fstab. Failures print to the terminal instead of waiting for the next boot.

3. Why run systemctl daemon-reload after editing fstab?

systemd generates .mount units from fstab on current RHEL and Fedora releases. daemon-reload asks the running manager to regenerate those units from the file you edited. mount -a is separate—it reads fstab directly through the mount utility to test whether entries actually mount. Run both on a normally booted system after fstab edits; they solve different problems.

4. What do the two numbers at the end of an fstab line mean?

The fifth field is the dump flag for legacy backup tools. The sixth is fsck pass order at boot. Zero means skip dump or skip fsck for that filesystem. Root on ext4 is often 1; other non-root ext4 filesystems may use 2. XFS and swap use 0 in the fsck column on RHEL because XFS does not run a traditional boot-time fsck.

5. How do I recover if a bad fstab line prevents boot?

Boot into rd.break or rescue from the GRUB menu, remount root read-write if needed, chroot into the installed system, fix or comment the bad fstab line, and run mount -a inside that chroot. Exit recovery and reboot. After a normal boot, run systemctl daemon-reload and findmnt --verify. See the recovery section and the root password recovery article if GRUB editing is required.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, networking, and security, delivering robust and efficient solutions for diverse projects.

  • Go (programming language)
  • Python (programming language)
  • DevOps
  • Computer Security
  • Cloud Computing
  • Kubernetes
  • Linux
  • Ansible (software)