]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-fstab-generator.xml
Merge pull request #26726 from DaanDeMeyer/cleanups
[thirdparty/systemd.git] / man / systemd-fstab-generator.xml
1 <?xml version="1.0"?>
2 <!--*-nxml-*-->
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-or-later -->
6 <refentry id="systemd-fstab-generator">
7
8 <refentryinfo>
9 <title>systemd-fstab-generator</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>systemd-fstab-generator</refentrytitle>
15 <manvolnum>8</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>systemd-fstab-generator</refname>
20 <refpurpose>Unit generator for /etc/fstab</refpurpose>
21 </refnamediv>
22
23 <refsynopsisdiv>
24 <para><filename>/usr/lib/systemd/system-generators/systemd-fstab-generator</filename></para>
25 </refsynopsisdiv>
26
27 <refsect1>
28 <title>Description</title>
29
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>
36
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>
41
42 <para>See
43 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
44 and
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>
48
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>
56
57 <para><filename>systemd-fstab-generator</filename> implements
58 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
59 </refsect1>
60
61 <refsect1>
62 <title>Kernel Command Line</title>
63
64 <para><filename>systemd-fstab-generator</filename> understands the
65 following kernel command line parameters:</para>
66
67 <variablelist class='kernel-commandline-options'>
68
69 <varlistentry>
70 <term><varname>fstab=</varname></term>
71 <term><varname>rd.fstab=</varname></term>
72
73 <listitem><para>Takes a boolean argument. Defaults to <literal>yes</literal>. If
74 <literal>no</literal>, causes the generator to ignore any mounts or swap devices configured in
75 <filename>/etc/fstab</filename>. <varname>rd.fstab=</varname> is honored only in the initrd, while
76 <varname>fstab=</varname> is honored by both the main system and the initrd.</para></listitem>
77 </varlistentry>
78
79 <varlistentry>
80 <term><varname>root=</varname></term>
81
82 <listitem><para>Configures the operating system's root filesystem to mount when running in the
83 initrd. This accepts a device node path (usually <filename>/dev/disk/by-uuid/…</filename> or
84 <filename>/dev/disk/by-label/…</filename> or similar), or the special values <literal>gpt-auto</literal>,
85 <literal>fstab</literal>, and <literal>tmpfs</literal>.</para>
86
87 <para>Use <literal>gpt-auto</literal> to explicitly request automatic root file system discovery via
88 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
89
90 <para>Use <literal>fstab</literal> to explicitly request automatic root file system discovery via
91 the initrd <filename>/etc/fstab</filename> rather than via kernel command line.</para>
92
93 <para>Use <literal>tmpfs</literal> in order to mount a <citerefentry
94 project='man-pages'><refentrytitle>tmpfs</refentrytitle><manvolnum>5</manvolnum></citerefentry> file
95 system as root file system of the OS. This is useful in combination with
96 <varname>mount.usr=</varname> (see below) in order to combine a volatile root file system with a
97 separate, immutable <filename>/usr/</filename> file system. Also see
98 <varname>systemd.volatile=</varname> below.</para></listitem>
99 </varlistentry>
100
101 <varlistentry>
102 <term><varname>rootfstype=</varname></term>
103
104 <listitem><para>Takes the root filesystem type that will be
105 passed to the mount command. <varname>rootfstype=</varname> is
106 honored by the initrd.</para></listitem>
107 </varlistentry>
108
109 <varlistentry>
110 <term><varname>rootflags=</varname></term>
111
112 <listitem><para>Takes the root filesystem mount options to use. <varname>rootflags=</varname> is
113 honored by the initrd.</para>
114
115 <para>Note that unlike most kernel command line options this setting does not override settings made
116 in configuration files (specifically: the mount option string in
117 <filename>/etc/fstab</filename>). See
118 <citerefentry><refentrytitle>systemd-remount-fs.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para></listitem>
119 </varlistentry>
120
121 <varlistentry>
122 <term><varname>mount.usr=</varname></term>
123
124 <listitem><para>Takes the <filename>/usr/</filename> filesystem
125 to be mounted by the initrd. If
126 <varname>mount.usrfstype=</varname> or
127 <varname>mount.usrflags=</varname> is set, then
128 <varname>mount.usr=</varname> will default to the value set in
129 <varname>root=</varname>.</para>
130
131 <para>Otherwise, this parameter defaults to the
132 <filename>/usr/</filename> entry found in
133 <filename>/etc/fstab</filename> on the root filesystem.</para>
134
135 <para><varname>mount.usr=</varname> is honored by the initrd.
136 </para></listitem>
137 </varlistentry>
138
139 <varlistentry>
140 <term><varname>mount.usrfstype=</varname></term>
141
142 <listitem><para>Takes the <filename>/usr/</filename> filesystem
143 type that will be passed to the mount command. If
144 <varname>mount.usr=</varname> or
145 <varname>mount.usrflags=</varname> is set, then
146 <varname>mount.usrfstype=</varname> will default to the value
147 set in <varname>rootfstype=</varname>.</para>
148
149 <para>Otherwise, this value will be read from the
150 <filename>/usr/</filename> entry in
151 <filename>/etc/fstab</filename> on the root filesystem.</para>
152
153 <para><varname>mount.usrfstype=</varname> is honored by the
154 initrd.</para></listitem>
155 </varlistentry>
156
157 <varlistentry>
158 <term><varname>mount.usrflags=</varname></term>
159
160 <listitem><para>Takes the <filename>/usr/</filename> filesystem
161 mount options to use. If <varname>mount.usr=</varname> or
162 <varname>mount.usrfstype=</varname> is set, then
163 <varname>mount.usrflags=</varname> will default to the value
164 set in <varname>rootflags=</varname>.</para>
165
166 <para>Otherwise, this value will be read from the
167 <filename>/usr/</filename> entry in
168 <filename>/etc/fstab</filename> on the root filesystem.</para>
169
170 <para><varname>mount.usrflags=</varname> is honored by the
171 initrd.</para></listitem>
172 </varlistentry>
173
174 <varlistentry>
175 <term><varname>roothash=</varname></term>
176 <term><varname>usrhash=</varname></term>
177
178 <listitem><para>These options are primarily read by
179 <citerefentry><refentrytitle>systemd-veritysetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>. When
180 set this indicates that the root file system (or <filename>/usr/</filename>) shall be mounted from
181 Verity volumes with the specified hashes. If these kernel command line options are set the root (or
182 <filename>/usr/</filename>) file system is thus mounted from a device mapper volume
183 <filename>/dev/mapper/root</filename> (or <filename>/dev/mapper/usr</filename>).</para></listitem>
184 </varlistentry>
185
186 <varlistentry>
187 <term><varname>systemd.volatile=</varname></term>
188
189 <listitem><para>Controls whether the system shall boot up in volatile mode. Takes a boolean argument or the
190 special value <option>state</option>.</para>
191
192 <para>If false (the default), this generator makes no changes to the mount tree and the system is booted up in
193 normal mode.</para>
194
195 <para>If true the generator ensures
196 <citerefentry><refentrytitle>systemd-volatile-root.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
197 is run in the initrd. This service changes the mount table before transitioning to the host system,
198 so that a volatile memory file system (<literal>tmpfs</literal>) is used as root directory, with only
199 <filename>/usr/</filename> mounted into it from the configured root file system, in read-only mode.
200 This way the system operates in fully stateless mode, with all configuration and state reset at boot
201 and lost at shutdown, as <filename>/etc/</filename> and <filename>/var/</filename> will be served
202 from the (initially unpopulated) volatile memory file system.</para>
203
204 <para>If set to <option>state</option> the generator will leave the root directory mount point unaltered,
205 however will mount a <literal>tmpfs</literal> file system to <filename>/var/</filename>. In this mode the normal
206 system configuration (i.e. the contents of <literal>/etc/</literal>) is in effect (and may be modified during
207 system runtime), however the system state (i.e. the contents of <literal>/var/</literal>) is reset at boot and
208 lost at shutdown.</para>
209
210 <para>If this setting is set to <literal>overlay</literal> the root file system is set up as
211 <literal>overlayfs</literal> mount combining the read-only root directory with a writable
212 <literal>tmpfs</literal>, so that no modifications are made to disk, but the file system may be modified
213 nonetheless with all changes being lost at reboot.</para>
214
215 <para>Note that in none of these modes the root directory, <filename>/etc/</filename>, <filename>/var/</filename>
216 or any other resources stored in the root file system are physically removed. It's thus safe to boot a system
217 that is normally operated in non-volatile mode temporarily into volatile mode, without losing data.</para>
218
219 <para>Note that with the exception of <literal>overlay</literal> mode, enabling this setting will
220 only work correctly on operating systems that can boot up with only <filename>/usr/</filename>
221 mounted, and are able to automatically populate <filename>/etc/</filename>, and also
222 <filename>/var/</filename> in case of <literal>systemd.volatile=yes</literal>.</para>
223
224 <para>Also see <varname>root=tmpfs</varname> above, for a method to combine a
225 <literal>tmpfs</literal> file system with a regular <filename>/usr/</filename> file system (as
226 configured via <varname>mount.usr=</varname>). The main distinction between
227 <varname>systemd.volatile=yes</varname>, and <varname>root=tmpfs</varname> in combination
228 <varname>mount.usr=</varname> is that the former operates on top of a regular root file system and
229 temporarily obstructs the files and directories above its <filename>/usr/</filename> subdirectory,
230 while the latter does not hide any files, but simply mounts a unpopulated tmpfs as root file system
231 and combines it with a user picked <filename>/usr/</filename> file system.</para></listitem>
232 </varlistentry>
233
234 <varlistentry>
235 <term><varname>systemd.swap</varname></term>
236
237 <listitem><para>Takes a boolean argument or enables the option if specified
238 without an argument. If disabled, causes the generator to ignore
239 any swap devices configured in <filename>/etc/fstab</filename>.
240 Defaults to enabled.</para></listitem>
241 </varlistentry>
242 </variablelist>
243 </refsect1>
244
245 <refsect1>
246 <title>See Also</title>
247 <para>
248 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
249 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
250 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
251 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
252 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
253 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
254 <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
255 <ulink url="https://systemd.io/ENVIRONMENT/">Known Environment Variables</ulink>
256 </para>
257 </refsect1>
258 </refentry>