]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-fstab-generator.xml
man: "the initial RAM disk" → "the initrd"
[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 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>tmpfs</literal> in order to mount a <citerefentry
91 project='man-pages'><refentrytitle>tmpfs</refentrytitle><manvolnum>5</manvolnum></citerefentry> file
92 system as root file system of the OS. This is useful in combination with
93 <varname>mount.usr=</varname> (see below) in order to combine a volatile root file system with a
94 separate, immutable <filename>/usr/</filename> file system. Also see
95 <varname>systemd.volatile=</varname> below.</para></listitem>
96 </varlistentry>
97
98 <varlistentry>
99 <term><varname>rootfstype=</varname></term>
100
101 <listitem><para>Takes the root filesystem type that will be
102 passed to the mount command. <varname>rootfstype=</varname> is
103 honored by the initrd.</para></listitem>
104 </varlistentry>
105
106 <varlistentry>
107 <term><varname>rootflags=</varname></term>
108
109 <listitem><para>Takes the root filesystem mount options to use. <varname>rootflags=</varname> is
110 honored by the initrd.</para>
111
112 <para>Note that unlike most kernel command line options this setting does not override settings made
113 in configuration files (specifically: the mount option string in
114 <filename>/etc/fstab</filename>). See
115 <citerefentry><refentrytitle>systemd-remount-fs.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para></listitem>
116 </varlistentry>
117
118 <varlistentry>
119 <term><varname>mount.usr=</varname></term>
120
121 <listitem><para>Takes the <filename>/usr/</filename> filesystem
122 to be mounted by the initrd. If
123 <varname>mount.usrfstype=</varname> or
124 <varname>mount.usrflags=</varname> is set, then
125 <varname>mount.usr=</varname> will default to the value set in
126 <varname>root=</varname>.</para>
127
128 <para>Otherwise, this parameter defaults to the
129 <filename>/usr/</filename> entry found in
130 <filename>/etc/fstab</filename> on the root filesystem.</para>
131
132 <para><varname>mount.usr=</varname> is honored by the initrd.
133 </para></listitem>
134 </varlistentry>
135
136 <varlistentry>
137 <term><varname>mount.usrfstype=</varname></term>
138
139 <listitem><para>Takes the <filename>/usr/</filename> filesystem
140 type that will be passed to the mount command. If
141 <varname>mount.usr=</varname> or
142 <varname>mount.usrflags=</varname> is set, then
143 <varname>mount.usrfstype=</varname> will default to the value
144 set in <varname>rootfstype=</varname>.</para>
145
146 <para>Otherwise, this value will be read from the
147 <filename>/usr/</filename> entry in
148 <filename>/etc/fstab</filename> on the root filesystem.</para>
149
150 <para><varname>mount.usrfstype=</varname> is honored by the
151 initrd.</para></listitem>
152 </varlistentry>
153
154 <varlistentry>
155 <term><varname>mount.usrflags=</varname></term>
156
157 <listitem><para>Takes the <filename>/usr/</filename> filesystem
158 mount options to use. If <varname>mount.usr=</varname> or
159 <varname>mount.usrfstype=</varname> is set, then
160 <varname>mount.usrflags=</varname> will default to the value
161 set in <varname>rootflags=</varname>.</para>
162
163 <para>Otherwise, this value will be read from the
164 <filename>/usr/</filename> entry in
165 <filename>/etc/fstab</filename> on the root filesystem.</para>
166
167 <para><varname>mount.usrflags=</varname> is honored by the
168 initrd.</para></listitem>
169 </varlistentry>
170
171 <varlistentry>
172 <term><varname>roothash=</varname></term>
173 <term><varname>usrhash=</varname></term>
174
175 <listitem><para>These options are primarily read by
176 <citerefentry><refentrytitle>systemd-veritysetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>. When
177 set this indicates that the root file system (or <filename>/usr/</filename>) shall be mounted from
178 Verity volumes with the specified hashes. If these kernel command line options are set the root (or
179 <filename>/usr/</filename>) file system is thus mounted from a device mapper volume
180 <filename>/dev/mapper/root</filename> (or <filename>/dev/mapper/usr</filename>).</para></listitem>
181 </varlistentry>
182
183 <varlistentry>
184 <term><varname>systemd.volatile=</varname></term>
185
186 <listitem><para>Controls whether the system shall boot up in volatile mode. Takes a boolean argument or the
187 special value <option>state</option>.</para>
188
189 <para>If false (the default), this generator makes no changes to the mount tree and the system is booted up in
190 normal mode.</para>
191
192 <para>If true the generator ensures
193 <citerefentry><refentrytitle>systemd-volatile-root.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
194 is run in the initrd. This service changes the mount table before transitioning to the host system,
195 so that a volatile memory file system (<literal>tmpfs</literal>) is used as root directory, with only
196 <filename>/usr/</filename> mounted into it from the configured root file system, in read-only mode.
197 This way the system operates in fully stateless mode, with all configuration and state reset at boot
198 and lost at shutdown, as <filename>/etc/</filename> and <filename>/var/</filename> will be served
199 from the (initially unpopulated) volatile memory file system.</para>
200
201 <para>If set to <option>state</option> the generator will leave the root directory mount point unaltered,
202 however will mount a <literal>tmpfs</literal> file system to <filename>/var/</filename>. In this mode the normal
203 system configuration (i.e. the contents of <literal>/etc/</literal>) is in effect (and may be modified during
204 system runtime), however the system state (i.e. the contents of <literal>/var/</literal>) is reset at boot and
205 lost at shutdown.</para>
206
207 <para>If this setting is set to <literal>overlay</literal> the root file system is set up as
208 <literal>overlayfs</literal> mount combining the read-only root directory with a writable
209 <literal>tmpfs</literal>, so that no modifications are made to disk, but the file system may be modified
210 nonetheless with all changes being lost at reboot.</para>
211
212 <para>Note that in none of these modes the root directory, <filename>/etc/</filename>, <filename>/var/</filename>
213 or any other resources stored in the root file system are physically removed. It's thus safe to boot a system
214 that is normally operated in non-volatile mode temporarily into volatile mode, without losing data.</para>
215
216 <para>Note that with the exception of <literal>overlay</literal> mode, enabling this setting will
217 only work correctly on operating systems that can boot up with only <filename>/usr/</filename>
218 mounted, and are able to automatically populate <filename>/etc/</filename>, and also
219 <filename>/var/</filename> in case of <literal>systemd.volatile=yes</literal>.</para>
220
221 <para>Also see <varname>root=tmpfs</varname> above, for a method to combine a
222 <literal>tmpfs</literal> file system with a regular <filename>/usr/</filename> file system (as
223 configured via <varname>mount.usr=</varname>). The main distinction between
224 <varname>systemd.volatile=yes</varname>, and <varname>root=tmpfs</varname> in combination
225 <varname>mount.usr=</varname> is that the former operates on top of a regular root file system and
226 temporarily obstructs the files and directories above its <filename>/usr/</filename> subdirectory,
227 while the latter does not hide any files, but simply mounts a unpopulated tmpfs as root file system
228 and combines it with a user picked <filename>/usr/</filename> file system.</para></listitem>
229 </varlistentry>
230
231 <varlistentry>
232 <term><varname>systemd.swap</varname></term>
233
234 <listitem><para>Takes a boolean argument or enables the option if specified
235 without an argument. If disabled, causes the generator to ignore
236 any swap devices configured in <filename>/etc/fstab</filename>.
237 Defaults to enabled.</para></listitem>
238 </varlistentry>
239 </variablelist>
240 </refsect1>
241
242 <refsect1>
243 <title>See Also</title>
244 <para>
245 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
246 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
247 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
248 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
249 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
250 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
251 <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
252 <ulink url="https://systemd.io/ENVIRONMENT/">Known Environment Variables</ulink>
253 </para>
254 </refsect1>
255 </refentry>