Debian Codegraph @

man/repart.d.xml

raw
1 <?xml version='1.0'?>
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 -->
5
6 <refentry id="repart.d" conditional='ENABLE_REPART'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>repart.d</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>repart.d</refentrytitle>
16 <manvolnum>5</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>repart.d</refname>
21 <refpurpose>Partition Definition Files for Automatic Boot-Time Repartitioning</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <para><simplelist>
26 <member><filename>/etc/repart.d/*.conf</filename></member>
27 <member><filename>/run/repart.d/*.conf</filename></member>
28 <member><filename>/usr/local/lib/repart.d/*.conf</filename></member>
29 <member><filename>/usr/lib/repart.d/*.conf</filename></member>
30 </simplelist></para>
31 </refsynopsisdiv>
32
33 <refsect1>
34 <title>Description</title>
35
36 <para><filename>repart.d/*.conf</filename> files describe basic properties of partitions of block
37 devices of the local system. They may be used to declare types, names and sizes of partitions that shall
38 exist. The
39 <citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry>
40 service reads these files and attempts to add new partitions currently missing and enlarge existing
41 partitions according to these definitions. Operation is generally incremental, i.e. when applied, what
42 exists already is left intact, and partitions are never shrunk, moved or deleted.</para>
43
44 <para>These definition files are useful for implementing operating system images that are prepared and
45 delivered with minimally sized images (for example lacking any state or swap partitions), and which on
46 first boot automatically take possession of any remaining disk space following a few basic rules.</para>
47
48 <para>Currently, support for partition definition files is only implemented for GPT partition
49 tables.</para>
50
51 <para>Partition files are generally matched against any partitions already existing on disk in a simple
52 algorithm: the partition files are sorted by their filename (ignoring the directory prefix), and then
53 compared in order against existing partitions matching the same partition type UUID. Specifically, the
54 first existing partition with a specific partition type UUID is assigned the first definition file with
55 the same partition type UUID, and the second existing partition with a specific type UUID the second
56 partition file with the same type UUID, and so on. Any left-over partition files that have no matching
57 existing partition are assumed to define new partition that shall be created. Such partitions are
58 appended to the end of the partition table, in the order defined by their names utilizing the first
59 partition slot greater than the highest slot number currently in use. Any existing partitions that have
60 no matching partition file are left as they are.</para>
61
62 <para>Note that these definitions may only be used to create and initialize new partitions or to grow
63 existing ones. In the latter case, it will not grow the contained files systems however; separate
64 mechanisms, such as
65 <citerefentry><refentrytitle>systemd-growfs</refentrytitle><manvolnum>8</manvolnum></citerefentry> may be
66 used to grow the file systems inside of these partitions. Partitions may also be marked for automatic
67 growing via the <varname>GrowFileSystem=</varname> setting, in which case the file system is grown on
68 first mount by tools that respect this flag. See below for details.</para>
69 </refsect1>
70
71 <refsect1>
72 <title>[Partition] Section Options</title>
73
74 <variablelist>
75 <varlistentry>
76 <term><varname>Type=</varname></term>
77
78 <listitem><para>The GPT partition type UUID to match. This may be a GPT partition type UUID such as
79 <constant>4f68bce3-e8cd-4db1-96e7-fbcaf984b709</constant>, or an identifier.</para>
80
81 <para>The supported identifiers are:</para>
82
83 <table>
84 <title>GPT partition type identifiers</title>
85
86 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
87 <colspec colname="name" />
88 <colspec colname="explanation" />
89
90 <thead>
91 <row>
92 <entry>Identifier</entry>
93 <entry>Explanation</entry>
94 </row>
95 </thead>
96
97 <tbody>
98 <row>
99 <entry><constant>esp</constant></entry>
100 <entry>EFI System Partition</entry>
101 </row>
102
103 <row>
104 <entry><constant>xbootldr</constant></entry>
105 <entry>Extended Boot Loader Partition</entry>
106 </row>
107
108 <row>
109 <entry><constant>swap</constant></entry>
110 <entry>Swap partition</entry>
111 </row>
112
113 <row>
114 <entry><constant>home</constant></entry>
115 <entry>Home (<filename>/home/</filename>) partition</entry>
116 </row>
117
118 <row>
119 <entry><constant>srv</constant></entry>
120 <entry>Server data (<filename>/srv/</filename>) partition</entry>
121 </row>
122
123 <row>
124 <entry><constant>var</constant></entry>
125 <entry>Variable data (<filename>/var/</filename>) partition</entry>
126 </row>
127
128 <row>
129 <entry><constant>tmp</constant></entry>
130 <entry>Temporary data (<filename>/var/tmp/</filename>) partition</entry>
131 </row>
132
133 <row>
134 <entry><constant>linux-generic</constant></entry>
135 <entry>Generic Linux file system partition</entry>
136 </row>
137
138 <row>
139 <entry><constant>root</constant></entry>
140 <entry>Root file system partition type appropriate for the local architecture (an alias for an architecture root file system partition type listed below, e.g. <constant>root-x86-64</constant>)</entry>
141 </row>
142
143 <row>
144 <entry><constant>root-verity</constant></entry>
145 <entry>Verity data for the root file system partition for the local architecture</entry>
146 </row>
147
148 <row>
149 <entry><constant>root-verity-sig</constant></entry>
150 <entry>Verity signature data for the root file system partition for the local architecture</entry>
151 </row>
152
153 <row>
154 <entry><constant>root-secondary</constant></entry>
155 <entry>Root file system partition of the secondary architecture of the local architecture (usually the matching 32-bit architecture for the local 64-bit architecture)</entry>
156 </row>
157
158 <row>
159 <entry><constant>root-secondary-verity</constant></entry>
160 <entry>Verity data for the root file system partition of the secondary architecture</entry>
161 </row>
162
163 <row>
164 <entry><constant>root-secondary-verity-sig</constant></entry>
165 <entry>Verity signature data for the root file system partition of the secondary architecture</entry>
166 </row>
167
168 <row>
169 <entry><constant>root-{arch}</constant></entry>
170 <entry>Root file system partition of the given architecture (such as <constant>root-x86-64</constant> or <constant>root-riscv64</constant>)</entry>
171 </row>
172
173 <row>
174 <entry><constant>root-{arch}-verity</constant></entry>
175 <entry>Verity data for the root file system partition of the given architecture</entry>
176 </row>
177
178 <row>
179 <entry><constant>root-{arch}-verity-sig</constant></entry>
180 <entry>Verity signature data for the root file system partition of the given architecture</entry>
181 </row>
182
183 <row>
184 <entry><constant>usr</constant></entry>
185 <entry><filename>/usr/</filename> file system partition type appropriate for the local architecture (an alias for an architecture <filename>/usr/</filename> file system partition type listed below, e.g. <constant>usr-x86-64</constant>)</entry>
186 </row>
187
188 <row>
189 <entry><constant>usr-verity</constant></entry>
190 <entry>Verity data for the <filename>/usr/</filename> file system partition for the local architecture</entry>
191 </row>
192
193 <row>
194 <entry><constant>usr-verity-sig</constant></entry>
195 <entry>Verity signature data for the <filename>/usr/</filename> file system partition for the local architecture</entry>
196 </row>
197
198 <row>
199 <entry><constant>usr-secondary</constant></entry>
200 <entry><filename>/usr/</filename> file system partition of the secondary architecture of the local architecture (usually the matching 32-bit architecture for the local 64-bit architecture)</entry>
201 </row>
202
203 <row>
204 <entry><constant>usr-secondary-verity</constant></entry>
205 <entry>Verity data for the <filename>/usr/</filename> file system partition of the secondary architecture</entry>
206 </row>
207
208 <row>
209 <entry><constant>usr-secondary-verity-sig</constant></entry>
210 <entry>Verity signature data for the <filename>/usr/</filename> file system partition of the secondary architecture</entry>
211 </row>
212
213 <row>
214 <entry><constant>usr-{arch}</constant></entry>
215 <entry><filename>/usr/</filename> file system partition of the given architecture</entry>
216 </row>
217
218 <row>
219 <entry><constant>usr-{arch}-verity</constant></entry>
220 <entry>Verity data for the <filename>/usr/</filename> file system partition of the given architecture</entry>
221 </row>
222
223 <row>
224 <entry><constant>usr-{arch}-verity-sig</constant></entry>
225 <entry>Verity signature data for the <filename>/usr/</filename> file system partition of the given architecture</entry>
226 </row>
227 </tbody>
228 </tgroup>
229 </table>
230
231 <para>Architecture specific partition types can use one of these architecture identifiers:
232 <constant>alpha</constant>, <constant>arc</constant>, <constant>arm</constant> (32-bit),
233 <constant>arm64</constant> (64-bit, aka aarch64), <constant>ia64</constant>,
234 <constant>loongarch64</constant>, <constant>mips-le</constant>, <constant>mips64-le</constant>,
235 <constant>parisc</constant>, <constant>ppc</constant>, <constant>ppc64</constant>,
236 <constant>ppc64-le</constant>, <constant>riscv32</constant>, <constant>riscv64</constant>,
237 <constant>s390</constant>, <constant>s390x</constant>, <constant>tilegx</constant>,
238 <constant>x86</constant> (32-bit, aka i386) and <constant>x86-64</constant> (64-bit, aka amd64).</para>
239
240 <para>Most of the partition type UUIDs listed above are defined in the <ulink
241 url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable Partitions
242 Specification</ulink>.</para>
243
244 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
245 </varlistentry>
246
247 <varlistentry>
248 <term><varname>Label=</varname></term>
249
250 <listitem><para>The textual label to assign to the partition if none is assigned yet. Note that this
251 setting is not used for matching. It is also not used when a label is already set for an existing
252 partition. It is thus only used when a partition is newly created or when an existing one had a no
253 label set (that is: an empty label). If not specified, a label derived from the partition type is
254 automatically used. Simple specifier expansion is supported, see below.</para>
255
256 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
257 </varlistentry>
258
259 <varlistentry>
260 <term><varname>VolumeLabel=</varname></term>
261
262 <listitem><para>The textual label to assign to the LUKS superblock if applicable. If not specified
263 defaults to the same string as the partition label (see <varname>Label=</varname> above), however
264 prefixed with <literal>luks-</literal>. This setting has no effect if encryption is not enabled for
265 this partition.</para>
266
267 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
268 </varlistentry>
269
270 <varlistentry>
271 <term><varname>UUID=</varname></term>
272
273 <listitem><para>The UUID to assign to the partition if none is assigned yet. Note that this
274 setting is not used for matching. It is also not used when a UUID is already set for an existing
275 partition. It is thus only used when a partition is newly created or when an existing one had a
276 all-zero UUID set. If set to <literal>null</literal>, the UUID is set to all zeroes. If not specified
277 a UUID derived from the partition type is automatically used.</para>
278
279 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
280 </varlistentry>
281
282 <varlistentry>
283 <term><varname>Priority=</varname></term>
284
285 <listitem><para>A numeric priority to assign to this partition, in the range -2147483648…2147483647,
286 with smaller values indicating higher priority, and higher values indicating smaller priority. This
287 priority is used in case the configured size constraints on the defined partitions do not permit
288 fitting all partitions onto the available disk space. If the partitions do not fit, the highest
289 numeric partition priority of all defined partitions is determined, and all defined partitions with
290 this priority are removed from the list of new partitions to create (which may be multiple, if the
291 same priority is used for multiple partitions). The fitting algorithm is then tried again. If the
292 partitions still do not fit, the now highest numeric partition priority is determined, and the
293 matching partitions removed too, and so on. Partitions of a priority of 0 or lower are never
294 removed. If all partitions with a priority above 0 are removed and the partitions still do not fit on
295 the device the operation fails. Note that this priority has no effect on ordering partitions, for
296 that use the alphabetical order of the filenames of the partition definition files. Defaults to
297 0.</para>
298
299 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
300 </varlistentry>
301
302 <varlistentry>
303 <term><varname>Weight=</varname></term>
304
305 <listitem><para>A numeric weight to assign to this partition in the range 0…1000000. Available disk
306 space is assigned the defined partitions according to their relative weights (subject to the size
307 constraints configured with <varname>SizeMinBytes=</varname>, <varname>SizeMaxBytes=</varname>), so
308 that a partition with weight 2000 gets double the space as one with weight 1000, and a partition with
309 weight 333 a third of that. Defaults to 1000.</para>
310
311 <para>The <varname>Weight=</varname> setting is used to distribute available disk space in an
312 "elastic" fashion, based on the disk size and existing partitions. If a partition shall have a fixed
313 size use both <varname>SizeMinBytes=</varname> and <varname>SizeMaxBytes=</varname> with the same
314 value in order to fixate the size to one value, in which case the weight has no
315 effect.</para>
316
317 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
318 </varlistentry>
319
320 <varlistentry>
321 <term><varname>PaddingWeight=</varname></term>
322
323 <listitem><para>Similar to <varname>Weight=</varname>, but sets a weight for the free space after the
324 partition (the "padding"). When distributing available space the weights of all partitions and all
325 defined padding is summed, and then each partition and padding gets the fraction defined by its
326 weight. Defaults to 0, i.e. by default no padding is applied.</para>
327
328 <para>Padding is useful if empty space shall be left for later additions or a safety margin at the
329 end of the device or between partitions.</para>
330
331 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
332 </varlistentry>
333
334 <varlistentry>
335 <term><varname>SizeMinBytes=</varname></term>
336 <term><varname>SizeMaxBytes=</varname></term>
337
338 <listitem><para>Specifies minimum and maximum size constraints in bytes. Takes the usual K, M, G, T,
339 … suffixes (to the base of 1024). If <varname>SizeMinBytes=</varname> is specified the partition is
340 created at or grown to at least the specified size. If <varname>SizeMaxBytes=</varname> is specified
341 the partition is created at or grown to at most the specified size. The precise size is determined
342 through the weight value configured with <varname>Weight=</varname>, see above. When
343 <varname>SizeMinBytes=</varname> is set equal to <varname>SizeMaxBytes=</varname> the configured
344 weight has no effect as the partition is explicitly sized to the specified fixed value. Note that
345 partitions are never created smaller than 4096 bytes, and since partitions are never shrunk the
346 previous size of the partition (in case the partition already exists) is also enforced as lower bound
347 for the new size. The values should be specified as multiples of 4096 bytes, and are rounded upwards
348 (in case of <varname>SizeMinBytes=</varname>) or downwards (in case of
349 <varname>SizeMaxBytes=</varname>) otherwise. If the backing device does not provide enough space to
350 fulfill the constraints placing the partition will fail. For partitions that shall be created,
351 depending on the setting of <varname>Priority=</varname> (see above) the partition might be dropped
352 and the placing algorithm restarted. By default, a minimum size constraint of 10M and no maximum size
353 constraint is set.</para>
354
355 <para>If <varname>Format=</varname> is set, the minimum size is automatically raised to the minimum
356 file system size for the selected file system type, if known. Moreover, for the ESP/XBOOTLDR
357 partitions the minimum is raised to 100M (for 512b sector images) or 260M (for 4K sector images)
358 automatically, if specified smaller.</para>
359
360 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
361 </varlistentry>
362
363 <varlistentry>
364 <term><varname>PaddingMinBytes=</varname></term>
365 <term><varname>PaddingMaxBytes=</varname></term>
366
367 <listitem><para>Specifies minimum and maximum size constraints in bytes for the free space after the
368 partition (the "padding"). Semantics are similar to <varname>SizeMinBytes=</varname> and
369 <varname>SizeMaxBytes=</varname>, except that unlike partition sizes free space can be shrunk and can
370 be as small as zero. By default, no size constraints on padding are set, so that only
371 <varname>PaddingWeight=</varname> determines the size of the padding applied.</para>
372
373 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
374 </varlistentry>
375
376 <varlistentry>
377 <term><varname>CopyBlocks=</varname></term>
378
379 <listitem><para>Takes a path to a regular file, block device node, char device node or directory, or
380 the special value <literal>auto</literal>. If specified and the partition is newly created, the data
381 from the specified path is written to the newly created partition, on the block level. If a directory
382 is specified, the backing block device of the file system the directory is on is determined, and the
383 data read directly from that. This option is useful to efficiently replicate existing file systems
384 onto new partitions on the block level — for example to build a simple OS installer or an OS image
385 builder. Specify <filename>/dev/urandom</filename> as value to initialize a partition with random
386 data.</para>
387
388 <para>If the special value <literal>auto</literal> is specified, the source to copy from is
389 automatically picked up from the running system (or the image specified with
390 <option>--image=</option> — if used). A partition that matches both the configured partition type (as
391 declared with <varname>Type=</varname> described above), and the currently mounted directory
392 appropriate for that partition type is determined. For example, if the partition type is set to
393 <literal>root</literal> the partition backing the root directory (<filename>/</filename>) is used as
394 source to copy from — if its partition type is set to <literal>root</literal> as well. If the
395 declared type is <literal>usr</literal> the partition backing <filename>/usr/</filename> is used as
396 source to copy blocks from — if its partition type is set to <literal>usr</literal> too. The logic is
397 capable of automatically tracking down the backing partitions for encrypted and Verity-enabled
398 volumes. <literal>CopyBlocks=auto</literal> is useful for implementing "self-replicating" systems,
399 i.e. systems that are their own installer.</para>
400
401 <para>The file specified here must have a size that is a multiple of the basic block size 512 and not
402 be empty. If this option is used, the size allocation algorithm is slightly altered: the partition is
403 created at least as big as required to fit the data in, i.e. the data size is an additional minimum
404 size value taken into consideration for the allocation algorithm, similar to and in addition to the
405 <varname>SizeMinBytes=</varname> value configured above.</para>
406
407 <para>This option has no effect if the partition it is declared for already exists, i.e. existing
408 data is never overwritten. Note that the data is copied in before the partition table is updated,
409 i.e. before the partition actually is persistently created. This provides robustness: it is
410 guaranteed that the partition either does not exist or exists fully populated; it is not possible that
411 the partition exists but is not or only partially populated.</para>
412
413 <para>This option cannot be combined with <varname>Format=</varname> or
414 <varname>CopyFiles=</varname>.</para>
415
416 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
417 </varlistentry>
418
419 <varlistentry>
420 <term><varname>Format=</varname></term>
421
422 <listitem><para>Takes a file system name, such as <literal>ext4</literal>, <literal>btrfs</literal>,
423 <literal>xfs</literal>, <literal>vfat</literal>, <literal>erofs</literal>,
424 <literal>squashfs</literal> or the special value <literal>swap</literal>. If specified and the partition
425 is newly created it is formatted with the specified file system (or as swap device). The file system
426 UUID and label are automatically derived from the partition UUID and label. If this option is used,
427 the size allocation algorithm is slightly altered: the partition is created at least as big as
428 required for the minimal file system of the specified type (or 4KiB if the minimal size is not
429 known).</para>
430
431 <para>This also takes a special meta value <literal>empty</literal>. If specified this is equivalent
432 to specifying <literal>Label=_empty</literal> and <literal>NoAuto=1</literal>.</para>
433
434 <para>This option has no effect if the partition already exists.</para>
435
436 <para>Similarly to the behaviour of <varname>CopyBlocks=</varname>, the file system is formatted
437 before the partition is created, ensuring that the partition only ever exists with a fully
438 initialized file system.</para>
439
440 <para>This option cannot be combined with <varname>CopyBlocks=</varname>.</para>
441
442 <xi:include href="version-info.xml" xpointer="v247"/></listitem>
443 </varlistentry>
444
445 <varlistentry>
446 <term><varname>CopyFiles=</varname></term>
447
448 <listitem><para>Takes a colon-separated triplet in the form
449 <literal><varname>source</varname>[:<varname>target</varname>[:<varname>options</varname>]]</literal>.
450 <varname>source</varname> is an absolute path which refers to a source file or directory on the host.
451 <varname>target</varname> is an absolute path in the file system of the newly created partition and
452 formatted file system. <varname>options</varname> is a comma-separated list of options where each
453 option is in the form <literal><varname>key</varname>[=<varname>value</varname>]</literal>.</para>
454
455 <para>This setting may be used to copy files or directories from the host into the file system that
456 is created due to the <varname>Format=</varname> option. If <varname>CopyFiles=</varname> is used
457 without <varname>Format=</varname> specified explicitly, <literal>Format=</literal> with a suitable
458 default is implied (currently <literal>vfat</literal> for <literal>ESP</literal> and
459 <literal>XBOOTLDR</literal> partitions, and <literal>ext4</literal> otherwise, but this may change in
460 the future). This option may be used multiple times to copy multiple files or directories from host
461 into the newly formatted file system.</para>
462
463 <para>The <varname>target</varname> path may be omitted in which case the <varname>source</varname>
464 path is also used as the target path (relative to the root of the newly created file system). If
465 the source path refers to a directory it is copied recursively.</para>
466
467 <para>The <varname>options</varname> may contain the following values:</para>
468
469 <variablelist>
470 <varlistentry>
471 <term><varname>fsverity=</varname></term>
472 <listitem><para>May be set to the value <literal>off</literal> (the default if the option is not
473 present) or <literal>copy</literal>. If set to <literal>off</literal> then no files copied into
474 the filesystem from this source will have fs-verity enabled. If set to <literal>copy</literal>
475 then the fs-verity information for each file will be copied from the corresponding source
476 file.</para>
477
478 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
479
480 </varlistentry>
481 </variablelist>
482
483 <para>This option has no effect if the partition already exists: it cannot be used to copy additional
484 files into an existing partition, it may only be used to populate a file system created anew.</para>
485
486 <para>The copy operation is executed before the file system is registered in the partition table,
487 thus ensuring that a file system populated this way only ever exists fully initialized.</para>
488
489 <para>Note that <varname>CopyFiles=</varname> will skip copying files that are not supported by the
490 target filesystem (e.g symlinks, fifos, sockets and devices on vfat). When an unsupported file type
491 is encountered, <command>systemd-repart</command> will skip copying this file and write a log message
492 about it.</para>
493
494 <para>Note that <command>systemd-repart</command> does not change the UIDs/GIDs of any copied files
495 and directories. When running <command>systemd-repart</command> as an unprivileged user to build an
496 image of files and directories owned by the same user, you can run <command>systemd-repart</command>
497 in a user namespace with the current user mapped to the root user to make sure the files and
498 directories in the image are owned by the root user.</para>
499
500 <para>This option cannot be combined with <varname>CopyBlocks=</varname>.</para>
501
502 <para>When
503 <citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry> is
504 invoked with the <option>--copy-source=</option> command line switch the file paths are taken
505 relative to the specified directory. If <option>--copy-source=</option> is not used, but the
506 <option>--image=</option> or <option>--root=</option> switches are used, the source paths are taken
507 relative to the specified root directory or disk image root.</para>
508
509 <para>Note that when <varname>CopyFiles=</varname> is used with <varname>Format=xfs</varname>,
510 <command>xfsprogs</command> 6.17 or newer is required.</para>
511
512 <xi:include href="version-info.xml" xpointer="v247"/></listitem>
513 </varlistentry>
514
515 <varlistentry>
516 <term><varname>ExcludeFiles=</varname></term>
517 <term><varname>ExcludeFilesTarget=</varname></term>
518
519 <listitem><para>Takes one or more absolute paths, separated by whitespace, each referring to a
520 source file or directory on the host. This setting may be used to exclude files or directories from
521 the host from being copied into the file system when <varname>CopyFiles=</varname> is used. This
522 option may be used multiple times to exclude multiple files or directories from host from being
523 copied into the newly formatted file system.</para>
524
525 <para>If the path is a directory and ends with <literal>/</literal>, only the directory's
526 contents are excluded but not the directory itself. If the path is a directory and does not end with
527 <literal>/</literal>, both the directory and its contents are excluded.</para>
528
529 <para><varname>ExcludeFilesTarget=</varname> is like <varname>ExcludeFiles=</varname> except that
530 instead of excluding the path on the host from being copied into the partition, it excludes any files
531 and directories from being copied into the given path in the partition.</para>
532
533 <para>When
534 <citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry>
535 is invoked with the <option>--image=</option> or <option>--root=</option> command line switches the
536 paths specified are taken relative to the specified root directory or disk image root.
537 </para>
538
539 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
540 </varlistentry>
541
542 <varlistentry>
543 <term><varname>MakeDirectories=</varname></term>
544
545 <listitem><para>Takes one or more absolute paths, separated by whitespace, each declaring a directory
546 to create within the new file system. Behaviour is similar to <varname>CopyFiles=</varname>, but
547 instead of copying in a set of files this just creates the specified directories with the default
548 mode of 0755 owned by the root user and group, plus all their parent directories (with the same
549 ownership and access mode). To configure directories with different ownership or access mode, use
550 <varname>CopyFiles=</varname> and specify a source tree to copy containing appropriately
551 owned/configured directories. This option may be used more than once to create multiple
552 directories. When <varname>CopyFiles=</varname> and <varname>MakeDirectories=</varname> are used
553 together the former is applied first. If a directory listed already exists no operation is executed
554 (in particular, the ownership/access mode of the directories is left as is).</para>
555
556 <para>The primary use case for this option is to create a minimal set of directories that may be
557 mounted over by other partitions contained in the same disk image. For example, a disk image where
558 the root file system is formatted at first boot might want to automatically pre-create
559 <filename>/usr/</filename> in it this way, so that the <literal>usr</literal> partition may
560 over-mount it.</para>
561
562 <para>Consider using
563 <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>
564 with its <option>--image=</option> option to pre-create other, more complex directory hierarchies (as
565 well as other inodes) with fine-grained control of ownership, access modes and other file
566 attributes.</para>
567
568 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
569 </varlistentry>
570
571 <varlistentry>
572 <term><varname>MakeSymlinks=</varname></term>
573
574 <listitem><para>Takes one or more arguments, separated by whitespace, each declaring a symlink to
575 create within the new file system. Each argument is a pair of symlink source and target paths,
576 separated by a colon. This option may be used more than once to create multiple symlinks. When
577 <varname>CopyFiles=</varname> and <varname>MakeSymlinks=</varname> are used together the former is
578 applied first.</para>
579
580 <para>The primary use case for this option is to create symlinks that need to exist before
581 <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>
582 is executed. For example, when using
583 <citerefentry><refentrytitle>systemd-confext</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
584 this setting can be used to create symlinks in <filename>/var/lib/extensions.mutable</filename> to
585 redirect writes to mutable confexts to a custom location.</para>
586
587 <para>Consider using
588 <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>
589 with its <option>--image=</option> option to pre-create other symlinks (as well as other inodes) with
590 fine-grained control of ownership, access modes and other file attributes.</para>
591
592 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
593 </varlistentry>
594
595 <varlistentry>
596 <term><varname>Subvolumes=</varname></term>
597
598 <listitem><para>Takes one or more absolute paths, separated by whitespace, each declaring a directory
599 that should be a subvolume within the new file system. Each path may optionally be followed by a
600 colon and a list of comma-separated subvolume flags. The following flags are understood:</para>
601
602 <table class='flags'>
603 <title>Subvolume Flags</title>
604 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
605 <colspec colname="spec" />
606 <colspec colname="purpose" />
607 <thead>
608 <row>
609 <entry>Flag</entry>
610 <entry>Purpose</entry>
611 </row>
612 </thead>
613 <tbody>
614 <row id='R'>
615 <entry><literal>ro</literal></entry>
616 <entry>Make this subvolume read-only.</entry>
617 </row>
618 <row id='C'>
619 <entry><literal>nodatacow</literal></entry>
620 <entry>Disable data CoW for this subvolume.</entry>
621 </row>
622 </tbody>
623 </tgroup>
624 </table>
625
626 <para>Note that this option does not create the directories themselves, that can be configured with
627 <varname>MakeDirectories=</varname> and <varname>CopyFiles=</varname>.</para>
628
629 <para>Note that this option only takes effect if the target filesystem supports subvolumes, such as
630 <citerefentry project="url"><refentrytitle url="https://btrfs.readthedocs.io/en/latest/btrfs.html">btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
631
632 <para>Note that this option is only supported in combination with <option>--offline=yes</option>
633 since <filename>btrfs-progs</filename> 6.12 or newer.</para>
634
635 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
636 </varlistentry>
637
638 <varlistentry>
639 <term><varname>DefaultSubvolume=</varname></term>
640
641 <listitem><para>Takes an absolute path specifying the default subvolume within the new filesystem.
642 Note that this setting does not create the subvolume itself, that can be configured with
643 <varname>Subvolumes=</varname>.</para>
644
645 <para>Note that this option only takes effect if the target filesystem supports subvolumes, such as
646 <citerefentry project="url"><refentrytitle url="https://btrfs.readthedocs.io/en/latest/btrfs.html">btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
647 </para>
648
649 <para>Note that this option is only supported in combination with <option>--offline=yes</option>
650 since <filename>btrfs-progs</filename> 6.12 or newer.</para>
651
652 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
653 </varlistentry>
654
655 <varlistentry>
656 <term><varname>BlockDeviceReplace=</varname></term>
657
658 <listitem><para>Takes a path to a mountpoint. Its filesystem's backing device will be replaced
659 with the newly created partition. This works only for btrfs filesystems. This option is ignored for already existing partitions.</para>
660
661 <para>If after moving the filesystem, an error happens before the writing of the partition table is
662 finished, there will be an attempt to move the filesystem back to its original device. But if that
663 attempt also fails, the filesystem might be living on a partition that does not exist in the
664 partition table and will be lost on reboot. This feature is intended to save initially volatile
665 mounted filesystems into the new disk with no important data, like a live boot system. They might
666 need to be recreated after a failure writing the partition table.</para>
667
668 <para>This option is not compatible with <option>--offline=yes</option>.</para>
669
670 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
671 </varlistentry>
672
673 <varlistentry>
674 <term><varname>VolumeName=</varname></term>
675
676 <listitem><para>If an encrypted partition is created through <varname>Encrypt=</varname>, and it will
677 stay activated after <command>systemd-repart</command> is done (using
678 <varname>BlockDeviceReplace=</varname>), then the name of the device mapper volume created will use
679 the name specified by <varname>VolumeName=</varname>.</para>
680
681 <para>The value must be a valid filename. If not specified, it will default to the value of
682 <varname>VolumeLabel=</varname> (which could be derived from <varname>Label=</varname>) if
683 valid.</para>
684
685 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
686 </varlistentry>
687
688 <varlistentry>
689 <term><varname>Encrypt=</varname></term>
690
691 <listitem><para>Takes one of <literal>off</literal>, <literal>key-file</literal>,
692 <literal>tpm2</literal> and <literal>key-file+tpm2</literal> (alternatively, also accepts a boolean
693 value, which is mapped to <literal>off</literal> when false, and <literal>key-file</literal> when
694 true). Defaults to <literal>off</literal>. If not <literal>off</literal> the partition will be
695 formatted with a LUKS2 superblock, before the blocks configured with <varname>CopyBlocks=</varname>
696 are copied in or the file system configured with <varname>Format=</varname> is created.</para>
697
698 <para>The LUKS2 UUID is automatically derived from the partition UUID in a stable fashion. If
699 <literal>key-file</literal> or <literal>key-file+tpm2</literal> is used, a key is added to the LUKS2
700 superblock, configurable with the <option>--key-file=</option> option to
701 <command>systemd-repart</command>. If <literal>tpm2</literal> or <literal>key-file+tpm2</literal> is
702 used, a key is added to the LUKS2 superblock that is enrolled to the local TPM2 chip, as configured
703 with the <option>--tpm2-device=</option> and <option>--tpm2-pcrs=</option> options to
704 <command>systemd-repart</command>.</para>
705
706 <para>When used this slightly alters the size allocation logic as the implicit, minimal size limits
707 of <varname>Format=</varname> and <varname>CopyBlocks=</varname> are increased by the space necessary
708 for the LUKS2 superblock (see above).</para>
709
710 <para>This option has no effect if the partition already exists.</para>
711
712 <xi:include href="version-info.xml" xpointer="v247"/></listitem>
713 </varlistentry>
714
715 <varlistentry>
716 <term><varname>Discard=</varname></term>
717
718 <listitem><para>Takes a boolean argument. The default is <literal>no</literal> if
719 <option>--discard=no</option> is used for the invocation of <command>systemd-repart</command>
720 or if <varname>Integrity=inline</varname> is set. It is <literal>yes</literal> otherwise.</para>
721
722 <para>If set to <literal>yes</literal>, when creating the LUKS2 superblock for the partition, the
723 <literal>allow-discards</literal> activation flag will be set so that future activations will allow
724 discards by default.</para>
725
726 <para>This option has no effect if the partition already exists or if <varname>Encrypt=off</varname> is used.</para>
727
728 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
729 </varlistentry>
730
731 <varlistentry>
732 <term><varname>EncryptKDF=</varname></term>
733
734 <listitem><para>Specifies the key derivation function (KDF) to use for LUKS2 encryption keyslots.
735 Takes one of <literal>argon2id</literal>, <literal>pbkdf2</literal>, or <literal>minimal</literal>.
736 If not specified, the default is determined by the cryptsetup library (typically
737 <literal>argon2id</literal>). This option has no effect if <varname>Encrypt=</varname> is
738 <literal>off</literal>.</para>
739
740 <para>When set to <literal>argon2id</literal> or <literal>pbkdf2</literal>, the specified KDF is
741 used with parameters benchmarked by the cryptsetup library. When set to <literal>minimal</literal>,
742 PBKDF2 is used with SHA-512, 1000 iterations, and no benchmarking — this is appropriate for
743 high-entropy keys (e.g. generated by a hardware key manager or sealed to a TPM) where the KDF only
744 needs to satisfy the LUKS2 format requirement, not strengthen a weak passphrase.</para>
745
746 <para>Note that Argon2-based KDFs may require significant memory (up to 1GB) during key derivation.
747 In memory-constrained environments such as kdump with limited crashkernel memory,
748 <literal>minimal</literal> or <literal>pbkdf2</literal> may be more appropriate. When
749 <varname>Encrypt=</varname> includes <literal>tpm2</literal>, the TPM2 keyslot always uses a minimal
750 PBKDF2 configuration regardless of this setting.</para>
751
752 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
753 </varlistentry>
754
755 <varlistentry>
756 <term><varname>Verity=</varname></term>
757
758 <listitem><para>Takes one of <literal>off</literal>, <literal>data</literal>,
759 <literal>hash</literal> or <literal>signature</literal>. Defaults to <literal>off</literal>. If set
760 to <literal>off</literal> or <literal>data</literal>, the partition is populated with content as
761 specified by <varname>CopyBlocks=</varname> or <varname>CopyFiles=</varname>. If set to
762 <literal>hash</literal>, the partition will be populated with verity hashes from the matching verity
763 data partition. If set to <literal>signature</literal>, the partition will be populated with a JSON
764 object containing a signature of the verity root hash of the matching verity hash partition.</para>
765
766 <para>A matching verity partition is a partition with the same verity match key (as configured with
767 <varname>VerityMatchKey=</varname>).</para>
768
769 <para>If not explicitly configured, the data partition's UUID will be set to the first 128
770 bits of the verity root hash. Similarly, if not configured, the hash partition's UUID will be set to
771 the final 128 bits of the verity root hash. The verity root hash itself will be included in the
772 output of <command>systemd-repart</command>.</para>
773
774 <para>This option has no effect if the partition already exists.</para>
775
776 <para>Usage of this option in combination with <varname>Encrypt=</varname> is not supported.</para>
777
778 <para>For each unique <varname>VerityMatchKey=</varname> value, a single verity data partition
779 (<literal>Verity=data</literal>) and a single verity hash partition (<literal>Verity=hash</literal>)
780 must be defined.</para>
781
782 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
783 </varlistentry>
784
785 <varlistentry>
786 <term><varname>VerityMatchKey=</varname></term>
787
788 <listitem><para>Takes a short, user-chosen identifier string. This setting is used to find sibling
789 verity partitions for the current verity partition. See the description for
790 <varname>Verity=</varname>.</para>
791
792 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
793 </varlistentry>
794
795 <varlistentry>
796 <term><varname>VerityDataBlockSizeBytes=</varname></term>
797
798 <listitem><para>Configures the data block size of the generated verity hash partition. Must be between 512 and
799 4096 bytes and must be a power of 2. Defaults to the sector size if configured explicitly, or the underlying
800 block device sector size, or 4K if <command>systemd-repart</command> is not operating on a block device.
801 </para>
802
803 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
804 </varlistentry>
805
806 <varlistentry>
807 <term><varname>VerityHashBlockSizeBytes=</varname></term>
808
809 <listitem><para>Configures the hash block size of the generated verity hash partition. Must be between 512 and
810 4096 bytes and must be a power of 2. Defaults to the sector size if configured explicitly, or the underlying
811 block device sector size, or 4K if <command>systemd-repart</command> is not operating on a block device.
812 </para>
813
814 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
815 </varlistentry>
816
817 <varlistentry>
818 <term><varname>FactoryReset=</varname></term>
819
820 <listitem><para>Takes a boolean argument. If specified the partition is marked for removal during a
821 factory reset operation. This functionality is useful to implement schemes where images can be reset
822 into their original state by removing partitions and creating them anew. Defaults to off.</para>
823
824 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
825 </varlistentry>
826
827 <varlistentry>
828 <term><varname>Flags=</varname></term>
829
830 <listitem><para>Configures the 64-bit GPT partition flags field to set for the partition when creating
831 it. This option has no effect if the partition already exists. If not specified, the flags value is
832 set to all zeroes, except for the three bits that can also be configured via
833 <varname>NoAuto=</varname>, <varname>ReadOnly=</varname> and <varname>GrowFileSystem=</varname>; see
834 below for details on the defaults for these three flags. Specify the flags value in hexadecimal (by
835 prefixing it with <literal>0x</literal>), binary (prefix <literal>0b</literal>) or decimal (no
836 prefix).</para>
837
838 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
839 </varlistentry>
840
841 <varlistentry>
842 <term><varname>NoAuto=</varname></term>
843 <term><varname>ReadOnly=</varname></term>
844 <term><varname>GrowFileSystem=</varname></term>
845
846 <listitem><para>Configures the No-Auto, Read-Only and Grow-File-System partition flags (bit 63, 60
847 and 59) of the partition table entry, as defined by the <ulink
848 url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable Partitions Specification</ulink>. Only
849 available for partition types supported by the specification. This option is a friendly way to set
850 bits 63, 60 and 59 of the partition flags value without setting any of the other bits, and may be set
851 via <varname>Flags=</varname> too, see above.</para>
852
853 <para>If <varname>Flags=</varname> is used in conjunction with one or more of
854 <varname>NoAuto=</varname>/<varname>ReadOnly=</varname>/<varname>GrowFileSystem=</varname> the latter
855 control the value of the relevant flags, i.e. the high-level settings
856 <varname>NoAuto=</varname>/<varname>ReadOnly=</varname>/<varname>GrowFileSystem=</varname> override
857 the relevant bits of the low-level setting <varname>Flags=</varname>.</para>
858
859 <para>Note that the three flags affect only automatic partition mounting, as implemented by
860 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
861 or the <option>--image=</option> option of various commands (such as
862 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>). It
863 has no effect on explicit mounts, such as those done via <citerefentry
864 project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> or
865 <citerefentry
866 project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
867
868 <para>If both bit 60 and 59 are set for a partition (i.e. the partition is marked both read-only and
869 marked for file system growing) the latter is typically without effect: the read-only flag takes
870 precedence in most tools reading these flags, and since growing the file system involves writing to
871 the partition it is consequently ignored.</para>
872
873 <para><varname>NoAuto=</varname> defaults to off. <varname>ReadOnly=</varname> defaults to on for
874 Verity partition types, and off for all others. <varname>GrowFileSystem=</varname> defaults to on for
875 all partition types that support it, except if the partition is marked read-only (and thus
876 effectively, defaults to off for Verity partitions).</para>
877
878 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
879 </varlistentry>
880
881 <varlistentry>
882 <term><varname>SplitName=</varname></term>
883
884 <listitem><para>Configures the suffix to append to split artifacts when the <option>--split</option>
885 option of
886 <citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry> is
887 used. Simple specifier expansion is supported, see below. Defaults to <literal>%t</literal>. To
888 disable split artifact generation for a partition, set <varname>SplitName=</varname> to
889 <literal>-</literal>.</para>
890
891 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
892 </varlistentry>
893
894 <varlistentry>
895 <term><varname>Minimize=</varname></term>
896
897 <listitem><para>Takes one of <literal>off</literal>, <literal>best</literal>, and
898 <literal>guess</literal> (alternatively, also accepts a boolean value, which is mapped to
899 <literal>off</literal> when false, and <literal>best</literal> when true). Defaults to
900 <literal>off</literal>. If set to <literal>best</literal>, the partition will have the minimal size
901 required to store the sources configured with <varname>CopyFiles=</varname>. <literal>best</literal>
902 is currently only supported for read-only filesystems and btrfs. If set to <literal>guess</literal>,
903 the partition is created at least as big as required to store the sources configured with
904 <varname>CopyFiles=</varname>. Note that unless the filesystem is a read-only filesystem or btrfs,
905 <command>systemd-repart</command> will have to populate the filesystem twice to guess the minimal
906 required size, so enabling this option might slow down repart when populating large partitions.
907 </para>
908
909 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
910 </varlistentry>
911
912 <varlistentry>
913 <term><varname>MountPoint=</varname></term>
914
915 <listitem><para>Specifies where and how the partition should be mounted. Takes at least one and at
916 most two fields separated with a colon (<literal>:</literal>). The first field specifies where the
917 partition should be mounted. The second field specifies extra mount options to append to the default
918 mount options. These fields correspond to the second and fourth column of the
919 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
920 format. As a colon is used for separating fields, each field needs to be quoted when it contains
921 colons. E.g. <programlisting>MountPoint="/path/with:colon":"zstd:1,noatime,lazytime"</programlisting>
922 This setting may be specified multiple times to mount the partition multiple times. This can be used
923 to add mounts for different
924 <citerefentry project="url"><refentrytitle url="https://btrfs.readthedocs.io/en/latest/btrfs.html">btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
925 subvolumes located on the same btrfs partition.</para>
926
927 <para>Note that this setting is only taken into account when <option>--generate-fstab=</option> is
928 specified on the <command>systemd-repart</command> command line.</para>
929
930 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
931 </varlistentry>
932
933 <varlistentry>
934 <term><varname>EncryptedVolume=</varname></term>
935
936 <listitem><para>Specifies how the encrypted partition should be set up. Takes at least one and at most
937 four fields separated with a colon (<literal>:</literal>). The first field specifies the encrypted
938 volume name under <filename>/dev/mapper/</filename>. If not specified, <literal>luks-UUID</literal>
939 will be used where <literal>UUID</literal> is the LUKS UUID. The second field specifies the keyfile
940 to use following the same format as specified in crypttab. The third field specifies a
941 comma-delimited list of crypttab options. These three fields correspond to the first, third and fourth
942 column of the
943 <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry> format.
944 The fourth field contains extra options, which are not directly reflected to crypttab options. Currently,
945 the only supported extra option is <varname>fixate-volume-key</varname>. When specified, the volume key
946 hash will be taken upon LUKS volume formatting and the result will be added to the list of crypttab options,
947 i.e. <varname>fixate-volume-key=expected-hash</varname> will be added to the fourth column of the generated
948 crypttab.
949 </para>
950
951 <para>Note that this setting is only taken into account when <option>--generate-crypttab=</option>
952 is specified on the <command>systemd-repart</command> command line. As the crypttab with the expected
953 hashes can only be generated after LUKS volumes are formatted, the crypttab itself cannot be put to
954 the generated volume.</para>
955
956 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
957 </varlistentry>
958
959 <varlistentry>
960 <term><varname>TPM2PCRs=</varname></term>
961
962 <listitem><para>Configures the list of PCRs to use for LUKS2 volumes configured with
963 the <varname>Encrypt=tpm2</varname> setting in partition files.
964 This option take the same parameters as the similarly named options to
965 <citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry>
966 and have the same effect on partitions where TPM2 enrollment is requested.
967 This option will be overridden by the global <varname>--tpm2-pcrs=</varname> option.</para>
968
969 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
970 </varlistentry>
971
972 <varlistentry>
973 <term><varname>KeyFile=</varname></term>
974
975 <listitem><para>Takes a file system path. This path must be absolute, otherwise the option is ignored.
976 Configures the encryption key to use when setting up LUKS2 volumes configured with the
977 <varname>Encrypt=key-file</varname> setting in partition files. Please refer to the documentation of
978 <varname>--key-file=</varname> for more details. This option will be overridden by the global
979 <varname>--key-file=</varname> option.</para>
980
981 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
982 </varlistentry>
983
984 <varlistentry>
985 <term><varname>Integrity=</varname></term>
986
987 <listitem><para>Enable integrity checking for the partition. Currently, the only supported option
988 is <varname>Integrity=inline</varname> which enables authenticated disk encryption for LUKS2 devices.
989 The option requires <varname>Encrypt=</varname> setting and can only be used in online image build.
990 Defaults to <literal>off</literal>, i.e. integrity protection is disabled.</para>
991 <para>Note: authenticated disk encryption is considered EXPERIMENTAL by cryptsetup.</para>
992
993 <xi:include href="version-info.xml" xpointer="v260"/></listitem>
994 </varlistentry>
995
996 <varlistentry>
997 <term><varname>IntegrityAlgorithm=</varname></term>
998 <listitem><para>Specify the integrity algorithm to be used for integrity verification. For
999 <varname>Integrity=inline</varname> the supported values are: <literal>hmac-sha1</literal>,
1000 <literal>hmac-sha256</literal>(default), and <literal>hmac-sha512</literal>.</para>
1001
1002 <xi:include href="version-info.xml" xpointer="v260"/></listitem>
1003 </varlistentry>
1004
1005 <varlistentry>
1006 <term><varname>Compression=</varname></term>
1007
1008 <listitem><para>Specifies the compression algorithm to use for the filesystem configured with
1009 <varname>Format=</varname>. Takes a single argument specifying the compression algorithm.</para>
1010
1011 <para>Note that this setting is only taken into account when the filesystem configured with
1012 <varname>Format=</varname> supports compression (
1013 <citerefentry project="url"><refentrytitle url="https://btrfs.readthedocs.io/en/latest/btrfs.html">btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1014 squashfs,
1015 <citerefentry project='man-pages'><refentrytitle>erofs</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
1016 Here's an incomplete list of compression algorithms supported by the filesystems
1017 known to <command>systemd-repart</command>:</para>
1018
1019 <table>
1020 <title>File System Compression Algorithms</title>
1021
1022 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
1023 <colspec colname="filesystem" />
1024 <colspec colname="algorithms" />
1025 <colspec colname="manpage" />
1026
1027 <thead>
1028 <row>
1029 <entry>File System</entry>
1030 <entry>Compression Algorithms</entry>
1031 <entry>Documentation</entry>
1032 </row>
1033 </thead>
1034
1035 <tbody>
1036 <row>
1037 <entry><constant>squashfs</constant></entry>
1038 <entry>gzip, lzo, lz4, xz, zstd, lzma</entry>
1039 <entry><member><citerefentry project='man-pages'><refentrytitle>mksquashfs</refentrytitle><manvolnum>1</manvolnum></citerefentry></member></entry>
1040 </row>
1041
1042 <row>
1043 <entry><constant>erofs</constant></entry>
1044 <entry>lz4, lz4hc, lzma, deflate, libdeflate, zstd</entry>
1045 <entry><member><citerefentry project='man-pages'><refentrytitle>mkfs.erofs</refentrytitle><manvolnum>1</manvolnum></citerefentry></member></entry>
1046 </row>
1047
1048 <row>
1049 <entry><constant>btrfs</constant></entry>
1050 <entry>zlib, lzo, zstd</entry>
1051 <entry><member><citerefentry project='man-pages'><refentrytitle>mkfs.btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry></member></entry>
1052 </row>
1053 </tbody>
1054 </tgroup>
1055 </table>
1056
1057 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
1058 </varlistentry>
1059
1060 <varlistentry>
1061 <term><varname>CompressionLevel=</varname></term>
1062
1063 <listitem><para>Specifies the compression level to use for the filesystem configured with
1064 <varname>Format=</varname>. Takes a single argument specifying the compression level to use for the
1065 configured compression algorithm. The possible compression levels and their meaning are filesystem
1066 specific (refer to the filesystem's documentation for the exact meaning of a particular compression
1067 level).</para>
1068
1069 <para>Note that this setting is only taken into account when the filesystem configured with
1070 <varname>Format=</varname> supports compression and the <varname>Compression=</varname> setting is
1071 configured explicitly.</para>
1072
1073 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
1074 </varlistentry>
1075
1076 <varlistentry>
1077 <term><varname>SupplementFor=</varname></term>
1078
1079 <listitem><para>Takes a partition definition name, such as <literal>10-esp</literal>. If specified,
1080 <command>systemd-repart</command> will avoid creating this partition and instead prefer to partially
1081 merge the two definitions. However, depending on the existing layout of partitions on disk,
1082 <command>systemd-repart</command> may be forced to fall back onto un-merging the definitions and
1083 using them as originally written, potentially creating this partition. Specifically,
1084 <command>systemd-repart</command> will fall back if this partition is found to already exist on disk,
1085 or if the target partition already exists on disk but is too small, or if it cannot allocate space
1086 for the merged partition for some other reason.</para>
1087
1088 <para>The following fields are merged into the target definition in the specified ways:
1089 <varname>Weight=</varname> and <varname>PaddingWeight=</varname> are simply overwritten;
1090 <varname>SizeMinBytes=</varname> and <varname>PaddingMinBytes=</varname> use the larger of the two
1091 values; <varname>SizeMaxBytes=</varname> and <varname>PaddingMaxBytes=</varname> use the smaller
1092 value; and <varname>CopyFiles=</varname>, <varname>ExcludeFiles=</varname>,
1093 <varname>ExcludeFilesTarget=</varname>, <varname>MakeDirectories=</varname>, and
1094 <varname>Subvolumes=</varname> are concatenated.</para>
1095
1096 <para>Usage of this option in combination with <varname>CopyBlocks=</varname>,
1097 <varname>Encrypt=</varname>, or <varname>Verity=</varname> is not supported. The target definition
1098 cannot set these settings either. A definition cannot simultaneously be a supplement and act as a
1099 target for some other supplement definition. A target cannot have more than one supplement partition
1100 associated with it.</para>
1101
1102 <para>For example, distributions can use this to implement <varname>$BOOT</varname> as defined in the
1103 <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification/">UAPI.1 Boot Loader
1104 Specification</ulink>. Distributions may prefer to use the ESP as <varname>$BOOT</varname> whenever
1105 possible, but to adhere to the spec XBOOTLDR must sometimes be used instead. So, they should create
1106 two definitions: the first defining an ESP big enough to hold just the bootloader, and a second for
1107 the XBOOTLDR that's sufficiently large to hold kernels and configured as a supplement for the ESP.
1108 Whenever possible,
1109 <citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1110 will try to merge the two definitions to create one large ESP, but if that's not allowable due to the
1111 existing conditions on disk a small ESP and a large XBOOTLDR will be created instead.</para>
1112
1113 <para>As another example, distributions can also use this to seamlessly share a single
1114 <filename>/home</filename> partition in a multi-boot scenario, while preferring to keep
1115 <filename>/home</filename> on the root partition by default. Having a <filename>/home</filename>
1116 partition separated from the root partition entails some extra complexity: someone has to decide how
1117 to split the space between the two partitions. On the other hand, it allows a user to share their
1118 home area between multiple installed OSs (i.e. via
1119 <citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>).
1120 Distributions should create two definitions: the first for a root partition that takes up some
1121 relatively small percentage of the disk, and the second as a supplement for the first to create a
1122 <filename>/home</filename> partition that takes up all the remaining free space. On first boot, if
1123 <command>systemd-repart</command> finds an existing <filename>/home</filename> partition on disk,
1124 it'll un-merge the definitions and create just a small root partition. Otherwise, the definitions
1125 will be merged and a single large root partition will be created.</para>
1126
1127 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
1128 </varlistentry>
1129
1130 <varlistentry>
1131 <term><varname>AddValidateFS=</varname></term>
1132
1133 <listitem><para>Takes a boolean argument. If enabled will set the
1134 <varname>user.validatefs.gpt_label</varname>, <varname>user.validatefs.gpt_type_uuid</varname> and
1135 <varname>user.validatefs.mount_point</varname> extended attributes on the root inode of the formatted
1136 file system to the partition labels, partition type UUIDs and the intended mount point for the file
1137 system. Defaults to on if <varname>Format=</varname> is used and the specified argument is neither
1138 <literal>swap</literal> nor <literal>vfat</literal>.</para>
1139
1140 <para>These extended attributes are read by
1141 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1142 and may encode constraints on mounted file systems that must be fulfilled for the system to
1143 successfully boot. This is particular important in
1144 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1145 scenarios, which puts together the mount hierarchy from untrusted data from the GPT partition
1146 table. As these extended attributes are stored inside the file system, they are typically
1147 authenticated as part of the file system (assuming it is contained in protected volume; i.e. LUKS or
1148 dm-verity), and hence may be used to securely validate the matching partition table fields.</para>
1149
1150 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
1151 </varlistentry>
1152
1153 <varlistentry>
1154 <term><varname>FileSystemSectorSize=</varname></term>
1155
1156 <listitem><para>Controls the sector size for any file system, LUKS volume or Verity volume formatted
1157 on this partition. Expects a power of 2 as value, and must be equal or larger than 512. Typically
1158 it's recommended to set the file system sector size to 4096, even on 512 sector disks (and in
1159 particular for images that are only ever intended to be stored as file on disks), in order to
1160 optimize performance. However, for compatibility with foreign operating systems or firmware it might
1161 be advisable to use the native sector size of the backing disk.</para>
1162
1163 <para>If unspecified and operating on a block device, defaults to the native sector size of the
1164 device. If unspecified and operating on a disk image file defaults to 4096.</para>
1165
1166 <para>Regardless of what is configured here, or which default is picked, the file system sector size
1167 is always increased to be equal or larger than the disk sector size.</para>
1168
1169 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
1170 </varlistentry>
1171
1172 </variablelist>
1173 </refsect1>
1174
1175 <refsect1>
1176 <title>Specifiers</title>
1177
1178 <para>Specifiers may be used in the <varname>Label=</varname>, <varname>CopyBlocks=</varname>,
1179 <varname>CopyFiles=</varname>, <varname>MakeDirectories=</varname>, <varname>SplitName=</varname>
1180 settings. The following expansions are understood:</para>
1181 <table class='specifiers'>
1182 <title>Specifiers available</title>
1183 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
1184 <colspec colname="spec" />
1185 <colspec colname="mean" />
1186 <colspec colname="detail" />
1187 <thead>
1188 <row>
1189 <entry>Specifier</entry>
1190 <entry>Meaning</entry>
1191 <entry>Details</entry>
1192 </row>
1193 </thead>
1194 <tbody>
1195 <xi:include href="standard-specifiers.xml" xpointer="a"/>
1196 <xi:include href="standard-specifiers.xml" xpointer="A"/>
1197 <xi:include href="standard-specifiers.xml" xpointer="b"/>
1198 <xi:include href="standard-specifiers.xml" xpointer="B"/>
1199 <xi:include href="standard-specifiers.xml" xpointer="H"/>
1200 <xi:include href="standard-specifiers.xml" xpointer="l"/>
1201 <xi:include href="standard-specifiers.xml" xpointer="m"/>
1202 <xi:include href="standard-specifiers.xml" xpointer="M"/>
1203 <xi:include href="standard-specifiers.xml" xpointer="o"/>
1204 <xi:include href="standard-specifiers.xml" xpointer="q"/>
1205 <xi:include href="standard-specifiers.xml" xpointer="v"/>
1206 <xi:include href="standard-specifiers.xml" xpointer="w"/>
1207 <xi:include href="standard-specifiers.xml" xpointer="W"/>
1208 <xi:include href="standard-specifiers.xml" xpointer="T"/>
1209 <xi:include href="standard-specifiers.xml" xpointer="V"/>
1210 <xi:include href="standard-specifiers.xml" xpointer="percent"/>
1211 </tbody>
1212 </tgroup>
1213 </table>
1214
1215 <para>Additionally, for the <varname>SplitName=</varname> setting, the following specifiers are also
1216 understood:</para>
1217 <table class='specifiers'>
1218 <title>Specifiers available</title>
1219 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
1220 <colspec colname="spec" />
1221 <colspec colname="mean" />
1222 <colspec colname="detail" />
1223 <thead>
1224 <row>
1225 <entry>Specifier</entry>
1226 <entry>Meaning</entry>
1227 <entry>Details</entry>
1228 </row>
1229 </thead>
1230 <tbody>
1231 <row id='T'>
1232 <entry><literal>%T</literal></entry>
1233 <entry>Partition Type UUID</entry>
1234 <entry>The partition type UUID, as configured with <varname>Type=</varname></entry>
1235 </row>
1236 <row id='t'>
1237 <entry><literal>%t</literal></entry>
1238 <entry>Partition Type Identifier</entry>
1239 <entry>The partition type identifier corresponding to the partition type UUID</entry>
1240 </row>
1241 <row id='U'>
1242 <entry><literal>%U</literal></entry>
1243 <entry>Partition UUID</entry>
1244 <entry>The partition UUID, as configured with <varname>UUID=</varname></entry>
1245 </row>
1246 <row id='n'>
1247 <entry><literal>%n</literal></entry>
1248 <entry>Partition Number</entry>
1249 <entry>The partition number assigned to the partition</entry>
1250 </row>
1251 </tbody>
1252 </tgroup>
1253 </table>
1254 </refsect1>
1255
1256 <refsect1>
1257 <title>Environment</title>
1258
1259 <para>Extra filesystem formatting options can be provided using filesystem-specific environment variables:
1260 <varname>$SYSTEMD_REPART_MKFS_OPTIONS_BTRFS</varname>, <varname>$SYSTEMD_REPART_MKFS_OPTIONS_XFS</varname>,
1261 <varname>$SYSTEMD_REPART_MKFS_OPTIONS_VFAT</varname>, <varname>$SYSTEMD_REPART_MKFS_OPTIONS_EROFS</varname>,
1262 and <varname>$SYSTEMD_REPART_MKFS_OPTIONS_SQUASHFS</varname>. Each variable accepts valid
1263 <command>mkfs.<replaceable>filesystem</replaceable></command> command-line arguments.
1264 The content of those variables is passed as-is to the command, without any verification.
1265 </para>
1266
1267 </refsect1>
1268
1269 <refsect1>
1270 <title>Examples</title>
1271
1272 <example>
1273 <title>Grow the root partition to the full disk size at first boot</title>
1274
1275 <para>With the following file the root partition is automatically grown to the full disk if possible
1276 during boot.</para>
1277
1278 <para><programlisting># /usr/lib/repart.d/50-root.conf
1279 [Partition]
1280 Type=root
1281 </programlisting></para>
1282 </example>
1283
1284 <example>
1285 <title>Create a swap and home partition automatically on boot, if missing</title>
1286
1287 <para>The home partition gets all available disk space while the swap partition gets 1G at most and 64M
1288 at least. We set a priority > 0 on the swap partition to ensure the swap partition is not used if not
1289 enough space is available. For every three bytes assigned to the home partition the swap partition gets
1290 assigned one.</para>
1291
1292 <para><programlisting># /usr/lib/repart.d/60-home.conf
1293 [Partition]
1294 Type=home
1295 </programlisting></para>
1296
1297 <para><programlisting># /usr/lib/repart.d/70-swap.conf
1298 [Partition]
1299 Type=swap
1300 SizeMinBytes=64M
1301 SizeMaxBytes=1G
1302 Priority=1
1303 Weight=333
1304 </programlisting></para>
1305 </example>
1306
1307 <example>
1308 <title>Create B partitions in an A/B Verity setup, if missing</title>
1309
1310 <para>Let's say the vendor intends to update OS images in an A/B setup, i.e. with two root partitions
1311 (and two matching Verity partitions) that shall be used alternatingly during upgrades. To minimize
1312 image sizes the original image is shipped only with one root and one Verity partition (the "A" set),
1313 and the second root and Verity partitions (the "B" set) shall be created on first boot on the free
1314 space on the medium.</para>
1315
1316 <para><programlisting># /usr/lib/repart.d/50-root.conf
1317 [Partition]
1318 Type=root
1319 SizeMinBytes=512M
1320 SizeMaxBytes=512M
1321 </programlisting></para>
1322
1323 <para><programlisting># /usr/lib/repart.d/60-root-verity.conf
1324 [Partition]
1325 Type=root-verity
1326 SizeMinBytes=64M
1327 SizeMaxBytes=64M
1328 </programlisting></para>
1329
1330 <para>The definitions above cover the "A" set of root partition (of a fixed 512M size) and Verity
1331 partition for the root partition (of a fixed 64M size). Let's use symlinks to create the "B" set of
1332 partitions, since after all they shall have the same properties and sizes as the "A" set.</para>
1333
1334 <para><programlisting># ln -s 50-root.conf /usr/lib/repart.d/70-root-b.conf
1335 # ln -s 60-root-verity.conf /usr/lib/repart.d/80-root-verity-b.conf
1336 </programlisting></para>
1337 </example>
1338
1339 <example>
1340 <title>Create a data partition and corresponding verity partitions from a OS tree</title>
1341
1342 <para>Assuming we have an OS tree at <filename index='false'>/var/tmp/os-tree</filename> that we want
1343 to package in a root partition together with matching verity partitions, we can do so as follows:
1344 </para>
1345
1346 <para><programlisting># 50-root.conf
1347 [Partition]
1348 Type=root
1349 CopyFiles=/var/tmp/os-tree
1350 Verity=data
1351 VerityMatchKey=root
1352 Minimize=guess
1353 </programlisting></para>
1354
1355 <para><programlisting># 60-root-verity.conf
1356 [Partition]
1357 Type=root-verity
1358 Verity=hash
1359 VerityMatchKey=root
1360 # Explicitly set the hash and data block size to 4K
1361 VerityDataBlockSizeBytes=4096
1362 VerityHashBlockSizeBytes=4096
1363 Minimize=best
1364 </programlisting></para>
1365
1366 <para><programlisting># 70-root-verity-sig.conf
1367 [Partition]
1368 Type=root-verity-sig
1369 Verity=signature
1370 VerityMatchKey=root
1371 </programlisting></para>
1372 </example>
1373
1374 </refsect1>
1375
1376 <refsect1>
1377 <title>See Also</title>
1378 <para><simplelist type="inline">
1379 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
1380 <member><citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
1381 <member><citerefentry project='man-pages'><refentrytitle>sfdisk</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
1382 <member><citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
1383 </simplelist></para>
1384 </refsect1>
1385
1386 </refentry>