genfstab
Generate fstab file for current system
TLDR
Generate the /etc/fstab file using volume UUIDs during an Arch Linux installation (requires root permissions)
Display fstab-compatible output based on volume labels
Display fstab-compatible output based on volume UUIDs
Display fstab-compatible output based on the specified identifier
Append a volume into the /etc/fstab file to mount it automatically
SYNOPSIS
genfstab [-h|-L|-U|-l|-p|-t] [-s PATH] [mountpoint]
PARAMETERS
-h, --help
Display help message and exit
-L, --list
List mounted filesystems instead of generating fstab
-U, --uuid
Use UUIDs for devices (default)
-l, --label
Use filesystem labels instead of UUIDs
-p, --proc
Include /proc, /sys, and devtmpfs entries
-t, --tmpfs
Include tmpfs mounts
-s PATH, --skip=PATH
Skip generating entry for specified path
DESCRIPTION
The genfstab command is a utility primarily used in Arch Linux installations to automatically generate the /etc/fstab file. It scans all currently mounted filesystems under a specified path (defaulting to /) and outputs corresponding fstab(5) entries.
By default, it identifies devices using UUIDs for greater reliability across kernel updates and hardware changes. This is crucial for boot configurations, as traditional /dev/sdX paths can vary.
During a typical Arch installation, after mounting the root filesystem and optional partitions (e.g., /boot, /home) to /mnt, users run genfstab -U /mnt >> /mnt/etc/fstab. This appends entries for all mounts under /mnt. Special filesystems like /proc, /sys, and tmpfs can be included optionally.
The tool lists filesystems instead of generating output with -L, aids verification. It must be run as root and the output reviewed manually, as it may include unwanted mounts (e.g., installation media). Skipping specific paths prevents erroneous entries.
While Arch-specific, its simplicity has made it popular in custom install scripts, promoting reproducible setups.
CAVEATS
Arch Linux specific; run as root; always review generated /etc/fstab before rebooting, as it may include temporary mounts like installation media.
COMMON EXAMPLE
genfstab -U /mnt >> /mnt/etc/fstab
Appends UUID-based entries for all filesystems mounted under /mnt to /etc/fstab.
VERIFICATION
Use genfstab -L /mnt first to preview filesystems before generating fstab.
HISTORY
Part of the arch-install-scripts package since around 2012, developed by Arch Linux developers to streamline manual installations by automating fstab generation from live mounts.


