1 <?xml version=
"1.0"?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id=
"systemd-gpt-auto-generator" conditional='HAVE_BLKID'
7 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
10 <title>systemd-gpt-auto-generator
</title>
11 <productname>systemd
</productname>
15 <refentrytitle>systemd-gpt-auto-generator
</refentrytitle>
16 <manvolnum>8</manvolnum>
20 <refname>systemd-gpt-auto-generator
</refname>
21 <refpurpose>Generator for automatically discovering and mounting root,
<filename>/home/
</filename>,
22 <filename>/srv/
</filename>,
<filename>/var/
</filename> and
<filename>/var/tmp/
</filename> partitions, as
23 well as discovering and enabling swap partitions, based on GPT partition type GUIDs
</refpurpose>
27 <para><filename>/usr/lib/systemd/system-generators/systemd-gpt-auto-generator
</filename></para>
31 <title>Description
</title>
33 <para><filename>systemd-gpt-auto-generator
</filename> is a unit generator that automatically discovers
34 the root partition,
<filename>/home/
</filename>,
<filename>/srv/
</filename>,
<filename>/var/
</filename>,
35 <filename>/var/tmp/
</filename>, the EFI System Partition (ESP), the Extended Boot Loader Partition
36 (XBOOTLDR), and swap partitions and creates mount and swap units for them, based on the partition type
37 GUIDs of GUID partition tables (GPT). See
<ulink url=
"https://uefi.org/specifications">UEFI
38 Specification
</ulink>, chapter
5 for more details. It implements the
<ulink
39 url=
"https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable
40 Partitions Specification
</ulink>.
</para>
42 <para>Note that this generator has no effect on non-GPT systems. It will also not create mount point
43 configuration for directories which already contain files or if the mount point is explicitly configured
45 project='man-pages'
><refentrytitle>fstab
</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Additionally
46 no unit will be created for the ESP or the XBOOTLDR partition if mount entries are found in the
47 <filename>/boot/
</filename> or
<filename>/efi/
</filename> hierarchies in
<citerefentry
48 project='man-pages'
><refentrytitle>fstab
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
50 <para>If the units this generator creates are overridden, for example by units in directories with higher
51 precedence, drop-ins and additional dependencies created by this generator might still be used.
</para>
53 <para>This generator will only look for the root partition on the same physical disk where the EFI System
54 Partition (ESP) is located. Note that support from the boot loader is required: the EFI variable
55 <varname>LoaderDevicePartUUID
</varname> of the
<constant>4a67b082-
0a4c-
41cf-b6c7-
440b29bb8c4f
</constant>
56 vendor UUID is used to determine from which partition, and hence the disk, from which the system was
57 booted. If the boot loader does not set this variable, this generator will not be able to detect the root
58 partition. See the
<ulink url=
"https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface
</ulink>
61 <para>Similarly, this generator will only look for the other partitions on the same physical disk as the
62 root partition. In this case, boot loader support is not required. These partitions will not be searched
63 for on systems where the root file system is distributed on multiple disks, for example via btrfs RAID.
66 <para><filename>systemd-gpt-auto-generator
</filename> is useful for centralizing file system
67 configuration in the partition table and making configuration in
<filename>/etc/fstab
</filename> or on
68 the kernel command line unnecessary.
</para>
70 <para>This generator looks for the partitions based on their
71 partition type GUID. The following partition type GUIDs are
75 <title>Partition Type GUIDs
</title>
76 <tgroup cols='
5' align='left' colsep='
1' rowsep='
1'
>
77 <colspec colname=
"type" />
78 <colspec colname=
"guid" />
79 <colspec colname=
"name" />
80 <colspec colname=
"where" />
81 <colspec colname=
"explanation" />
84 <entry>Partition Type
</entry>
87 <entry>Mount Point
</entry>
88 <entry>Explanation
</entry>
93 <entry><constant>SD_GPT_ROOT_X86_64
</constant></entry>
94 <entry><constant>4f68bce3-e8cd-
4db1-
96e7-fbcaf984b709
</constant></entry>
95 <entry><filename>Root Partition (x86-
64)
</filename></entry>
96 <entry><filename>/
</filename></entry>
97 <entry>The first partition with this type UUID, located on the same disk as the ESP used for booting, is used as the root file system
<filename>/
</filename> on AMD64 /
64-bit x86 systems.
</entry>
100 <entry><constant>SD_GPT_ROOT_ARM64
</constant></entry>
101 <entry><constant>b921b045-
1df0-
41c3-af44-
4c6f280d3fae
</constant></entry>
102 <entry><filename>Root Partition (
64-bit ARM)
</filename></entry>
103 <entry><filename>/
</filename></entry>
104 <entry>The first partition with this type UUID, located on the same disk as the ESP used for booting, is used as the root file system
<filename>/
</filename> on AArch64 /
64-bit ARM systems.
</entry>
107 <entry><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
</constant> <constant>SD_GPT_ROOT_MIPS64
</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></entry>
109 <entry>Root partitions for other architectures
</entry>
110 <entry><filename>/
</filename></entry>
111 <entry>The first partition with the type UUID matching the architecture, located on the same disk as the ESP used for booting, 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>
114 <entry><constant>SD_GPT_HOME
</constant></entry>
115 <entry><constant>933ac7e1-
2eb4-
4f13-b844-
0e14e2aef915
</constant></entry>
116 <entry>Home Partition
</entry>
117 <entry><filename>/home/
</filename></entry>
118 <entry>The first partition with this type UUID on the same disk as the root partition is mounted to
<filename>/home/
</filename>.
</entry>
121 <entry><constant>SD_GPT_SRV
</constant></entry>
122 <entry><constant>3b8f8425-
20e0-
4f3b-
907f-
1a25a76f98e8
</constant></entry>
123 <entry>Server Data Partition
</entry>
124 <entry><filename>/srv/
</filename></entry>
125 <entry>The first partition with this type UUID on the same disk as the root partition is mounted to
<filename>/srv/
</filename>.
</entry>
128 <entry><constant>SD_GPT_VAR
</constant></entry>
129 <entry><constant>4d21b016-b534-
45c2-a9fb-
5c16e091fd2d
</constant></entry>
130 <entry>Variable Data Partition
</entry>
131 <entry><filename>/var/
</filename></entry>
132 <entry>The first partition with this type UUID on the same disk as the root partition 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>
135 <entry><constant>SD_GPT_TMP
</constant></entry>
136 <entry><constant>7ec6f557-
3bc5-
4aca-b293-
16ef5df639d1
</constant></entry>
137 <entry>Temporary Data Partition
</entry>
138 <entry><filename>/var/tmp/
</filename></entry>
139 <entry>The first partition with this type UUID on the same disk as the root partition is mounted to
<filename>/var/tmp/
</filename>.
</entry>
142 <entry><constant>SD_GPT_SWAP
</constant></entry>
143 <entry><constant>0657fd6d-a4ab-
43c4-
84e5-
0933c84b4f4f
</constant></entry>
146 <entry>All partitions with this type UUID on the same disk as the root partition are used as swap.
</entry>
149 <entry><constant>SD_GPT_ESP
</constant></entry>
150 <entry><constant>c12a7328-f81f-
11d2-ba4b-
00a0c93ec93b
</constant></entry>
151 <entry>EFI System Partition (ESP)
</entry>
152 <entry><filename>/efi/
</filename> or
<filename>/boot/
</filename></entry>
153 <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>
156 <entry><constant>SD_GPT_XBOOTLDR
</constant></entry>
157 <entry><constant>bc13c2ff-
59e6-
4262-a352-b275fd6f7172
</constant></entry>
158 <entry>Extended Boot Loader Partition
</entry>
159 <entry><filename>/boot/
</filename></entry>
160 <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>
166 <para>This generator understands the following attribute flags for partitions:
</para>
169 <title>Partition Attribute Flags
</title>
170 <tgroup cols='
4' align='left' colsep='
1' rowsep='
1'
>
171 <colspec colname=
"flag" />
172 <colspec colname=
"value" />
173 <colspec colname=
"where" />
174 <colspec colname=
"explanation" />
179 <entry>Applicable to
</entry>
180 <entry>Explanation
</entry>
185 <entry><constant>SD_GPT_FLAG_READ_ONLY
</constant></entry>
186 <entry><constant>0x1000000000000000</constant></entry>
187 <entry><filename>/
</filename>,
<filename>/home/
</filename>,
<filename>/srv/
</filename>,
<filename>/var/
</filename>,
<filename>/var/tmp/
</filename>, Extended Boot Loader Partition
</entry>
188 <entry>Partition is mounted read-only
</entry>
192 <entry><constant>SD_GPT_FLAG_NO_AUTO
</constant></entry>
193 <entry><constant>0x8000000000000000</constant></entry>
194 <entry><filename>/
</filename>,
<filename>/home/
</filename>,
<filename>/srv/
</filename>,
<filename>/var/
</filename>,
<filename>/var/tmp/
</filename>, Extended Boot Loader Partition
</entry>
195 <entry>Partition is not mounted automatically
</entry>
199 <entry><constant>SD_GPT_FLAG_NO_BLOCK_IO_PROTOCOL
</constant></entry>
200 <entry><constant>0x0000000000000002</constant></entry>
201 <entry>EFI System Partition (ESP)
</entry>
202 <entry>Partition is not mounted automatically
</entry>
208 <para>The
<filename>/home/
</filename>,
<filename>/srv/
</filename>,
<filename>/var/
</filename>,
209 <filename>/var/tmp/
</filename> and swap partitions may be encrypted in LUKS format. In this case, a
210 device mapper device is set up under the names
<filename>/dev/mapper/home
</filename>,
211 <filename>/dev/mapper/srv
</filename>,
<filename>/dev/mapper/var
</filename>,
212 <filename>/dev/mapper/tmp
</filename> or
<filename>/dev/mapper/swap
</filename>. Note that this might
213 create conflicts if the same partition is listed in
<filename>/etc/crypttab
</filename> with a different
214 device mapper device name.
</para>
216 <para>When systemd is running in the initrd the
<filename>/
</filename> partition may be encrypted with
217 LUKS as well. In this case, a device mapper device is set up under the name
218 <filename>/dev/mapper/root
</filename>, and a
<filename>sysroot.mount
</filename> is set up that mounts the
219 device under
<filename>/sysroot
</filename>. For more information, see
220 <citerefentry><refentrytitle>bootup
</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
223 <para>The root partition can be specified by symlinking
<filename>/run/systemd/volatile-root
</filename>
224 to
<filename>/dev/block/$major:$minor
</filename>. This is especially useful if the root mount has been
225 replaced by some form of volatile file system (overlayfs).
228 <para>Mount and automount units for the EFI System Partition (ESP) and Extended Boot Loader Partition
229 (XBOOTLDR) are generated on EFI systems. If the disk contains an XBOOTLDR partition, as defined in the
230 <ulink url=
"https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader
231 Specification
</ulink>, it is made available at
<filename>/boot/
</filename>. This generator creates an
232 automount unit; the mount will only be activated on-demand when accessed. The mount point will be created
235 <para>The ESP is mounted to
<filename>/boot/
</filename> if that directory exists and is not used for
236 XBOOTLDR, and otherwise to
<filename>/efi/
</filename>. Same as for
<filename>/boot/
</filename>, an
237 automount unit is used. The mount point will be created if necessary.
</para>
239 <para>No configuration is created for mount points that are configured in
<citerefentry
240 project='man-pages'
><refentrytitle>fstab
</refentrytitle><manvolnum>5</manvolnum></citerefentry> or when
241 the target directory contains files.
</para>
243 <para>When using this generator in conjunction with btrfs file
244 systems, make sure to set the correct default subvolumes on them,
245 using
<command>btrfs subvolume set-default
</command>.
</para>
247 <para>If the system was booted via
248 <citerefentry><refentrytitle>systemd-stub
</refentrytitle><manvolnum>7</manvolnum></citerefentry> and the
249 stub reported to userspace that the kernel image was measured to a TPM2 PCR, then any discovered root and
250 <filename>/var/
</filename> volume identifiers (and volume encryption key in case it is encrypted) will be
251 automatically measured into PCR
15 on activation, via
252 <citerefentry><refentrytitle>systemd-pcrfs@.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
</para>
254 <para><filename>systemd-gpt-auto-generator
</filename> implements
255 <citerefentry><refentrytitle>systemd.generator
</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
</para>
259 <title>Kernel Command Line
</title>
261 <para><filename>systemd-gpt-auto-generator
</filename> understands the following kernel command line
264 <variablelist class='kernel-commandline-options'
>
267 <term><varname>systemd.gpt_auto
</varname></term>
268 <term><varname>rd.systemd.gpt_auto
</varname></term>
270 <listitem><para>Those options take an optional boolean argument, and default to yes.
271 The generator is enabled by default, and a false value may be used to disable it
272 (e.g.
<literal>systemd.gpt_auto=
0</literal>).
275 <xi:include href=
"version-info.xml" xpointer=
"v242"/></listitem>
279 <term><varname>systemd.image_policy=
</varname></term>
280 <term><varname>rd.systemd.image_policy=
</varname></term>
282 <listitem><para>Takes an image dissection policy string as argument (as per
283 <citerefentry><refentrytitle>systemd.image-policy
</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
284 and allows enforcing a policy on dissection and use of the automatically discovered GPT partition
285 table entries.
</para>
287 <xi:include href=
"version-info.xml" xpointer=
"v254"/></listitem>
291 <term><varname>root=
</varname></term>
292 <term><varname>rootfstype=
</varname></term>
293 <term><varname>rootflags=
</varname></term>
295 <listitem><para>When
<varname>root=
</varname> is used with the special value
296 <literal>gpt-auto
</literal> (or if the parameter is not used at all), automatic discovery of the root
297 partition based on the GPT partition type is enabled. Any other value disables this
300 <para>The
<varname>rootfstype=
</varname> and
<varname>rootflags=
</varname> are used to select the
301 file system type and options when the root file system is automatically discovered.
</para>
303 <xi:include href=
"version-info.xml" xpointer=
"v242"/></listitem>
307 <term><varname>rw
</varname></term>
308 <term><varname>ro
</varname></term>
310 <listitem><para>Mount the root partition read-write or read-only
<emphasis>initially
</emphasis>.
</para>
312 <para>Note that unlike most kernel command line options these settings do not override configuration
313 in the file system, and the file system may be remounted later. See
314 <citerefentry><refentrytitle>systemd-remount-fs.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
317 <xi:include href=
"version-info.xml" xpointer=
"v242"/></listitem>
321 <term><varname>systemd.swap=
</varname></term>
323 <listitem><para>Takes a boolean argument or enables the option if specified without an argument.
324 If disabled, automatic discovery of swap partition(s) based on GPT partition type is disabled.
325 Defaults to enabled.
</para>
327 <xi:include href=
"version-info.xml" xpointer=
"v254"/></listitem>
333 <title>See Also
</title>
334 <para><simplelist type=
"inline">
335 <member><citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
336 <member><citerefentry><refentrytitle>systemd.mount
</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
337 <member><citerefentry><refentrytitle>systemd.swap
</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
338 <member><citerefentry><refentrytitle>systemd-fstab-generator
</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
339 <member><citerefentry><refentrytitle>systemd-cryptsetup@.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
340 <member><citerefentry><refentrytitle>systemd-pcrfs@.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
341 <member><citerefentry><refentrytitle>machine-id
</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
342 <member><citerefentry project='die-net'
><refentrytitle>cryptsetup
</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
343 <member><citerefentry project='man-pages'
><refentrytitle>fstab
</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
344 <member><citerefentry project='url'
><refentrytitle url='https://btrfs.readthedocs.io/en/latest/btrfs.html'
>btrfs
</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>