SYSTEMD-FSTAB-GENERATOR(8)
๐ NAME ๐
okay so bestie, let me introduce you to systemd-fstab-generator โ it's the unit generator for /etc/fstab. and yes she's iconic for it ๐
โจ SYNOPSIS โจ
/usr/lib/systemd/system-generators/systemd-fstab-generator
๐ฆ DESCRIPTION ๐ฆ
so systemd-fstab-generator is a generator that translates /etc/fstab (peep fstab(5) for the deets) into native systemd units early at boot and also whenever the system manager's configuration gets reloaded. it will instantiate mount and swap units as necessary, no cap. ๐ซถ
the passno field? it's treated like a simple boolean, and the ordering info just gets yeeted. however, if the root file system is checked, it is checked before all the other file systems. main character energy, honestly. ๐
go look at systemd.mount(5) and systemd.swap(5) for more info about the special /etc/fstab mount options this generator understands. ๐
one special topic: symbolic links. historical init implementations supported symlinks in /etc/fstab. but because mount units will refuse mounts where the target is a symbolic link ๐ญ, this generator resolves any symlinks as far as possible when processing /etc/fstab, all to enhance backwards compatibility. and if a symlink target doesn't exist at the time this generator runs? it's assumed that the symlink target is the final target of the mount. fr fr. ๐ช
systemd-fstab-generator implements systemd.generator(7).
๐ฅ KERNEL COMMAND LINE ๐ฅ
systemd-fstab-generator understands the following kernel command line parameters, bestie:
fstab=,rd.fstab=โ takes a boolean argument. defaults to"yes". if"no", it causes the generator to ignore any mounts or swap devices configured in/etc/fstab.rd.fstab=is honored only in the initrd, whilefstab=is honored by both the main system and the initrd. โจ
Added in version 186.
root=โ configures the operating system's root filesystem to mount when running in the initrd. this accepts a device node path (usually/dev/disk/by-uuid/...or/dev/disk/by-label/...or similar), or the special values"gpt-auto","gpt-auto-force","dissect","dissect-force","fstab","tmpfs","bind:...", and"off".
set it to "gpt-auto", "gpt-auto-force", "dissect", "dissect-force" to explicitly request automatic root file system discovery, implemented in systemd-gpt-auto-generator(8).
use "fstab" to explicitly request automatic root file system discovery via the initrd /etc/fstab rather than via kernel command line.
use "tmpfs" in order to mount a tmpfs(5) file system as root file system of the OS. this is useful in combination with mount.usr= (see below) in order to combine a volatile root file system with a separate, immutable /usr/ file system. also see systemd.volatile= below.
use "bind:..." to bind mount another directory as operating system root filesystems (added in v258). expects an absolute path name referencing an existing directory within the initrd's file hierarchy to boot into. since the resulting root file system is supposed to behave like a regular OS root, the bind mount is established with the dev, suid and exec options (i.e. the nodev, nosuid and noexec flags that would otherwise be inherited from the file system the source directory resides on, such as /run/, are cleared), unless overridden via rootflags=.
set to "off" to turn off mounting of a root file system.
note that further root= values may be supported, implemented in additional packages.
Added in version 217.
rootfstype=โ takes the root filesystem type that will be passed to themountcommand.rootfstype=is honored by the initrd.
Added in version 217.
rootflags=โ takes the root filesystem mount options to use.rootflags=is honored by the initrd.
heads up bestie: unlike most kernel command line options, this setting does not override settings made in configuration files (specifically: the mount option string in/etc/fstab). seesystemd-remount-fs.service(8).
Added in version 217.
mount.usr=โ takes the/usr/filesystem to be mounted by the initrd. ifmount.usrfstype=ormount.usrflags=is set, then the mount configured viamount.usr=will default to the same value set inroot=.
set to "dissect" to explicitly request automatic /usr/ file system discovery, implemented in systemd-gpt-auto-generator(8).
set to "off" to turn off mounting of a separate /usr/ file system.
mount.usr= is honored by the initrd.
Added in version 217.
mount.usrfstype=โ takes the/usr/filesystem type that will be passed to themountcommand. ifmount.usr=ormount.usrflags=is set, thenmount.usrfstype=will default to the value set inrootfstype=.
otherwise, this value will be read from the /usr/ entry in /etc/fstab on the root filesystem.
mount.usrfstype= is honored by the initrd.
Added in version 217.
mount.usrflags=โ takes the/usr/filesystem mount options to use. ifmount.usr=ormount.usrfstype=is set, thenmount.usrflags=will default to the value set inrootflags=.
otherwise, this value will be read from the /usr/ entry in /etc/fstab on the root filesystem.
mount.usrflags= is honored by the initrd.
Added in version 217.
roothash=,usrhash=โ these options are primarily read bysystemd-veritysetup-generator(8). when set, this indicates that the root file system (or/usr/) shall be mounted from Verity volumes with the specified hashes. if these kernel command line options are set, the root (or/usr/) file system is thus mounted from a device mapper volume/dev/mapper/root(or/dev/mapper/usr).
Added in version 251.
systemd.volatile=โ controls whether the system shall boot up in volatile mode. takes a boolean argument or the special values"state"and"overlay".
if "no" (the default), this generator makes no changes to the mount tree and the system is booted up in normal mode.
if "yes", the generator ensures systemd-volatile-root.service(8) is run in the initrd. this service changes the mount table before transitioning to the host system, so that a volatile memory file system ("tmpfs") is used as root directory, with only /usr/ mounted into it from the configured root file system, in read-only mode. this way the system operates in fully stateless mode, with all configuration and state reset at boot and lost at shutdown, as /etc/ and /var/ will be served from the (initially unpopulated) volatile memory file system.
if set to "state", the generator will leave the root directory mount point unaltered, however will mount a "tmpfs" file system to /var/. in this mode the normal system configuration (i.e. the contents of "/etc/") is in effect (and may be modified during system runtime), however the system state (i.e. the contents of "/var/") is reset at boot and lost at shutdown.
if this setting is set to "overlay", the root file system is set up as "overlayfs" mount combining the read-only root directory with a writable "tmpfs", so that no modifications are made to disk, but the file system may be modified nonetheless with all changes being lost at reboot.
note that in none of these modes the root directory,/etc/,/var/or any other resources stored in the root file system are physically removed. so it's totally safe to boot a system that is normally operated in non-volatile mode temporarily into volatile mode, without losing data. ๐ซถ
also note: with the exception of"overlay"mode, enabling this setting will only work correctly on operating systems that can boot up with only/usr/mounted, and are able to automatically populate/etc/, and also/var/in case of"systemd.volatile=yes".
also see root=tmpfs above, for a method to combine a "tmpfs" file system with a regular /usr/ file system (as configured via mount.usr=). the main distinction between systemd.volatile=yes, and root=tmpfs in combination with mount.usr= is that the former operates on top of a regular root file system and temporarily obstructs the files and directories above its /usr/ subdirectory, while the latter does not hide any files, but simply mounts a unpopulated tmpfs as root file system and combines it with a user picked /usr/ file system. ๐
Added in version 233.
systemd.swap=โ takes a boolean argument or enables the option if specified without an argument. if disabled, it causes the generator to ignore any swap devices configured in/etc/fstab. defaults to enabled.
Added in version 246.
systemd.mount-extra=WHAT:WHERE[:FSTYPE[:OPTIONS]],rd.systemd.mount-extra=WHAT:WHERE[:FSTYPE[:OPTIONS]]โ specifies the mount unit. takes at least two and at most four fields separated with a colon (":"). each field is handled as the correspondingfstabfield. this option can be specified multiple times.rd.systemd.mount-extra=is honored only in the initrd, whilesystemd.mount-extra=is honored by both the main system and the initrd. in the initrd, the mount point (and also source path if the mount is bind mount) specified insystemd.mount-extra=is prefixed with/sysroot/. ๐
example:
systemd.mount-extra=/dev/sda1:/mount-point:ext4:rw,noatime
Added in version 254.
systemd.swap-extra=WHAT[:OPTIONS],rd.systemd.swap-extra=WHAT[:OPTIONS]โ specifies the swap unit. takes the block device to be used as a swap device, and optionally takes mount options followed by a colon (":"). this option can be specified multiple times.rd.systemd.swap-extra=is honored only in the initrd, whilesystemd.swap-extra=is honored by both the main system and the initrd. ๐
example:
systemd.swap-extra=/dev/sda2:x-systemd.makefs
Added in version 254.
๐ SYSTEM CREDENTIALS ๐
fstab.extraโ this credential may contain addition mounts to establish, in the same format asfstab(5), with one mount per line. it is read in addition to/etc/fstab.
Added in version 254.
๐ธ SEE ALSO ๐ธ
systemd(1), fstab(5), systemd.mount(5), systemd.swap(5), systemd-cryptsetup-generator(8), systemd-gpt-auto-generator(8), kernel-command-line(7), Known Environment Variables[1]
๐ NOTES ๐
- Known Environment Variables
https://systemd.io/ENVIRONMENT/
and that's the whole page bestie, you ate that ๐ซถโจ this was systemd 262.1 serving SYSTEMD-FSTAB-GENERATOR(8) realness โ go mount something cute ๐
๐
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms