How to Use the blkid and findmnt Commands in Linux to Inspect UUIDs, Filesystem Labels, and Mount Trees

Storage management and filesystem mounting under Linux require precise block device identification. Historically, administrators relied on raw device node identifiers such as /dev/sda1 or /dev/nvme0n1p2 inside configuration files like /etc/fstab. However, dynamic hardware discovery, persistent controller reordering across reboots, and hot-pluggable storage arrays render predictable node naming unreliable. Modern Linux system engineering mandates the use of globally unique identifiers (UUIDs) and descriptive filesystem labels.

Two essential command-line tools—blkid and findmnt (both part of the foundational util-linux suite)—provide comprehensive visibility into block device metadata and live kernel mount states. While blkid queries the libblkid library cache and low-level block headers to output block attributes, UUIDs, and filesystem signatures, findmnt parses the kernel mount table (/proc/self/mountinfo) to visualise hierarchical tree structures, inherited mount flags, and active filesystem dependencies. This technical guide covers syntax, practical filtering flags, and automated scripting recipes for both utilities.

Key Differences: blkid vs. findmnt

Understanding when to employ each utility ensures rapid storage troubleshooting and clean configuration updates:

Feature / Metric blkid findmnt
Primary Data Source Block device superblocks, partition tables, and /etc/blkid.tab cache. Kernel mount tables (/proc/self/mountinfo, /etc/fstab, and /etc/mtab).
Target Information Filesystem type, block UUID, PARTUUID, filesystem LABEL, and block size. Mount point paths, target devices, live VFS mount flags, and hierarchical parent-child relationships.
Privilege Requirement Root privileges (sudo) recommended to probe raw block headers directly. Standard unprivileged user access for live mount table inspection.
Default Output Format Key-value attribute pairs per block device node. Ascii visual tree outlining mount paths and associated device nodes.

Using the blkid Command to Inspect Block Device Attributes

The blkid utility probes block devices to extract filesystem types, partition unique identifiers (PARTUUID), and filesystem UUIDs.

Displaying All Detected Block Devices

Running blkid without arguments lists all discoverable storage partitions registered with the kernel:

sudo blkid

Example terminal output:

/dev/nvme0n1p1: UUID="9E41-160B" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System" PARTUUID="7a281c8f-e129-4d64-88f2-302a2491a182"
/dev/nvme0n1p2: UUID="b49d7b93-9c82-4411-a88f-7c152a65d5cb" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="456e4df9-34b5-4b20-8e67-d8c9735d648b"
/dev/sda1: LABEL="BackupVault" UUID="3f02e6e7-14cd-4e9b-b0b3-8557db2ad933" BLOCK_SIZE="4096" TYPE="xfs" PARTUUID="1e9bca34-01"

Filtering by Specific Block Device

To inspect a single partition without parsing extraneous system devices:

sudo blkid /dev/nvme0n1p2

Extracting Just the Filesystem UUID for /etc/fstab

When authorising persistent mounts in /etc/fstab, extract the raw UUID value without quotation marks or metadata tags using the -s (tag filter) and -o value (clean value output) flags:

sudo blkid -s UUID -o value /dev/sda1

Locating a Device by Its UUID or Label

To reverse-lookup which physical device node corresponds to a specific filesystem UUID or label:

sudo blkid -U 3f02e6e7-14cd-4e9b-b0b3-8557db2ad933
sudo blkid -L BackupVault

Using the findmnt Command to Visualise Mount Trees and Flags

While df -h and mount display raw mount lines, findmnt provides a structured view of nested mount points, virtual filesystems (cgroups, tmpfs, proc), and container namespaces.

Visualising the Complete Hierarchical Mount Tree

Executing findmnt with no arguments displays an indented visual representation of all active filesystem mounts:

findmnt

This reveals parent-child relationships, showing precisely where bind mounts, snap sandboxes, and loop images reside within the root directory tree.

Displaying Real Physical Filesystems Only

To exclude kernel pseudo-filesystems (such as sysfs, proc, devtmpfs, and cgroup2) and display only genuine physical block mounts:

findmnt --real

Inspecting a Specific Target Mount Point

To check the exact source device, filesystem type, and active mount flags (such as rw, noatime, or nodev) for a directory:

findmnt /var/log

Comparing Active Mounts Against /etc/fstab

To verify if all filesystems defined in the static /etc/fstab configuration file are currently mounted in the running kernel:

findmnt --verify

This command flags non-existent mount directories, duplicate entries, malformed filesystem options, and missing UUID definitions before an administrator executes a reboot.

Formatting Output for Shell Scripts and Automation

Both system automation scripts and monitoring daemons can query findmnt using machine-readable JSON or raw delimited columns:

# Output mount tree in structured JSON format
findmnt --json

# Output tab-separated target, source, and options without header lines
findmnt -n -o TARGET,SOURCE,FSTYPE,OPTIONS /home

Best Practice Storage Management Workflow

When provisioning a newly formatted external drive or data volume, follow this sequential procedure to ensure persistent and fail-safe mounting:

  1. Probe the newly formatted partition using sudo blkid /dev/sdb1 to identify its assigned filesystem UUID and filesystem type.
  2. Create the target mount directory: sudo mkdir -p /mnt/data.
  3. Add the persistent configuration entry to /etc/fstab using the extracted UUID rather than the fragile device path:
    UUID=3f02e6e7-14cd-4e9b-b0b3-8557db2ad933 /mnt/data ext4 defaults,noatime,nofail 0 2

    Note: The nofail option prevents the Linux bootloader from dropping into an emergency shell if the external drive is detached during boot.

  4. Run findmnt --verify to validate syntax and directory permissions.
  5. Mount the filesystem using sudo mount -a and confirm its live status with findmnt /mnt/data.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.