3 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
6 <refentry id=
"systemd-fstab-generator">
9 <title>systemd-fstab-generator
</title>
10 <productname>systemd
</productname>
14 <refentrytitle>systemd-fstab-generator
</refentrytitle>
15 <manvolnum>8</manvolnum>
19 <refname>systemd-fstab-generator
</refname>
20 <refpurpose>Unit generator for /etc/fstab
</refpurpose>
24 <para><filename>/usr/lib/systemd/system-generators/systemd-fstab-generator
</filename></para>
28 <title>Description
</title>
30 <para><filename>systemd-fstab-generator
</filename> is a generator
31 that translates
<filename>/etc/fstab
</filename> (see
32 <citerefentry project='man-pages'
><refentrytitle>fstab
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
33 for details) into native systemd units early at boot and when
34 configuration of the system manager is reloaded. This will
35 instantiate mount and swap units as necessary.
</para>
37 <para>The
<varname>passno
</varname> field is treated like a simple
38 boolean, and the ordering information is discarded. However, if
39 the root file system is checked, it is checked before all the
40 other file systems.
</para>
43 <citerefentry><refentrytitle>systemd.mount
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
45 <citerefentry><refentrytitle>systemd.swap
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
46 for more information about special
<filename>/etc/fstab
</filename>
47 mount options this generator understands.
</para>
49 <para>One special topic is handling of symbolic links. Historical init
50 implementations supported symlinks in
<filename>/etc/fstab
</filename>.
51 Because mount units will refuse mounts where the target is a symbolic link,
52 this generator will resolve any symlinks as far as possible when processing
53 <filename>/etc/fstab
</filename> in order to enhance backwards compatibility.
54 If a symlink target does not exist at the time that this generator runs, it
55 is assumed that the symlink target is the final target of the mount.
</para>
57 <para><filename>systemd-fstab-generator
</filename> implements
58 <citerefentry><refentrytitle>systemd.generator
</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
</para>
62 <title>Kernel Command Line
</title>
64 <para><filename>systemd-fstab-generator
</filename> understands the
65 following kernel command line parameters:
</para>
67 <variablelist class='kernel-commandline-options'
>
70 <term><varname>fstab=
</varname></term>
71 <term><varname>rd.fstab=
</varname></term>
73 <listitem><para>Takes a boolean argument. Defaults to
74 <literal>yes
</literal>. If
<literal>no
</literal>, causes the
75 generator to ignore any mounts or swap devices configured in
76 <filename>/etc/fstab
</filename>.
<varname>rd.fstab=
</varname>
77 is honored only by the initial RAM disk (initrd) while
78 <varname>fstab=
</varname> is honored by both the main system
79 and the initrd.
</para></listitem>
83 <term><varname>root=
</varname></term>
85 <listitem><para>Takes the root filesystem to mount in the
86 initrd.
<varname>root=
</varname> is honored by the
87 initrd.
</para></listitem>
91 <term><varname>rootfstype=
</varname></term>
93 <listitem><para>Takes the root filesystem type that will be
94 passed to the mount command.
<varname>rootfstype=
</varname> is
95 honored by the initrd.
</para></listitem>
99 <term><varname>rootflags=
</varname></term>
101 <listitem><para>Takes the root filesystem mount options to use.
<varname>rootflags=
</varname> is
102 honored by the initrd.
</para>
104 <para>Note that unlike most kernel command line options this setting does not override settings made
105 in configuration files (specifically: the mount option string in
106 <filename>/etc/fstab
</filename>). See
107 <citerefentry><refentrytitle>systemd-remount-fs.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
</para></listitem>
111 <term><varname>mount.usr=
</varname></term>
113 <listitem><para>Takes the
<filename>/usr
</filename> filesystem
114 to be mounted by the initrd. If
115 <varname>mount.usrfstype=
</varname> or
116 <varname>mount.usrflags=
</varname> is set, then
117 <varname>mount.usr=
</varname> will default to the value set in
118 <varname>root=
</varname>.
</para>
120 <para>Otherwise, this parameter defaults to the
121 <filename>/usr
</filename> entry found in
122 <filename>/etc/fstab
</filename> on the root filesystem.
</para>
124 <para><varname>mount.usr=
</varname> is honored by the initrd.
129 <term><varname>mount.usrfstype=
</varname></term>
131 <listitem><para>Takes the
<filename>/usr
</filename> filesystem
132 type that will be passed to the mount command. If
133 <varname>mount.usr=
</varname> or
134 <varname>mount.usrflags=
</varname> is set, then
135 <varname>mount.usrfstype=
</varname> will default to the value
136 set in
<varname>rootfstype=
</varname>.
</para>
138 <para>Otherwise, this value will be read from the
139 <filename>/usr
</filename> entry in
140 <filename>/etc/fstab
</filename> on the root filesystem.
</para>
142 <para><varname>mount.usrfstype=
</varname> is honored by the
143 initrd.
</para></listitem>
147 <term><varname>mount.usrflags=
</varname></term>
149 <listitem><para>Takes the
<filename>/usr
</filename> filesystem
150 mount options to use. If
<varname>mount.usr=
</varname> or
151 <varname>mount.usrfstype=
</varname> is set, then
152 <varname>mount.usrflags=
</varname> will default to the value
153 set in
<varname>rootflags=
</varname>.
</para>
155 <para>Otherwise, this value will be read from the
156 <filename>/usr
</filename> entry in
157 <filename>/etc/fstab
</filename> on the root filesystem.
</para>
159 <para><varname>mount.usrflags=
</varname> is honored by the
160 initrd.
</para></listitem>
164 <term><varname>systemd.volatile=
</varname></term>
166 <listitem><para>Controls whether the system shall boot up in volatile mode. Takes a boolean argument or the
167 special value
<option>state
</option>.
</para>
169 <para>If false (the default), this generator makes no changes to the mount tree and the system is booted up in
172 <para>If true the generator ensures
173 <citerefentry><refentrytitle>systemd-volatile-root.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
174 is run as part of the initial RAM disk (
"initrd"). This service changes the mount table before transitioning to
175 the host system, so that a volatile memory file system (
<literal>tmpfs
</literal>) is used as root directory,
176 with only
<filename>/usr
</filename> mounted into it from the configured root file system, in read-only
177 mode. This way the system operates in fully stateless mode, with all configuration and state reset at boot and
178 lost at shutdown, as
<filename>/etc
</filename> and
<filename>/var
</filename> will be served from the (initially
179 unpopulated) volatile memory file system.
</para>
181 <para>If set to
<option>state
</option> the generator will leave the root directory mount point unaltered,
182 however will mount a
<literal>tmpfs
</literal> file system to
<filename>/var
</filename>. In this mode the normal
183 system configuration (i.e. the contents of
<literal>/etc
</literal>) is in effect (and may be modified during
184 system runtime), however the system state (i.e. the contents of
<literal>/var
</literal>) is reset at boot and
185 lost at shutdown.
</para>
187 <para>If this setting is set to
<literal>overlay
</literal> the root file system is set up as
188 <literal>overlayfs
</literal> mount combining the read-only root directory with a writable
189 <literal>tmpfs
</literal>, so that no modifications are made to disk, but the file system may be modified
190 nonetheless with all changes being lost at reboot.
</para>
192 <para>Note that in none of these modes the root directory,
<filename>/etc
</filename>,
<filename>/var
</filename>
193 or any other resources stored in the root file system are physically removed. It's thus safe to boot a system
194 that is normally operated in non-volatile mode temporarily into volatile mode, without losing data.
</para>
196 <para>Note that with the exception of
<literal>overlay
</literal> mode, enabling this setting will only work
197 correctly on operating systems that can boot up with only
<filename>/usr
</filename> mounted, and are able to
198 automatically populate
<filename>/etc
</filename>, and also
<filename>/var
</filename> in case of
199 <literal>systemd.volatile=yes
</literal>.
</para></listitem>
203 <term><varname>systemd.swap
</varname></term>
205 <listitem><para>Takes a boolean argument or enables the option if specified
206 without an argument. If disabled, causes the generator to ignore
207 any swap devices configured in
<filename>/etc/fstab
</filename>.
208 Defaults to enabled.
</para></listitem>
214 <title>See Also
</title>
216 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
217 <citerefentry project='man-pages'
><refentrytitle>fstab
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
218 <citerefentry><refentrytitle>systemd.mount
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
219 <citerefentry><refentrytitle>systemd.swap
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
220 <citerefentry><refentrytitle>systemd-cryptsetup-generator
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
221 <citerefentry><refentrytitle>kernel-command-line
</refentrytitle><manvolnum>7</manvolnum></citerefentry>