LinuxCommandLibrary

fstab-decode

Decode fstab entries into mount commands

SYNOPSIS

fstab-decode [OPTIONS...] [DEVICE...]

PARAMETERS

-h, --help
    Print short help text and exit.

--version
    Print version string and exit.

--print-roothash
    Print sorted list of root device hashes (UUIDs/PARTUUIDs).

--root=PATH
    Use specified path as filesystem root (default: /).

DESCRIPTION

The fstab-decode command is a systemd utility that converts special device identifiers from /etc/fstab format—such as LABEL=, UUID=, PARTUUID=, and PARTLABEL=—into their canonical device node paths (e.g., /dev/sda1).

It is primarily used by systemd generators during boot to resolve these symbolic references to actual block devices. Manually, it processes device specs provided as command-line arguments or reads them one per line from standard input, outputting the decoded paths to stdout.

For example, fstab-decode UUID=12345678-1234-1234-1234-123456789abc might output /dev/sda1. It respects the system's root directory via --root and supports printing root device hashes for verification.

This tool ensures consistent device resolution across mounts, avoiding direct /dev/sdX references which can change on reboots. It relies on blkid data in /run/systemd caches for fast lookups.

CAVEATS

Requires access to /run/systemd/ask-password blockdev cache; may fail if cache absent or stale. Runs without root privileges but needs readable device metadata.

USAGE NOTES

Reads devices from args or stdin (one per line). Outputs decoded paths or errors to stderr.
Example: echo 'UUID=abcd-1234' | fstab-decode

HISTORY

Introduced in systemd 219 (2014) to support reliable fstab parsing in generators; evolved with PARTUUID/PARTLABEL in later versions for broader filesystem support.

SEE ALSO

blkid(8), findmnt(1), lsblk(1), systemd-fstab-generator(8)

Copied to clipboard