genfstab(8)

generate output suitable for addition to an fstab file

Section 8 arch-install-scripts bookworm source

Summary

genfstab inspects all filesystems currently mounted below a given directory and prints them in fstab format on standard output. It is most commonly used during OS installation to capture a manually mounted layout (for example everything under /mnt) so it can be saved into the new system's /etc/fstab. Redirect or append its output to build the fstab file.

Tip: Use -U so entries reference partitions by UUID, which stays stable across reboots and disk reordering, and append with >> so you don't overwrite an existing fstab.

Description

GENFSTAB

NAME

genfstab - generate output suitable for addition to an fstab file

SYNOPSIS

genfstab [options] root

DESCRIPTION

genfstab helps fill in an fstab file by autodetecting all the current mounts below a given mountpoint and printing them in fstab-compatible format to standard output. It can be used to persist a manually mounted filesystem hierarchy and is often used during the initial install and configuration of an OS.

OPTIONS

-f <filter>

Restrict output to mountpoints matching the prefix filter.

-L

Use labels for source identifiers (shortcut for -t LABEL).

-p

Exclude pseudofs mounts (default behavior).

-P

Include pseudofs mounts.

-t <tag>

Use tag for source identifiers (should be one of: LABEL, UUID, PARTLABEL, PARTUUID).

-U

Use UUIDs for source identifiers (shortcut for -t UUID).

-h

Output syntax and command line options.

SEE ALSO

pacman(8)

BUGS

Bugs can be reported on the bug tracker https://bugs.archlinux.org in the Arch Linux category and title prefixed with [arch-install-scripts] or via arch-projects@archlinux.org.

AUTHORS

Maintainers:

• Dave Reisner <dreisner@archlinux.org>

• Eli Schwartz <eschwartz@archlinux.org>

For additional contributors, use git shortlog -s on the arch-install-scripts.git repository.

Examples

genfstab -U /mnt >> /mnt/etc/fstab

Generate fstab entries (using UUIDs) for everything mounted under /mnt and append them to the new system's fstab.

genfstab -L /mnt >> /mnt/etc/fstab

Same, but identify sources by filesystem LABEL instead of UUID.

genfstab -t PARTUUID /mnt

Print entries using PARTUUID as the source identifier to standard output.

genfstab -p /mnt

Generate entries while excluding pseudo-filesystem mounts (the default behavior).