]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-gpt-auto-generator.xml
Merge pull request #25168 from valentindavid/valentindavid/umount-move-recursive...
[thirdparty/systemd.git] / man / systemd-gpt-auto-generator.xml
CommitLineData
bb5a34fb 1<?xml version="1.0"?> <!--*-nxml-*-->
3a54a157
ZJS
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
bb5a34fb
ZJS
5
6<refentry id="systemd-gpt-auto-generator" conditional='HAVE_BLKID'>
d67ca9ab 7
798d3a52
ZJS
8 <refentryinfo>
9 <title>systemd-gpt-auto-generator</title>
10 <productname>systemd</productname>
798d3a52
ZJS
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>systemd-gpt-auto-generator</refentrytitle>
15 <manvolnum>8</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>systemd-gpt-auto-generator</refname>
31ca5166
LP
20 <refpurpose>Generator for automatically discovering and mounting root, <filename>/home/</filename>,
21 <filename>/srv/</filename>, <filename>/var/</filename> and <filename>/var/tmp/</filename> partitions, as
e9dd6984 22 well as discovering and enabling swap partitions, based on GPT partition type GUIDs</refpurpose>
798d3a52
ZJS
23 </refnamediv>
24
25 <refsynopsisdiv>
12b42c76 26 <para><filename>/usr/lib/systemd/system-generators/systemd-gpt-auto-generator</filename></para>
798d3a52
ZJS
27 </refsynopsisdiv>
28
29 <refsect1>
30 <title>Description</title>
31
aa4c0684 32 <para><filename>systemd-gpt-auto-generator</filename> is a unit generator that automatically discovers
31ca5166
LP
33 root, <filename>/home/</filename>, <filename>/srv/</filename>, <filename>/var/</filename>,
34 <filename>/var/tmp/</filename>, the EFI System Partition, the Extended Boot Loader Partition and swap
35 partitions and creates mount and swap units for them, based on the partition type GUIDs of GUID partition
36 tables (GPT), see <ulink url="https://uefi.org/specifications">UEFI Specification</ulink>, chapter 5. It
db811444 37 implements the <ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions
aa4c0684
LP
38 Specification</ulink>. Note that this generator has no effect on non-GPT systems, and on specific mount
39 points that are directories already containing files. Also, on systems where the units are explicitly
40 configured (for example, listed in <citerefentry
41 project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>), the
42 units this generator creates are overridden, but additional implicit dependencies might be
43 created.</para>
798d3a52 44
6d881882
ZJS
45 <para>This generator will only look for the root partition on the same physical disk where the EFI System
46 Partition (ESP) is located. Note that support from the boot loader is required: the EFI variable
31ca5166
LP
47 <varname>LoaderDevicePartUUID</varname> of the <constant>4a67b082-0a4c-41cf-b6c7-440b29bb8c4f</constant>
48 vendor UUID is used to determine from which partition, and hence the disk from which the system was
49 booted. If the boot loader does not set this variable, this generator will not be able to autodetect the
50 root partition. See the <ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader
51 Interface</ulink> for details.</para>
798d3a52 52
b50a3a15
ZJS
53 <para>Similarly, this generator will only look for the other partitions on the same physical disk as the
54 root partition. In this case, boot loader support is not required. These partitions will not be searched
55 for on systems where the root file system is distributed on multiple disks, for example via btrfs RAID.
8d5a4f27 56 </para>
798d3a52 57
b50a3a15
ZJS
58 <para><filename>systemd-gpt-auto-generator</filename> is useful for centralizing file system
59 configuration in the partition table and making configuration in <filename>/etc/fstab</filename> or on
60 the kernel command line unnecessary.</para>
61
798d3a52
ZJS
62 <para>This generator looks for the partitions based on their
63 partition type GUID. The following partition type GUIDs are
64 identified:</para>
65
66 <table>
67 <title>Partition Type GUIDs</title>
68 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
69 <colspec colname="guid" />
70 <colspec colname="name" />
aa4c0684 71 <colspec colname="where" />
798d3a52
ZJS
72 <colspec colname="explanation" />
73 <thead>
74 <row>
75 <entry>Partition Type GUID</entry>
76 <entry>Name</entry>
aa4c0684 77 <entry>Mount Point</entry>
798d3a52
ZJS
78 <entry>Explanation</entry>
79 </row>
80 </thead>
81 <tbody>
82 <row>
c6a173ef 83 <entry><constant>SD_GPT_ROOT_X86_64</constant> <constant>4f68bce3-e8cd-4db1-96e7-fbcaf984b709</constant></entry>
798d3a52 84 <entry><filename>Root Partition (x86-64)</filename></entry>
aa4c0684 85 <entry><filename>/</filename></entry>
6d881882 86 <entry>The first partition with this type UUID, located on the same disk as the ESP, is used as the root file system <filename>/</filename> on AMD64 / 64-bit x86 systems.</entry>
798d3a52
ZJS
87 </row>
88 <row>
c6a173ef 89 <entry><constant>SD_GPT_ROOT_ARM64</constant> <constant>b921b045-1df0-41c3-af44-4c6f280d3fae</constant></entry>
798d3a52 90 <entry><filename>Root Partition (64-bit ARM)</filename></entry>
aa4c0684 91 <entry><filename>/</filename></entry>
6d881882 92 <entry>The first partition with this type UUID, located on the same disk as the ESP, is used as the root file system <filename>/</filename> on AArch64 / 64-bit ARM systems.</entry>
798d3a52 93 </row>
b793ddfa 94 <row>
c6a173ef
ZJS
95 <entry>
96 <constant>SD_GPT_ROOT_ALPHA</constant> <constant>SD_GPT_ROOT_ARC</constant> <constant>SD_GPT_ROOT_ARM</constant> <constant>SD_GPT_ROOT_ARM64</constant> <constant>SD_GPT_ROOT_IA64</constant> <constant>SD_GPT_ROOT_LOONGARCH64</constant> <constant>SD_GPT_ROOT_MIPS_LE</constant> <constant>SD_GPT_ROOT_MIPS64_LE</constant> <constant>SD_GPT_ROOT_PARISC</constant> <constant>SD_GPT_ROOT_PPC</constant> <constant>SD_GPT_ROOT_PPC64</constant> <constant>SD_GPT_ROOT_PPC64_LE</constant> <constant>SD_GPT_ROOT_RISCV32</constant> <constant>SD_GPT_ROOT_RISCV64</constant> <constant>SD_GPT_ROOT_S390</constant> <constant>SD_GPT_ROOT_S390X</constant> <constant>SD_GPT_ROOT_TILEGX</constant> <constant>SD_GPT_ROOT_X86</constant> <constant>SD_GPT_ROOT_X86_64</constant> <constant>SD_GPT_USR_ALPHA</constant> <constant>SD_GPT_USR_ARC</constant> <constant>SD_GPT_USR_ARM</constant> <constant>SD_GPT_USR_IA64</constant> <constant>SD_GPT_USR_LOONGARCH64</constant> <constant>SD_GPT_USR_MIPS_LE</constant> <constant>SD_GPT_USR_MIPS64_LE</constant> <constant>SD_GPT_USR_PARISC</constant> <constant>SD_GPT_USR_PPC</constant> <constant>SD_GPT_USR_PPC64</constant> <constant>SD_GPT_USR_PPC64_LE</constant> <constant>SD_GPT_USR_RISCV32</constant> <constant>SD_GPT_USR_RISCV64</constant> <constant>SD_GPT_USR_S390</constant> <constant>SD_GPT_USR_S390X</constant> <constant>SD_GPT_USR_TILEGX</constant> <constant>SD_GPT_USR_X86</constant>
97 </entry>
98 <entry>root partitions for other architectures</entry>
4e767154 99 <entry><filename>/</filename></entry>
db811444 100 <entry>The first partition with the type UUID matching the architecture, located on the same disk as the ESP, is used as the root file system <filename>/</filename>. For the full list and constant values, see <ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions Specification</ulink>.</entry>
4e767154 101 </row>
499f0f82 102 <row>
c6a173ef 103 <entry><constant>SD_GPT_HOME</constant> <constant>933ac7e1-2eb4-4f13-b844-0e14e2aef915</constant></entry>
798d3a52 104 <entry>Home Partition</entry>
aa4c0684 105 <entry><filename>/home/</filename></entry>
6d881882 106 <entry>The first partition with this type UUID on the same disk as the ESP is mounted to <filename>/home/</filename>.</entry>
798d3a52
ZJS
107 </row>
108 <row>
c6a173ef 109 <entry><constant>SD_GPT_SRV</constant> <constant>3b8f8425-20e0-4f3b-907f-1a25a76f98e8</constant></entry>
798d3a52 110 <entry>Server Data Partition</entry>
aa4c0684 111 <entry><filename>/srv/</filename></entry>
6d881882 112 <entry>The first partition with this type UUID on the same disk as the ESP is mounted to <filename>/srv/</filename>.</entry>
31ca5166
LP
113 </row>
114 <row>
c6a173ef 115 <entry><constant>SD_GPT_VAR</constant> <constant>4d21b016-b534-45c2-a9fb-5c16e091fd2d</constant></entry>
31ca5166
LP
116 <entry>Variable Data Partition</entry>
117 <entry><filename>/var/</filename></entry>
6d881882 118 <entry>The first partition with this type UUID on the same disk as the ESP is mounted to <filename>/var/</filename> — under the condition its partition UUID matches the first 128 bit of the HMAC-SHA256 of the GPT type uuid of this partition keyed by the machine ID of the installation stored in <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</entry>
31ca5166
LP
119 </row>
120 <row>
c6a173ef 121 <entry><constant>SD_GPT_TMP</constant> <constant>7ec6f557-3bc5-4aca-b293-16ef5df639d1</constant></entry>
31ca5166
LP
122 <entry>Temporary Data Partition</entry>
123 <entry><filename>/var/tmp/</filename></entry>
6d881882 124 <entry>The first partition with this type UUID on the same disk as the ESP is mounted to <filename>/var/tmp/</filename>.</entry>
798d3a52
ZJS
125 </row>
126 <row>
c6a173ef 127 <entry><constant>SD_GPT_SWAP</constant> <constant>0657fd6d-a4ab-43c4-84e5-0933c84b4f4f</constant></entry>
798d3a52 128 <entry>Swap</entry>
aa4c0684 129 <entry>n/a</entry>
6d881882 130 <entry>All partitions with this type UUID on the same disk as the ESP are used as swap.</entry>
798d3a52 131 </row>
b52a109a 132 <row>
c6a173ef 133 <entry><constant>SD_GPT_ESP</constant> <constant>c12a7328-f81f-11d2-ba4b-00a0c93ec93b</constant></entry>
b52a109a 134 <entry>EFI System Partition (ESP)</entry>
aa4c0684 135 <entry><filename>/efi/</filename> or <filename>/boot/</filename></entry>
6d881882 136 <entry>The first partition with this type UUID located on the same disk as the root partition is mounted to <filename>/boot/</filename> or <filename>/efi/</filename>, see below.</entry>
b52a109a 137 </row>
aa4c0684 138 <row>
c6a173ef 139 <entry><constant>SD_GPT_XBOOTLDR</constant> <constant>bc13c2ff-59e6-4262-a352-b275fd6f7172</constant></entry>
aa4c0684
LP
140 <entry>Extended Boot Loader Partition</entry>
141 <entry><filename>/boot/</filename></entry>
6d881882 142 <entry>The first partition with this type UUID located on the same disk as the root partition is mounted to <filename>/boot/</filename>, see below.</entry>
aa4c0684 143 </row>
798d3a52
ZJS
144 </tbody>
145 </tgroup>
146 </table>
147
8d5a4f27
ZJS
148 <para>This generator understands the following attribute flags for partitions:</para>
149
150 <table>
c6a173ef
ZJS
151 <title>Partition Attribute Flags</title>
152 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
153 <colspec colname="flag" />
8d5a4f27
ZJS
154 <colspec colname="where" />
155 <colspec colname="explanation" />
156 <thead>
157 <row>
c6a173ef 158 <entry>Flag</entry>
8d5a4f27
ZJS
159 <entry>Applicable to</entry>
160 <entry>Explanation</entry>
161 </row>
162 </thead>
163 <tbody>
164 <row>
c6a173ef 165 <entry><constant>SD_GPT_FLAG_READ_ONLY</constant> <constant>0x1000000000000000</constant></entry>
31ca5166 166 <entry><filename>/</filename>, <filename>/home/</filename>, <filename>/srv/</filename>, <filename>/var/</filename>, <filename>/var/tmp/</filename>, Extended Boot Loader Partition</entry>
8d5a4f27
ZJS
167 <entry>Partition is mounted read-only</entry>
168 </row>
169
170 <row>
c6a173ef 171 <entry><constant>SD_GPT_FLAG_NO_AUTO</constant> <constant>0x8000000000000000</constant></entry>
31ca5166 172 <entry><filename>/</filename>, <filename>/home/</filename>, <filename>/srv/</filename>, <filename>/var/</filename>, <filename>/var/tmp/</filename>, Extended Boot Loader Partition</entry>
8d5a4f27
ZJS
173 <entry>Partition is not mounted automatically</entry>
174 </row>
175
176 <row>
c6a173ef 177 <entry><constant>SD_GPT_FLAG_NO_BLOCK_IO_PROTOCOL</constant> <constant>0x0000000000000002</constant></entry>
aa4c0684 178 <entry>EFI System Partition (ESP)</entry>
8d5a4f27
ZJS
179 <entry>Partition is not mounted automatically</entry>
180 </row>
181 </tbody>
182 </tgroup>
183 </table>
184
31ca5166
LP
185 <para>The <filename>/home/</filename>, <filename>/srv/</filename>, <filename>/var/</filename> and
186 <filename>/var/tmp/</filename> partitions may be encrypted in LUKS format. In this case, a device mapper
187 device is set up under the names <filename>/dev/mapper/home</filename>,
188 <filename>/dev/mapper/srv</filename>, <filename>/dev/mapper/var</filename> and
189 <filename>/dev/mapper/tmp</filename>. Note that this might create conflicts if the same partition is
190 listed in <filename>/etc/crypttab</filename> with a different device mapper device name.</para>
35a05d8d 191
5337cccf
AP
192 <para>When systemd is running in the initrd the <filename>/</filename> partition may be encrypted in LUKS
193 format as well. In this case, a device mapper device is set up under the name <filename>/dev/mapper/root</filename>,
194 and a <filename>sysroot.mount</filename> is set up that mounts the device under <filename>/sysroot</filename>.
195 For more information, see <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
196 </para>
aa4c0684 197
b00651cf
KK
198 <para>The root partition can be specified by symlinking <filename>/run/systemd/volatile-root</filename>
199 to <filename>/dev/block/$major:$minor</filename>. This is especially useful if the root mount has been
200 replaced by some form of volatile file system (overlayfs).
201 </para>
202
aa4c0684
LP
203 <para>Mount and automount units for the EFI System Partition (ESP) are generated on EFI systems. The ESP
204 is mounted to <filename>/boot/</filename> (except if an Extended Boot Loader partition exists, see
205 below), unless a mount point directory <filename>/efi/</filename> exists, in which case it is mounted
206 there. Since this generator creates an automount unit, the mount will only be activated on-demand, when
207 accessed. On systems where <filename>/boot/</filename> (or <filename>/efi/</filename> if it exists) is an
208 explicitly configured mount (for example, listed in <citerefentry
209 project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>) or where
210 the <filename>/boot/</filename> (or <filename>/efi/</filename>) mount point is non-empty, no mount units
211 are generated.</para>
212
213 <para>If the disk contains an Extended Boot Loader partition, as defined in the <ulink
db811444 214 url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification</ulink>, it is made
31ca5166 215 available at <filename>/boot/</filename> (by means of an automount point, similar to the ESP, see
aa4c0684
LP
216 above). If both an EFI System Partition and an Extended Boot Loader partition exist the latter is
217 preferably mounted to <filename>/boot/</filename>. Make sure to create both <filename>/efi/</filename>
218 and <filename>/boot/</filename> to ensure both partitions are mounted.</para>
798d3a52
ZJS
219
220 <para>When using this generator in conjunction with btrfs file
221 systems, make sure to set the correct default subvolumes on them,
222 using <command>btrfs subvolume set-default</command>.</para>
223
ff386f98
LP
224 <para>If the system was booted via
225 <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> and the
226 stub reported to userspace that the kernel image was measured to a TPM2 PCR, then any discovered root and
227 <filename>/var/</filename> volume identifiers (and volume encryption key in case it is encrypted) will be
228 automatically measured into PCR 15 on activation, via
229 <citerefentry><refentrytitle>systemd-pcrfs@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
230
798d3a52 231 <para><filename>systemd-gpt-auto-generator</filename> implements
b1c1a519 232 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
798d3a52
ZJS
233 </refsect1>
234
17ec531f
ZJS
235 <refsect1>
236 <title>Kernel Command Line</title>
237
238 <para><filename>systemd-gpt-auto-generator</filename> understands the following kernel command line
239 parameters:</para>
240
241 <variablelist class='kernel-commandline-options'>
242
243 <varlistentry>
244 <term><varname>systemd.gpt_auto</varname></term>
245 <term><varname>rd.systemd.gpt_auto</varname></term>
246
247 <listitem><para>Those options take an optional boolean argument, and default to yes.
248 The generator is enabled by default, and a negative value may be used to disable it.
249 </para></listitem>
250 </varlistentry>
251
252 <varlistentry>
253 <term><varname>root=</varname></term>
cf451f38
LP
254 <term><varname>rootfstype=</varname></term>
255 <term><varname>rootflags=</varname></term>
17ec531f 256
cf451f38
LP
257 <listitem><para>When <varname>root=</varname> is used with the special value
258 <literal>gpt-auto</literal> (or if the parameter is not used at all), automatic discovery of the root
259 partition based on the GPT partition type is enabled. Any other value disables this
260 logic.</para>
261
262 <para>The <varname>rootfstype=</varname> and <varname>rootflags=</varname> are used to select the
263 file system type and options when the root file system is automatically discovered.</para></listitem>
17ec531f
ZJS
264 </varlistentry>
265
266 <varlistentry>
267 <term><varname>rw</varname></term>
268 <term><varname>ro</varname></term>
269
270 <listitem><para>Mount the root partition read-write or read-only <emphasis>initially</emphasis>.</para>
271
272 <para>Note that unlike most kernel command line options these settings do not override configuration
273 in the file system, and the file system may be remounted later. See
274 <citerefentry><refentrytitle>systemd-remount-fs.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
275 </para></listitem>
276 </varlistentry>
277 </variablelist>
278 </refsect1>
279
798d3a52
ZJS
280 <refsect1>
281 <title>See Also</title>
282 <para>
283 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
284 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
285 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
286 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
798d3a52 287 <citerefentry><refentrytitle>systemd-cryptsetup@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
ff386f98 288 <citerefentry><refentrytitle>systemd-pcrfs@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
31ca5166 289 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3ba3a79d
ZJS
290 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
291 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
292 <citerefentry project='man-pages'><refentrytitle>btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
293 </para>
294 </refsect1>
d67ca9ab
LP
295
296</refentry>