]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-fstab-generator.xml
Merge pull request #8822 from fbuihuu/rfc-tmpfiles-safe-upstream
[thirdparty/systemd.git] / man / systemd-fstab-generator.xml
CommitLineData
059b37cc
LP
1<?xml version="1.0"?>
2<!--*-nxml-*-->
12b42c76 3<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
059b37cc 4<!--
572eb058 5 SPDX-License-Identifier: LGPL-2.1+
059b37cc
LP
6-->
7<refentry id="systemd-fstab-generator">
8
798d3a52
ZJS
9 <refentryinfo>
10 <title>systemd-fstab-generator</title>
11 <productname>systemd</productname>
798d3a52
ZJS
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-fstab-generator</refentrytitle>
16 <manvolnum>8</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-fstab-generator</refname>
21 <refpurpose>Unit generator for /etc/fstab</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
12b42c76 25 <para><filename>/usr/lib/systemd/system-generators/systemd-fstab-generator</filename></para>
798d3a52
ZJS
26 </refsynopsisdiv>
27
28 <refsect1>
29 <title>Description</title>
30
31 <para><filename>systemd-fstab-generator</filename> is a generator
32 that translates <filename>/etc/fstab</filename> (see
3ba3a79d 33 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
798d3a52
ZJS
34 for details) into native systemd units early at boot and when
35 configuration of the system manager is reloaded. This will
36 instantiate mount and swap units as necessary.</para>
37
38 <para>The <varname>passno</varname> field is treated like a simple
39 boolean, and the ordering information is discarded. However, if
40 the root file system is checked, it is checked before all the
41 other file systems.</para>
42
43 <para>See
44 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
45 and
46 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>
47 for more information about special <filename>/etc/fstab</filename>
48 mount options this generator understands.</para>
49
634735b5
CW
50 <para>One special topic is handling of symbolic links. Historical init
51 implementations supported symlinks in <filename>/etc/fstab</filename>.
52 Because mount units will refuse mounts where the target is a symbolic link,
53 this generator will resolve any symlinks as far as possible when processing
54 <filename>/etc/fstab</filename> in order to enhance backwards compatibility.
55 If a symlink target does not exist at the time that this generator runs, it
56 is assumed that the symlink target is the final target of the mount.</para>
57
b1c1a519
ZC
58 <para><filename>systemd-fstab-generator</filename> implements
59 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
798d3a52
ZJS
60 </refsect1>
61
62 <refsect1>
63 <title>Kernel Command Line</title>
64
65 <para><filename>systemd-fstab-generator</filename> understands the
66 following kernel command line parameters:</para>
67
68 <variablelist class='kernel-commandline-options'>
69
70 <varlistentry>
71 <term><varname>fstab=</varname></term>
72 <term><varname>rd.fstab=</varname></term>
73
74 <listitem><para>Takes a boolean argument. Defaults to
75 <literal>yes</literal>. If <literal>no</literal>, causes the
91214a37 76 generator to ignore any mounts or swap devices configured in
798d3a52 77 <filename>/etc/fstab</filename>. <varname>rd.fstab=</varname>
91214a37 78 is honored only by the initial RAM disk (initrd) while
798d3a52
ZJS
79 <varname>fstab=</varname> is honored by both the main system
80 and the initrd.</para></listitem>
81 </varlistentry>
91214a37 82
798d3a52
ZJS
83 <varlistentry>
84 <term><varname>root=</varname></term>
85
86 <listitem><para>Takes the root filesystem to mount in the
87 initrd. <varname>root=</varname> is honored by the
88 initrd.</para></listitem>
89 </varlistentry>
91214a37 90
798d3a52
ZJS
91 <varlistentry>
92 <term><varname>rootfstype=</varname></term>
93
94 <listitem><para>Takes the root filesystem type that will be
95 passed to the mount command. <varname>rootfstype=</varname> is
96 honored by the initrd.</para></listitem>
97 </varlistentry>
91214a37 98
798d3a52
ZJS
99 <varlistentry>
100 <term><varname>rootflags=</varname></term>
101
102 <listitem><para>Takes the root filesystem mount options to
103 use. <varname>rootflags=</varname> is honored by the
104 initrd.</para></listitem>
105 </varlistentry>
91214a37 106
798d3a52
ZJS
107 <varlistentry>
108 <term><varname>mount.usr=</varname></term>
109
110 <listitem><para>Takes the <filename>/usr</filename> filesystem
111 to be mounted by the initrd. If
112 <varname>mount.usrfstype=</varname> or
113 <varname>mount.usrflags=</varname> is set, then
114 <varname>mount.usr=</varname> will default to the value set in
115 <varname>root=</varname>.</para>
116
b938cb90 117 <para>Otherwise, this parameter defaults to the
798d3a52
ZJS
118 <filename>/usr</filename> entry found in
119 <filename>/etc/fstab</filename> on the root filesystem.</para>
120
121 <para><varname>mount.usr=</varname> is honored by the initrd.
122 </para></listitem>
123 </varlistentry>
91214a37 124
798d3a52
ZJS
125 <varlistentry>
126 <term><varname>mount.usrfstype=</varname></term>
127
128 <listitem><para>Takes the <filename>/usr</filename> filesystem
129 type that will be passed to the mount command. If
130 <varname>mount.usr=</varname> or
131 <varname>mount.usrflags=</varname> is set, then
132 <varname>mount.usrfstype=</varname> will default to the value
133 set in <varname>rootfstype=</varname>.</para>
134
b938cb90 135 <para>Otherwise, this value will be read from the
798d3a52
ZJS
136 <filename>/usr</filename> entry in
137 <filename>/etc/fstab</filename> on the root filesystem.</para>
138
139 <para><varname>mount.usrfstype=</varname> is honored by the
140 initrd.</para></listitem>
141 </varlistentry>
91214a37 142
798d3a52
ZJS
143 <varlistentry>
144 <term><varname>mount.usrflags=</varname></term>
145
146 <listitem><para>Takes the <filename>/usr</filename> filesystem
147 mount options to use. If <varname>mount.usr=</varname> or
148 <varname>mount.usrfstype=</varname> is set, then
ff9b60f3 149 <varname>mount.usrflags=</varname> will default to the value
798d3a52
ZJS
150 set in <varname>rootflags=</varname>.</para>
151
b938cb90 152 <para>Otherwise, this value will be read from the
798d3a52
ZJS
153 <filename>/usr</filename> entry in
154 <filename>/etc/fstab</filename> on the root filesystem.</para>
155
156 <para><varname>mount.usrflags=</varname> is honored by the
157 initrd.</para></listitem>
158 </varlistentry>
91214a37
LP
159
160 <varlistentry>
161 <term><varname>systemd.volatile=</varname></term>
162
163 <listitem><para>Controls whether the system shall boot up in volatile mode. Takes a boolean argument or the
164 special value <option>state</option>.</para>
165
166 <para>If false (the default), this generator makes no changes to the mount tree and the system is booted up in
167 normal mode.</para>
168
169 <para>If true the generator ensures
170 <citerefentry><refentrytitle>systemd-volatile-root.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
171 is run as part of the initial RAM disk ("initrd"). This service changes the mount table before transitioning to
172 the host system, so that a volatile memory file system (<literal>tmpfs</literal>) is used as root directory,
173 with only <filename>/usr</filename> mounted into it from the configured root file system, in read-only
174 mode. This way the system operates in fully stateless mode, with all configuration and state reset at boot and
175 lost at shutdown, as <filename>/etc</filename> and <filename>/var</filename> will be served from the (initially
176 unpopulated) volatile memory file system.</para>
177
178 <para>If set to <option>state</option> the generator will leave the root
179 directory mount point unaltered, however will mount a <literal>tmpfs</literal> file system to
301a21a8 180 <filename>/var</filename>. In this mode the normal system configuration (i.e. the contents of
91214a37
LP
181 <literal>/etc</literal>) is in effect (and may be modified during system runtime), however the system state
182 (i.e. the contents of <literal>/var</literal>) is reset at boot and lost at shutdown.</para>
183
184 <para>Note that in none of these modes the root directory, <filename>/etc</filename>, <filename>/var</filename>
185 or any other resources stored in the root file system are physically removed. It's thus safe to boot a system
186 that is normally operated in non-volatile mode temporarily into volatile mode, without losing data.</para>
187
188 <para>Note that enabling this setting will only work correctly on operating systems that can boot up with only
189 <filename>/usr</filename> mounted, and are able to automatically populate <filename>/etc</filename>, and also
190 <filename>/var</filename> in case of <literal>systemd.volatile=yes</literal>.</para></listitem>
191 </varlistentry>
798d3a52
ZJS
192 </variablelist>
193 </refsect1>
194
195 <refsect1>
196 <title>See Also</title>
197 <para>
198 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
3ba3a79d 199 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
798d3a52
ZJS
200 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
201 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
91214a37
LP
202 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
203 <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>
798d3a52
ZJS
204 </para>
205 </refsect1>
059b37cc
LP
206
207</refentry>