]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/repart.d.xml
fido2: when listing fido2/hmac-secret devices, actually validate feature set
[thirdparty/systemd.git] / man / repart.d.xml
CommitLineData
917cc808
LP
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.2/docbookx.dtd">
e031166e
LP
4<refentry id="repart.d" conditional='ENABLE_REPART'
5 xmlns:xi="http://www.w3.org/2001/XInclude">
917cc808
LP
6
7 <refentryinfo>
8 <title>repart.d</title>
9 <productname>systemd</productname>
10 </refentryinfo>
11
12 <refmeta>
13 <refentrytitle>repart.d</refentrytitle>
14 <manvolnum>5</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>repart.d</refname>
19 <refpurpose>Partition Definition Files for Automatic Boot-Time Repartitioning</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23 <para><literallayout><filename>/etc/repart.d/*.conf</filename>
24<filename>/run/repart.d/*.conf</filename>
25<filename>/usr/lib/repart.d/*.conf</filename>
26 </literallayout></para>
27 </refsynopsisdiv>
28
29 <refsect1>
30 <title>Description</title>
31
32 <para><filename>repart.d/*.conf</filename> files describe basic properties of partitions of block
33 devices of the local system. They may be used to declare types, names and sizes of partitions that shall
34 exist. The
35 <citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry>
36 service reads these files and attempts to add new partitions currently missing and enlarge existing
37 partitions according to these definitions. Operation is generally incremental, i.e. when applied, what
38 exists already is left intact, and partitions are never shrunk, moved or deleted.</para>
39
40 <para>These definition files are useful for implementing operating system images that are prepared and
41 delivered with minimally sized images (for example lacking any state or swap partitions), and which on
42 first boot automatically take possession of any remaining disk space following a few basic rules.</para>
43
44 <para>Currently, support for partition definition files is only implemented for GPT partitition
45 tables.</para>
46
47 <para>Partition files are generally matched against any partitions already existing on disk in a simple
48 algorithm: the partition files are sorted by their filename (ignoring the directory prefix), and then
49 compared in order against existing partitions matching the same partition type UUID. Specifically, the
50 first existing partition with a specific partition type UUID is assigned the first definition file with
51 the same partition type UUID, and the second existing partition with a specific type UUID the second
52 partition file with the same type UUID, and so on. Any left-over partition files that have no matching
53 existing partition are assumed to define new partition that shall be created. Such partitions are
54 appended to the end of the partition table, in the order defined by their names utilizing the first
55 partition slot greater than the highest slot number currently in use. Any existing partitions that have
56 no matching partition file are left as they are.</para>
57
dfb4d0ae
LP
58 <para>Note that these definitions may only be used to created and initialize new partitions or grow
59 existing ones. In the latter case it will not grow the contained files systems however; separate
60 mechanisms, such as
61 <citerefentry><refentrytitle>systemd-growfs</refentrytitle><manvolnum>8</manvolnum></citerefentry> may be
62 used to grow the file systems inside of these partitions.</para>
917cc808
LP
63 </refsect1>
64
65 <refsect1>
66 <title>[Partition] Section Options</title>
67
68 <variablelist>
69 <varlistentry>
70 <term><varname>Type=</varname></term>
71
72 <listitem><para>The GPT partition type UUID to match. This may be a GPT partition type UUID such as
73 <constant>4f68bce3-e8cd-4db1-96e7-fbcaf984b709</constant>, or one of the following special
74 identifiers:</para>
75
76 <table>
77 <title>GPT partition type identifiers</title>
78
79 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
80 <colspec colname="name" />
81 <colspec colname="explanation" />
82
83 <thead>
84 <row>
85 <entry>Identifier</entry>
86 <entry>Explanation</entry>
87 </row>
88 </thead>
89
90 <tbody>
91 <row>
92 <entry><constant>esp</constant></entry>
93 <entry>EFI System Partition</entry>
94 </row>
95
96 <row>
97 <entry><constant>xbootldr</constant></entry>
98 <entry>Extended Boot Loader Partition</entry>
99 </row>
100
101 <row>
102 <entry><constant>swap</constant></entry>
103 <entry>Swap partition</entry>
104 </row>
105
106 <row>
107 <entry><constant>home</constant></entry>
108 <entry>Home (<filename>/home/</filename>) partition</entry>
109 </row>
110
111 <row>
112 <entry><constant>srv</constant></entry>
113 <entry>Server data (<filename>/srv/</filename>) partition</entry>
114 </row>
115
116 <row>
117 <entry><constant>var</constant></entry>
118 <entry>Variable data (<filename>/var/</filename>) partition</entry>
119 </row>
120
121 <row>
122 <entry><constant>tmp</constant></entry>
123 <entry>Temporary data (<filename>/var/tmp/</filename>) partition</entry>
124 </row>
125
126 <row>
127 <entry><constant>linux-generic</constant></entry>
128 <entry>Generic Linux file system partition</entry>
129 </row>
130
131 <row>
132 <entry><constant>root</constant></entry>
133 <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>
134 </row>
135
136 <row>
137 <entry><constant>root-verity</constant></entry>
138 <entry>Verity data for the root file system partition for the local architecture</entry>
139 </row>
140
141 <row>
142 <entry><constant>root-secondary</constant></entry>
f4e1a425 143 <entry>Root file system partition of the secondary architecture of the local architecture (usually the matching 32bit architecture for the local 64bit architecture)</entry>
917cc808
LP
144 </row>
145
146 <row>
147 <entry><constant>root-secondary-verity</constant></entry>
148 <entry>Verity data for the root file system partition of the secondary architecture</entry>
149 </row>
150
151 <row>
152 <entry><constant>root-x86</constant></entry>
153 <entry>Root file system partition for the x86 (32bit, aka i386) architecture</entry>
154 </row>
155
156 <row>
157 <entry><constant>root-x86-verity</constant></entry>
158 <entry>Verity data for the x86 (32bit) root file system partition</entry>
159 </row>
160
161 <row>
162 <entry><constant>root-x86-64</constant></entry>
163 <entry>Root file system partition for the x86_64 (64bit, aka amd64) architecture</entry>
164 </row>
165
166 <row>
167 <entry><constant>root-x86-64-verity</constant></entry>
168 <entry>Verity data for the x86_64 (64bit) root file system partition</entry>
169 </row>
170
171 <row>
172 <entry><constant>root-arm</constant></entry>
173 <entry>Root file system partition for the ARM (32bit) architecture</entry>
174 </row>
175
176 <row>
177 <entry><constant>root-arm-verity</constant></entry>
178 <entry>Verity data for the ARM (32bit) root file system partition</entry>
179 </row>
180
181 <row>
182 <entry><constant>root-arm64</constant></entry>
183 <entry>Root file system partition for the ARM (64bit, aka aarch64) architecture</entry>
184 </row>
185
186 <row>
187 <entry><constant>root-arm64-verity</constant></entry>
188 <entry>Verity data for the ARM (64bit, aka aarch64) root file system partition</entry>
189 </row>
190
191 <row>
192 <entry><constant>root-ia64</constant></entry>
193 <entry>Root file system partition for the ia64 architecture</entry>
194 </row>
195
196 <row>
197 <entry><constant>root-ia64-verity</constant></entry>
198 <entry>Verity data for the ia64 root file system partition</entry>
199 </row>
329cde79 200
499f0f82
DJL
201 <row>
202 <entry><constant>root-riscv32</constant></entry>
203 <entry>Root file system partition for the RISC-V 32-bit architecture</entry>
204 </row>
205
206 <row>
207 <entry><constant>root-riscv32-verity</constant></entry>
208 <entry>Verity data for the RISC-V 32-bit root file system partition</entry>
209 </row>
210
211 <row>
212 <entry><constant>root-riscv64</constant></entry>
213 <entry>Root file system partition for the RISC-V 64-bit architecture</entry>
214 </row>
215
216 <row>
217 <entry><constant>root-riscv64-verity</constant></entry>
218 <entry>Verity data for the RISC-V 64-bit root file system partition</entry>
219 </row>
220
329cde79
LP
221 <row>
222 <entry><constant>usr</constant></entry>
223 <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>
224 </row>
225
226 <row>
227 <entry><constant>usr-verity</constant></entry>
228 <entry>Verity data for the <filename>/usr/</filename> file system partition for the local architecture</entry>
229 </row>
230
231 <row>
232 <entry><constant>usr-secondary</constant></entry>
233 <entry><filename>/usr/</filename> file system partition of the secondary architecture of the local architecture (usually the matching 32bit architecture for the local 64bit architecture)</entry>
234 </row>
235
236 <row>
237 <entry><constant>usr-secondary-verity</constant></entry>
238 <entry>Verity data for the <filename>/usr/</filename> file system partition of the secondary architecture</entry>
239 </row>
240
241 <row>
242 <entry><constant>usr-x86</constant></entry>
243 <entry><filename>/usr/</filename> file system partition for the x86 (32bit, aka i386) architecture</entry>
244 </row>
245
246 <row>
247 <entry><constant>usr-x86-verity</constant></entry>
248 <entry>Verity data for the x86 (32bit) <filename>/usr/</filename> file system partition</entry>
249 </row>
250
251 <row>
252 <entry><constant>usr-x86-64</constant></entry>
253 <entry><filename>/usr/</filename> file system partition for the x86_64 (64bit, aka amd64) architecture</entry>
254 </row>
255
256 <row>
257 <entry><constant>usr-x86-64-verity</constant></entry>
258 <entry>Verity data for the x86_64 (64bit) <filename>/usr/</filename> file system partition</entry>
259 </row>
260
261 <row>
262 <entry><constant>usr-arm</constant></entry>
263 <entry><filename>/usr/</filename> file system partition for the ARM (32bit) architecture</entry>
264 </row>
265
266 <row>
267 <entry><constant>usr-arm-verity</constant></entry>
268 <entry>Verity data for the ARM (32bit) <filename>/usr/</filename> file system partition</entry>
269 </row>
270
271 <row>
272 <entry><constant>usr-arm64</constant></entry>
273 <entry><filename>/usr/</filename> file system partition for the ARM (64bit, aka aarch64) architecture</entry>
274 </row>
275
276 <row>
277 <entry><constant>usr-arm64-verity</constant></entry>
278 <entry>Verity data for the ARM (64bit, aka aarch64) <filename>/usr/</filename> file system partition</entry>
279 </row>
280
281 <row>
282 <entry><constant>usr-ia64</constant></entry>
283 <entry><filename>/usr/</filename> file system partition for the ia64 architecture</entry>
284 </row>
285
286 <row>
287 <entry><constant>usr-ia64-verity</constant></entry>
288 <entry>Verity data for the ia64 <filename>/usr/</filename> file system partition</entry>
289 </row>
499f0f82
DJL
290
291 <row>
292 <entry><constant>usr-riscv32</constant></entry>
293 <entry><filename>/usr/</filename> file system partition for the RISC-V 32-bit architecture</entry>
294 </row>
295
296 <row>
297 <entry><constant>usr-riscv32-verity</constant></entry>
298 <entry>Verity data for the RISC-V 32-bit <filename>/usr/</filename> file system partition</entry>
299 </row>
300
301 <row>
302 <entry><constant>usr-riscv64</constant></entry>
303 <entry><filename>/usr/</filename> file system partition for the RISC-V 64-bit architecture</entry>
304 </row>
305
306 <row>
307 <entry><constant>usr-riscv64-verity</constant></entry>
308 <entry>Verity data for the RISC-V 64-bit <filename>/usr/</filename> file system partition</entry>
309 </row>
310
311
917cc808
LP
312 </tbody>
313 </tgroup>
314 </table>
315
316 <para>This setting defaults to <constant>linux-generic</constant>.</para>
317
318 <para>Most of the partition type UUIDs listed above are defined in the <ulink
319 url="https://systemd.io/DISCOVERABLE_PARTITIONS">Discoverable Partitions
320 Specification</ulink>.</para></listitem>
321 </varlistentry>
322
323 <varlistentry>
324 <term><varname>Label=</varname></term>
325
326 <listitem><para>The textual label to assign to the partition if none is assigned yet. Note that this
327 setting is not used for matching. It is also not used when a label is already set for an existing
328 partition. It is thus only used when a partition is newly created or when an existing one had a no
329 label set (that is: an empty label). If not specified a label derived from the partition type is
e031166e 330 automatically used. Simple specifier expansion is supported, see below.</para></listitem>
917cc808
LP
331 </varlistentry>
332
12963533
TH
333 <varlistentry>
334 <term><varname>UUID=</varname></term>
335
336 <listitem><para>The UUID to assign to the partition if none is assigned yet. Note that this
337 setting is not used for matching. It is also not used when a UUID is already set for an existing
338 partition. It is thus only used when a partition is newly created or when an existing one had a
339 all-zero UUID set. If not specified a UUID derived from the partition type is automatically
340 used.</para></listitem>
341 </varlistentry>
342
917cc808
LP
343 <varlistentry>
344 <term><varname>Priority=</varname></term>
345
346 <listitem><para>A numeric priority to assign to this partition, in the range -2147483648…2147483647,
347 with smaller values indicating higher priority, and higher values indicating smaller priority. This
348 priority is used in case the configured size constraints on the defined partitions do not permit
349 fitting all partitions onto the available disk space. If the partitions do not fit, the highest
350 numeric partition priority of all defined partitions is determined, and all defined partitions with
351 this priority are removed from the list of new partitions to create (which may be multiple, if the
352 same priority is used for multiple partitions). The fitting algorithm is then tried again. If the
353 partitions still do not fit, the now highest numeric partition priority is determined, and the
354 matching partitions removed too, and so on. Partitions of a priority of 0 or lower are never
355 removed. If all partitions with a priority above 0 are removed and the partitions still do not fit on
356 the device the operation fails. Note that this priority has no effect on ordering partitions, for
357 that use the alphabetical order of the filenames of the partition definition files. Defaults to
358 0.</para></listitem>
359 </varlistentry>
360
361 <varlistentry>
362 <term><varname>Weight=</varname></term>
363
364 <listitem><para>A numeric weight to assign to this partition in the range 0…1000000. Available disk
365 space is assigned the defined partitions according to their relative weights (subject to the size
366 constraints configured with <varname>SizeMinBytes=</varname>, <varname>SizeMaxBytes=</varname>), so
367 that a partition with weight 2000 gets double the space as one with weight 1000, and a partition with
368 weight 333 a third of that. Defaults to 1000.</para>
369
370 <para>The <varname>Weight=</varname> setting is used to distribute available disk space in an
371 "elastic" fashion, based on the disk size and existing partitions. If a partition shall have a fixed
372 size use both <varname>SizeMinBytes=</varname> and <varname>SizeMaxBytes=</varname> with the same
373 value in order to fixate the size to one value, in which case the weight has no
374 effect.</para></listitem>
375 </varlistentry>
376
377 <varlistentry>
378 <term><varname>PaddingWeight=</varname></term>
379
380 <listitem><para>Similar to <varname>Weight=</varname> but sets a weight for the free space after the
381 partition (the "padding"). When distributing available space the weights of all partitions and all
382 defined padding is summed, and then each partition and padding gets the fraction defined by its
383 weight. Defaults to 0, i.e. by default no padding is applied.</para>
384
385 <para>Padding is useful if empty space shall be left for later additions or a safety margin at the
386 end of the device or between partitions.</para></listitem>
387 </varlistentry>
388
389 <varlistentry>
390 <term><varname>SizeMinBytes=</varname></term>
391 <term><varname>SizeMaxBytes=</varname></term>
392
393 <listitem><para>Specifies minimum and maximum size constraints in bytes. Takes the usual K, M, G, T,
394 … suffixes (to the base of 1024). If <varname>SizeMinBytes=</varname> is specified the partition is
395 created at or grown to at least the specified size. If <varname>SizeMaxBytes=</varname> is specified
396 the partition is created at or grown to at most the specified size. The precise size is determined
397 through the weight value value configured with <varname>Weight=</varname>, see above. When
398 <varname>SizeMinBytes=</varname> is set equal to <varname>SizeMaxBytes=</varname> the configured
399 weight has no effect as the partition is explicitly sized to the specified fixed value. Note that
400 partitions are never created smaller than 4096 bytes, and since partitions are never shrunk the
401 previous size of the partition (in case the partition already exists) is also enforced as lower bound
402 for the new size. The values should be specified as multiples of 4096 bytes, and are rounded upwards
403 (in case of <varname>SizeMinBytes=</varname>) or downwards (in case of
404 <varname>SizeMaxBytes=</varname>) otherwise. If the backing device does not provide enough space to
405 fulfill the constraints placing the partition will fail. For partitions that shall be created,
406 depending on the setting of <varname>Priority=</varname> (see above) the partition might be dropped
fb08381c
LP
407 and the placing algorithm restarted. By default a minimum size constraint of 10M and no maximum size
408 constraint is set.</para></listitem>
917cc808
LP
409 </varlistentry>
410
411 <varlistentry>
412 <term><varname>PaddingMinBytes=</varname></term>
413 <term><varname>PaddingMaxBytes=</varname></term>
414
757bc2e4 415 <listitem><para>Specifies minimum and maximum size constraints in bytes for the free space after the
917cc808
LP
416 partition (the "padding"). Semantics are similar to <varname>SizeMinBytes=</varname> and
417 <varname>SizeMaxBytes=</varname>, except that unlike partition sizes free space can be shrunk and can
418 be as small as zero. By default no size constraints on padding are set, so that only
419 <varname>PaddingWeight=</varname> determines the size of the padding applied.</para></listitem>
420 </varlistentry>
421
757bc2e4
LP
422 <varlistentry>
423 <term><varname>CopyBlocks=</varname></term>
424
425 <listitem><para>Takes a path to a regular file, block device node or directory. If specified and the
426 partition is newly created the data from the specified path is written to the newly created
427 partition, on the block level. If a directory is specified the backing block device of the file
428 system the directory is on is determined and the data read directly from that. This option is useful
429 to efficiently replicate existing file systems on the block level on a new partition, for example to
430 build a simple OS installer or OS image builder.</para>
431
432 <para>The file specified here must have a size that is a multiple of the basic block size 512 and not
433 be empty. If this option is used, the size allocation algorithm is slightly altered: the partition is
434 created as least as big as required to fit the data in, i.e. the data size is an additional minimum
435 size value taken into consideration for the allocation algorithm, similar to and in addition to the
436 <varname>SizeMin=</varname> value configured above.</para>
437
438 <para>This option has no effect if the partition it is declared for already exists, i.e. existing
439 data is never overwritten. Note that the data is copied in before the partition table is updated,
440 i.e. before the partition actually is persistently created. This provides robustness: it is
441 guaranteed that the partition either doesn't exist or exists fully populated; it is not possible that
dfb4d0ae
LP
442 the partition exists but is not or only partially populated.</para>
443
444 <para>This option cannot be combined with <varname>Format=</varname> or
445 <varname>CopyFiles=</varname>.</para></listitem>
446 </varlistentry>
447
448 <varlistentry>
449 <term><varname>Format=</varname></term>
450
451 <listitem><para>Takes a file system name, such as <literal>ext4</literal>, <literal>btrfs</literal>,
452 <literal>xfs</literal> or <literal>vfat</literal>, or the special value <literal>swap</literal>. If
453 specified and the partition is newly created it is formatted with the specified file system (or as
454 swap device). The file system UUID and label are automatically derived from the partition UUID and
455 label. If this option is used, the size allocation algorithm is slightly altered: the partition is
456 created as least as big as required for the minimal file system of the specified type (or 4KiB if the
457 minimal size is not known).</para>
458
459 <para>This option has no effect if the partition already exists.</para>
460
461 <para>Similar to the behaviour of <varname>CopyBlocks=</varname> the file system is formatted before
462 the partition is created, ensuring that the partition only ever exists with a fully initialized
463 file system.</para>
464
465 <para>This option cannot be combined with <varname>CopyBlocks=</varname>.</para></listitem>
466 </varlistentry>
467
468 <varlistentry>
469 <term><varname>CopyFiles=</varname></term>
470
471 <listitem><para>Takes a pair of colon separated absolute file system paths. The first path refers to
472 a source file or directory on the host, the second path refers to a target in the file system of the
473 newly created partition and formatted file system. This setting may be used to copy files or
474 directories from the host into the file system that is created due to the <varname>Format=</varname>
475 option. If <varname>CopyFiles=</varname> is used without <varname>Format=</varname> specified
476 explicitly, <literal>Format=</literal> with a suitable default is implied (currently
477 <literal>ext4</literal>, but this may change in the future). This option may be used multiple times
478 to copy multiple files or directories from host into the newly formatted file system. The colon and
479 second path may be omitted in which case the source path is also used as the target path (relative to
480 the root of the newly created file system). If the source path refers to a directory it is copied
481 recursively.</para>
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>This option cannot be combined with <varname>CopyBlocks=</varname>.</para></listitem>
490 </varlistentry>
491
492 <varlistentry>
493 <term><varname>Encrypt=</varname></term>
494
495 <listitem><para>Takes a boolean parameter, defaulting to false. If true the partition will be
496 formatted with a LUKS2 superblock, before the blocks configured with <varname>CopyBlocks=</varname>
497 are copied in or the file system configured with <varname>Format=</varname> is created.</para>
498
499 <para>The LUKS2 UUID is automatically derived from the partition UUID in a stable fashion. A single
500 key is added to the LUKS2 superblock, configurable with the <option>--key-file=</option> switch to
501 <command>systemd-repart</command>.</para>
502
503 <para>When used this slightly alters the size allocation logic as the implicit, minimal size limits
504 of <varname>Format=</varname> and <varname>CopyBlocks=</varname> are increased by the space necessary
505 for the LUKS2 superblock (see above).</para>
506
507 <para>This option has no effect if the partition already exists.</para></listitem>
757bc2e4
LP
508 </varlistentry>
509
917cc808
LP
510 <varlistentry>
511 <term><varname>FactoryReset=</varname></term>
512
513 <listitem><para>Takes a boolean argument. If specified the partition is marked for removal during a
514 factory reset operation. This functionality is useful to implement schemes where images can be reset
515 into their original state by removing partitions and creating them anew. Defaults to off.</para></listitem>
516 </varlistentry>
517 </variablelist>
518 </refsect1>
519
e031166e
LP
520 <refsect1>
521 <title>Specifiers</title>
522
523 <para>Specifiers may be used in the <varname>Label=</varname> setting. The following expansions are understood:</para>
524 <table class='specifiers'>
525 <title>Specifiers available</title>
526 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
527 <colspec colname="spec" />
528 <colspec colname="mean" />
529 <colspec colname="detail" />
530 <thead>
531 <row>
532 <entry>Specifier</entry>
533 <entry>Meaning</entry>
534 <entry>Details</entry>
535 </row>
536 </thead>
537 <tbody>
538 <xi:include href="standard-specifiers.xml" xpointer="a"/>
539 <xi:include href="standard-specifiers.xml" xpointer="b"/>
540 <xi:include href="standard-specifiers.xml" xpointer="B"/>
541 <xi:include href="standard-specifiers.xml" xpointer="H"/>
542 <xi:include href="standard-specifiers.xml" xpointer="l"/>
543 <xi:include href="standard-specifiers.xml" xpointer="m"/>
544 <xi:include href="standard-specifiers.xml" xpointer="o"/>
545 <xi:include href="standard-specifiers.xml" xpointer="v"/>
546 <xi:include href="standard-specifiers.xml" xpointer="w"/>
547 <xi:include href="standard-specifiers.xml" xpointer="W"/>
548 <xi:include href="standard-specifiers.xml" xpointer="percent"/>
549 </tbody>
550 </tgroup>
551 </table>
552 </refsect1>
553
917cc808
LP
554 <refsect1>
555 <title>Examples</title>
556
557 <example>
558 <title>Grow the root partition to the full disk size at first boot</title>
559
560 <para>With the following file the root partition is automatically grown to the full disk if possible during boot.</para>
561
562 <para><programlisting># /usr/lib/repart.d/50-root.conf
563[Partition]
564Type=root
565</programlisting></para>
566 </example>
567
568 <example>
569 <title>Create a swap and home partition automatically on boot, if missing</title>
570
571 <para>The home partition gets all available disk space while the swap partition gets 1G at most and 64M
572 at least. We set a priority > 0 on the swap partition to ensure the swap partition is not used if not
573 enough space is available. For every three bytes assigned to the home partition the swap partition gets
574 assigned one.</para>
575
576 <para><programlisting># /usr/lib/repart.d/60-home.conf
577[Partition]
578Type=home
579</programlisting></para>
580
581 <para><programlisting># /usr/lib/repart.d/70-swap.conf
582[Partition]
583Type=swap
584SizeMinBytes=64M
585SizeMaxBytes=1G
586Priority=1
587Weight=333
588</programlisting></para>
589 </example>
590
591 <example>
592 <title>Create B partitions in an A/B Verity setup, if missing</title>
593
594 <para>Let's say the vendor intends to update OS images in an A/B setup, i.e. with two root partitions
595 (and two matching Verity partitions) that shall be used alternatingly during upgrades. To minimize
596 image sizes the original image is shipped only with one root and one Verity partition (the "A" set),
597 and the second root and Verity partitions (the "B" set) shall be created on first boot on the free
598 space on the medium.</para>
599
600 <para><programlisting># /usr/lib/repart.d/50-root.conf
601[Partition]
602Type=root
603SizeMinBytes=512M
604SizeMaxBytes=512M
605</programlisting></para>
606
607 <para><programlisting># /usr/lib/repart.d/60-root-verity.conf
608[Partition]
609Type=root-verity
610SizeMinBytes=64M
611SizeMaxBytes=64M
612</programlisting></para>
613
614 <para>The definitions above cover the "A" set of root partition (of a fixed 512M size) and Verity
615 partition for the root partition (of a fixed 64M size). Let's use symlinks to create the "B" set of
616 partitions, since after all they shall have the same properties and sizes as the "A" set.</para>
617
618<para><programlisting># ln -s 50-root.conf /usr/lib/repart.d/70-root-b.conf
619# ln -s 60-root-verity.conf /usr/lib/repart.d/80-root-verity-b.conf
620</programlisting></para>
621 </example>
622
623 </refsect1>
624
625 <refsect1>
626 <title>See Also</title>
627 <para>
628 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
629 <citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
630 <citerefentry project='man-pages'><refentrytitle>sfdisk</refentrytitle><manvolnum>8</manvolnum></citerefentry>
631 </para>
632 </refsect1>
633
634</refentry>