1:255.16-alt1
[systemd_ALT.git] / man / systemd-repart.xml
blob79b561c394a124ba9ddfafae8b6aad5cd909b9fe
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id="systemd-repart" conditional='ENABLE_REPART'
7     xmlns:xi="http://www.w3.org/2001/XInclude">
9   <refentryinfo>
10     <title>systemd-repart</title>
11     <productname>systemd</productname>
12   </refentryinfo>
14   <refmeta>
15     <refentrytitle>systemd-repart</refentrytitle>
16     <manvolnum>8</manvolnum>
17   </refmeta>
19   <refnamediv>
20     <refname>systemd-repart</refname>
21     <refname>systemd-repart.service</refname>
22     <refpurpose>Automatically grow and add partitions</refpurpose>
23   </refnamediv>
25   <refsynopsisdiv>
26     <cmdsynopsis>
27       <command>systemd-repart</command>
28       <arg choice="opt" rep="repeat">OPTIONS</arg>
29       <arg choice="opt" rep="repeat"><replaceable><optional>BLOCKDEVICE</optional></replaceable></arg>
30     </cmdsynopsis>
32     <para><filename>systemd-repart.service</filename></para>
33   </refsynopsisdiv>
35   <refsect1>
36     <title>Description</title>
38     <para><command>systemd-repart</command> creates partition tables, and adds or grows partitions,
39     based on the configuration files described in
40     <citerefentry><refentrytitle>repart.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
41     </para>
43     <para><command>systemd-repart</command> is used when <emphasis>building</emphasis> OS images, and also
44     when <emphasis>deploying</emphasis> images to automatically adjust them, during boot, to the system they
45     are running on. This way the image can be minimal in size and may be augmented automatically at boot,
46     taking possession of the disk space available.</para>
48     <para>If invoked with no arguments, <command>systemd-repart</command> operates on the block device
49     backing the root file system partition of the running OS, thus adding and growing partitions of the
50     booted OS itself. When called in the initrd, it operates on the block device backing
51     <filename>/sysroot/</filename> instead, i.e. on the block device the system will soon transition into. If
52     <varname>--image=</varname> is used, it will operate on the specified device or image file. The
53     <filename>systemd-repart.service</filename> service is generally run at boot in the initrd, in order to
54     augment the partition table of the OS before its partitions are mounted.</para>
56     <para><command>systemd-repart</command> operations are mostly incremental: it grows existing partitions
57     or adds new ones, but does not shrink, delete, or move existing partitions. The service is intended to be
58     run on every boot, but when it detects that the partition table already matches the installed
59     <filename>repart.d/*.conf</filename> configuration files, it executes no operation.</para>
61     <para>The following use cases are among those covered:</para>
63     <itemizedlist>
64       <listitem><para>The root partition may be grown to cover the whole available disk space.</para></listitem>
65       <listitem><para>A <filename>/home/</filename>, swap, or <filename>/srv/</filename> partition can be
66       added.</para></listitem>
67       <listitem><para>A second (or third, …) root partition may be added, to cover A/B style setups
68       where a second version of the root file system is alternatingly used for implementing update
69       schemes. The deployed image would carry only a single partition ("A") but on first boot a second
70       partition ("B") for this purpose is automatically created.</para></listitem>
71     </itemizedlist>
73     <para>The algorithm executed by <command>systemd-repart</command> is roughly as follows:</para>
75     <orderedlist>
76       <listitem><para>The <filename>repart.d/*.conf</filename> configuration files are loaded and parsed, and
77       ordered by filename (without the directory prefix). For each configuration file, drop-in files are
78       loaded from directories with same name as the configuration file with the suffix ".d" added.
79       </para></listitem>
81       <listitem><para>The partition table on the block device is loaded and parsed, if present.
82       </para></listitem>
84       <listitem><para>The existing partitions in the partition table are matched with the
85       <filename>repart.d/*.conf</filename> files by GPT partition type UUID. The first existing partition of
86       a specific type is assigned the first configuration file declaring the same type. The second existing
87       partition of a specific type is then assigned the second configuration file declaring the same type,
88       and so on. After this iterative assigning is complete, any existing partitions that have no matching
89       configuration file are considered "foreign" and left as they are. And any configuration files for which
90       no partition was matched are treated as requests to create a partition.</para></listitem>
92       <listitem><para>Partitions that shall be created are now allocated on the disk, taking the size
93       constraints and weights declared in the configuration files into account. Free space is used within the
94       limits set by size and padding requests. In addition, existing partitions that should be grown are
95       grown. New partitions are always appended to the end of the partition table, taking the first partition
96       table slot whose index is greater than the indexes of all existing partitions. Partitions are never
97       reordered and thus partition numbers remain stable. When partitions are created, they are placed in the
98       smallest area of free space that is large enough to satisfy the size and padding limits. This means
99       that partitions might have different order on disk than in the partition table. Note that this
100       allocation happens in memory only, the partition table on disk is not updated yet.</para></listitem>
102       <listitem><para>All existing partitions for which configuration files exist and which currently have no
103       GPT partition label set will be assigned a label, either explicitly configured in the configuration or
104       — if that's missing — derived automatically from the partition type. The same is done for all
105       partitions that are newly created. These assignments are done in memory only, too, the disk is not
106       updated yet.</para></listitem>
108       <listitem><para>Similarly, all existing partitions for which configuration files exist and which
109       currently have an all-zero identifying UUID will be assigned a new UUID. This UUID is cryptographically
110       hashed from a common seed value together with the partition type UUID (and a counter in case multiple
111       partitions of the same type are defined), see below. The same is done for all partitions that are
112       created anew. These assignments are done in memory only, too, the disk is not updated yet.
113       </para></listitem>
115       <listitem><para>Similarly, if the disk's volume UUID is all zeroes it is also initialized, also
116       cryptographically hashed from the same common seed value. This is done in memory only too.
117       </para></listitem>
119       <listitem><para>The disk space assigned to new partitions (i.e. what was previously free space) is now
120       erased. Specifically, all file system signatures are removed, and if the device supports it, the
121       <constant>BLKDISCARD</constant> I/O control command is issued to inform the hardware that the space is
122       now empty. In addition any "padding" between partitions and at the end of the device is similarly
123       erased.</para></listitem>
125       <listitem><para>The new partition table is finally written to disk. The kernel is asked to reread the
126       partition table.</para></listitem>
127     </orderedlist>
129     <para>As an exception to the normal incremental operation, when called in a special "factory reset" mode,
130     <command>systemd-repart</command> may be used to erase existing partitions to reset an installation back
131     to vendor defaults. This mode of operation is used when either the <option>--factory-reset=yes</option>
132     switch is passed on the tool's command line, or the <option>systemd.factory_reset=yes</option> option is
133     specified on the kernel command line, or the <varname>FactoryReset</varname> EFI variable (vendor UUID
134     <constant>8cf2644b-4b0b-428f-9387-6d876050dc67</constant>) is set to "yes". It alters the algorithm above
135     slightly: between the 3rd and the 4th step above any partition marked explicitly via the
136     <varname>FactoryReset=</varname> boolean is deleted, and the algorithm restarted, thus immediately
137     re-creating these partitions anew empty.</para>
139     <para>Note that <command>systemd-repart</command> by default only changes partition tables, it does not
140     create or resize any file systems within these partitions, unless the <varname>Format=</varname>
141     configuration option is specified. Also note that there are also separate mechanisms available for this
142     purpose, for example
143     <citerefentry><refentrytitle>systemd-growfs</refentrytitle><manvolnum>8</manvolnum></citerefentry> and
144     <command>systemd-makefs</command>.</para>
146     <para>The UUIDs identifying the new partitions created (or assigned to existing partitions that have no
147     UUID yet), as well as the disk as a whole are hashed cryptographically from a common seed value. This
148     seed value is usually the
149     <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> of the
150     system, so that the machine ID reproducibly determines the UUIDs assigned to all partitions. If the
151     machine ID cannot be read (or the user passes <option>--seed=random</option>, see below) the seed is
152     generated randomly instead, so that the partition UUIDs are also effectively random. The seed value may
153     also be set explicitly, formatted as UUID via the <option>--seed=</option> option. By hashing these UUIDs
154     from a common seed images prepared with this tool become reproducible and the result of the algorithm
155     above deterministic.</para>
157     <para>The positional argument should specify the block device or a regular file to operate on. If
158     <option>--empty=create</option> is specified, the specified path is created as regular file, which is
159     useful for generating disk images from scratch.</para>
160   </refsect1>
162   <refsect1>
163     <title>Options</title>
165     <para>The following options are understood:</para>
167     <variablelist>
168       <varlistentry>
169         <term><option>--dry-run=</option></term>
171         <listitem><para>Takes a boolean. If this switch is not specified <option>--dry-run=yes</option> is
172         the implied default. Controls whether <filename>systemd-repart</filename> executes the requested
173         re-partition operations or whether it should only show what it would do. Unless
174         <option>--dry-run=no</option> is specified <filename>systemd-repart</filename> will not actually
175         touch the device's partition table.</para>
177         <xi:include href="version-info.xml" xpointer="v245"/></listitem>
178       </varlistentry>
180       <varlistentry>
181         <term><option>--empty=</option></term>
183         <listitem><para>Takes one of <literal>refuse</literal>, <literal>allow</literal>,
184         <literal>require</literal>, <literal>force</literal> or <literal>create</literal>. Controls how to
185         operate on block devices that are entirely empty, i.e. carry no partition table/disk label yet. If
186         this switch is not specified the implied default is <literal>refuse</literal>.</para>
188         <para>If <literal>refuse</literal> <command>systemd-repart</command> requires that the block device
189         it shall operate on already carries a partition table and refuses operation if none is found. If
190         <literal>allow</literal> the command will extend an existing partition table or create a new one if
191         none exists. If <literal>require</literal> the command will create a new partition table if none
192         exists so far, and refuse operation if one already exists. If <literal>force</literal> it will create
193         a fresh partition table unconditionally, erasing the disk fully in effect. If
194         <literal>force</literal> no existing partitions will be taken into account or survive the
195         operation. Hence: use with care, this is a great way to lose all your data. If
196         <literal>create</literal> a new loopback file is create under the path passed via the device node
197         parameter, of the size indicated with <option>--size=</option>, see below.</para>
199         <xi:include href="version-info.xml" xpointer="v245"/></listitem>
200       </varlistentry>
202       <varlistentry>
203         <term><option>--discard=</option></term>
205         <listitem><para>Takes a boolean. If this switch is not specified <option>--discard=yes</option> is
206         the implied default. Controls whether to issue the <constant>BLKDISCARD</constant> I/O control
207         command on the space taken up by any added partitions or on the space in between them. Usually, it's
208         a good idea to issue this request since it tells the underlying hardware that the covered blocks
209         shall be considered empty, improving performance. If operating on a regular file instead of a block
210         device node, a sparse file is generated.</para>
212         <xi:include href="version-info.xml" xpointer="v245"/></listitem>
213       </varlistentry>
215       <varlistentry>
216         <term><option>--size=</option></term>
218         <listitem><para>Takes a size in bytes, using the usual K, M, G, T suffixes, or the special value
219         <literal>auto</literal>. If used the specified device node path must refer to a regular file, which
220         is then grown to the specified size if smaller, before any change is made to the partition table. If
221         specified as <literal>auto</literal> the minimal size for the disk image is automatically determined
222         (i.e. the minimal sizes of all partitions are summed up, taking space for additional metadata into
223         account). This switch is not supported if the specified node is a block device. This switch has no
224         effect if the file is already as large as the specified size or larger. The specified size is
225         implicitly rounded up to multiples of 4096. When used with <option>--empty=create</option> this
226         specifies the initial size of the loopback file to create.</para>
228         <para>The <option>--size=auto</option> option takes the sizes of pre-existing partitions into
229         account. However, it does not accommodate for partition tables that are not tightly packed: the
230         configured partitions might still not fit into the backing device if empty space exists between
231         pre-existing partitions (or before the first partition) that cannot be fully filled by partitions to
232         grow or create.</para>
234         <para>Also note that the automatic size determination does not take files or directories specified
235         with <option>CopyFiles=</option> into account: operation might fail if the specified files or
236         directories require more disk space then the configured per-partition minimal size
237         limit.</para>
239         <xi:include href="version-info.xml" xpointer="v246"/></listitem>
240       </varlistentry>
242       <varlistentry>
243         <term><option>--factory-reset=</option></term>
245         <listitem><para>Takes boolean. If this switch is not specified <option>--factory=reset=no</option> is
246         the implied default. Controls whether to operate in "factory reset" mode, see above. If set to true
247         this will remove all existing partitions marked with <varname>FactoryReset=</varname> set to yes
248         early while executing the re-partitioning algorithm. Use with care, this is a great way to lose all
249         your data. Note that partition files need to explicitly turn <varname>FactoryReset=</varname> on, as
250         the option defaults to off. If no partitions are marked for factory reset this switch has no
251         effect. Note that there are two other methods to request factory reset operation: via the kernel
252         command line and via an EFI variable, see above.</para>
254         <xi:include href="version-info.xml" xpointer="v245"/></listitem>
255       </varlistentry>
257       <varlistentry>
258         <term><option>--can-factory-reset</option></term>
260         <listitem><para>If this switch is specified the disk is not re-partitioned. Instead it is determined
261         if any existing partitions are marked with <varname>FactoryReset=</varname>. If there are the tool
262         will exit with exit status zero, otherwise non-zero. This switch may be used to quickly determine
263         whether the running system supports a factory reset mechanism built on
264         <command>systemd-repart</command>.</para>
266         <xi:include href="version-info.xml" xpointer="v245"/></listitem>
267       </varlistentry>
269       <varlistentry>
270         <term><option>--root=</option></term>
272         <listitem><para>Takes a path to a directory to use as root file system when searching for
273         <filename>repart.d/*.conf</filename> files, for the machine ID file to use as seed and for the
274         <varname>CopyFiles=</varname> and <varname>CopyBlocks=</varname> source files and directories. By
275         default when invoked on the regular system this defaults to the host's root file system
276         <filename>/</filename>. If invoked from the initrd this defaults to <filename>/sysroot/</filename>,
277         so that the tool operates on the configuration and machine ID stored in the root file system later
278         transitioned into itself.</para>
280         <para>See <option>--copy-source=</option> for a more restricted option that only affects
281         <varname>CopyFiles=</varname>.</para>
283         <xi:include href="version-info.xml" xpointer="v245"/></listitem>
284       </varlistentry>
286       <varlistentry>
287         <term><option>--image=</option></term>
289         <listitem><para>Takes a path to a disk image file or device to mount and use in a similar fashion to
290         <option>--root=</option>, see above.</para>
292         <xi:include href="version-info.xml" xpointer="v249"/></listitem>
293       </varlistentry>
295       <xi:include href="standard-options.xml" xpointer="image-policy-open" />
297       <varlistentry>
298         <term><option>--seed=</option></term>
300         <listitem><para>Takes a UUID as argument or the special value <constant>random</constant>. If a UUID
301         is specified the UUIDs to assign to partitions and the partition table itself are derived via
302         cryptographic hashing from it. If not specified it is attempted to read the machine ID from the host
303         (or more precisely, the root directory configured via <option>--root=</option>) and use it as seed
304         instead, falling back to a randomized seed otherwise. Use <option>--seed=random</option> to force a
305         randomized seed. Explicitly specifying the seed may be used to generated strictly reproducible
306         partition tables.</para>
308         <xi:include href="version-info.xml" xpointer="v245"/></listitem>
309       </varlistentry>
311       <varlistentry>
312         <term><option>--pretty=</option></term>
314         <listitem><para>Takes a boolean argument. If this switch is not specified, it defaults to on when
315         called from an interactive terminal and off otherwise. Controls whether to show a user friendly table
316         and graphic illustrating the changes applied.</para>
318         <xi:include href="version-info.xml" xpointer="v245"/></listitem>
319       </varlistentry>
321       <varlistentry>
322         <term><option>--definitions=</option></term>
324         <listitem><para>Takes a file system path. If specified the <filename>*.conf</filename> files are read
325         from the specified directory instead of searching in <filename>/usr/lib/repart.d/*.conf</filename>,
326         <filename>/etc/repart.d/*.conf</filename>,
327         <filename>/run/repart.d/*.conf</filename>.</para>
329         <para>This parameter can be specified multiple times.</para>
331         <xi:include href="version-info.xml" xpointer="v245"/></listitem>
332       </varlistentry>
334       <varlistentry>
335         <term><option>--key-file=</option></term>
337         <listitem><para>Takes a file system path. Configures the encryption key to use when setting up LUKS2
338         volumes configured with the <varname>Encrypt=key-file</varname> setting in partition files. Should
339         refer to a regular file containing the key, or an <constant>AF_UNIX</constant> stream socket in the
340         file system. In the latter case a connection is made to it and the key read from it. If this switch
341         is not specified the empty key (i.e. zero length key) is used. This behaviour is useful for setting
342         up encrypted partitions during early first boot that receive their user-supplied password only in a
343         later setup step.</para>
345         <xi:include href="version-info.xml" xpointer="v247"/></listitem>
346       </varlistentry>
348       <varlistentry>
349         <term><option>--private-key=</option></term>
351         <listitem><para>Takes a file system path. Configures the signing key to use when creating verity
352         signature partitions with the <varname>Verity=signature</varname> setting in partition files.
353         </para>
355         <xi:include href="version-info.xml" xpointer="v252"/></listitem>
356       </varlistentry>
358       <varlistentry>
359         <term><option>--certificate=</option></term>
361         <listitem><para>Takes a file system path. Configures the PEM encoded X.509 certificate to use when
362         creating verity signature partitions with the <varname>Verity=signature</varname> setting in
363         partition files.</para>
365         <xi:include href="version-info.xml" xpointer="v252"/></listitem>
366       </varlistentry>
368       <varlistentry>
369         <term><option>--tpm2-device=</option></term>
370         <term><option>--tpm2-pcrs=</option></term>
372         <listitem><para>Configures the TPM2 device and list of PCRs to use for LUKS2 volumes configured with
373         the <varname>Encrypt=tpm2</varname> option. These options take the same parameters as the identically
374         named options to
375         <citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry>
376         and have the same effect on partitions where TPM2 enrollment is requested.</para>
378         <xi:include href="version-info.xml" xpointer="v248"/></listitem>
379       </varlistentry>
381       <varlistentry>
382         <term><option>--tpm2-device-key=</option><arg>PATH</arg></term>
383         <term><option>--tpm2-seal-key-handle=</option><arg>HANDLE</arg></term>
385         <listitem><para>Configures a TPM2 SRK key to bind encryption to. See
386         <citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry>
387         for details on this option.</para>
389         <xi:include href="version-info.xml" xpointer="v255"/></listitem>
390       </varlistentry>
392       <varlistentry>
393         <term><option>--tpm2-public-key=</option><arg>PATH</arg></term>
394         <term><option>--tpm2-public-key-pcrs=</option><arg rep="repeat">PCR</arg></term>
396         <listitem><para>Configures a TPM2 signed PCR policy to bind encryption to. See
397         <citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry>
398         for details on these two options.</para>
400         <xi:include href="version-info.xml" xpointer="v252"/></listitem>
401       </varlistentry>
403       <varlistentry>
404         <term><option>--tpm2-pcrlock=</option><arg>PATH</arg></term>
406         <listitem><para>Configures a TPM2 pcrlock policy to bind encryption to. See
407         <citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry>
408         for details on this option.</para>
410         <xi:include href="version-info.xml" xpointer="v255"/></listitem>
411       </varlistentry>
413       <varlistentry>
414         <term><option>--split=</option><arg>BOOL</arg></term>
416         <listitem><para>Enables generation of split artifacts from partitions configured with
417         <varname>SplitName=</varname>. If enabled, for each partition with <varname>SplitName=</varname> set,
418         a separate output file containing just the contents of that partition is generated. The output
419         filename consists of the loopback filename suffixed with the name configured with
420         <varname>SplitName=</varname>. If the loopback filename ends with <literal>.raw</literal>, the suffix
421         is inserted before the <literal>.raw</literal> extension instead.</para>
423         <para>Note that <option>--split</option> is independent from <option>--dry-run</option>. Even if
424         <option>--dry-run</option> is enabled, split artifacts will still be generated from an existing image
425         if <option>--split</option> is enabled.</para>
427         <xi:include href="version-info.xml" xpointer="v252"/></listitem>
428       </varlistentry>
430       <varlistentry>
431         <term><option>--include-partitions=</option><arg rep="repeat">PARTITION</arg></term>
432         <term><option>--exclude-partitions=</option><arg rep="repeat">PARTITION</arg></term>
434         <listitem><para>These options specify which partition types <command>systemd-repart</command> should
435         operate on. If <option>--include-partitions=</option> is used, all partitions that aren't specified
436         are excluded. If <option>--exclude-partitions=</option> is used, all partitions that are specified
437         are excluded. Both options take a comma separated list of GPT partition type UUIDs or identifiers
438         (see <varname>Type=</varname> in
439         <citerefentry><refentrytitle>repart.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
440         </para>
442         <xi:include href="version-info.xml" xpointer="v253"/></listitem>
443       </varlistentry>
445       <varlistentry>
446         <term><option>--defer-partitions=</option><arg rep="repeat">PARTITION</arg></term>
448         <listitem><para>This option specifies for which partition types <command>systemd-repart</command>
449         should defer. All partitions that are deferred using this option are still taken into account when
450         calculating the sizes and offsets of other partitions, but aren't actually written to the disk image.
451         The net effect of this option is that if you run <command>systemd-repart</command> again without this
452         option, the missing partitions will be added as if they had not been deferred the first time
453         <command>systemd-repart</command> was executed.</para>
455         <xi:include href="version-info.xml" xpointer="v253"/></listitem>
456       </varlistentry>
458       <varlistentry>
459         <term><option>--sector-size=</option><arg>BYTES</arg></term>
461         <listitem><para>This option allows configuring the sector size of the image produced by
462         <command>systemd-repart</command>. It takes a value that is a power of <literal>2</literal> between
463         <literal>512</literal> and <literal>4096</literal>. This option is useful when building images for
464         disks that use a different sector size as the disk on which the image is produced.</para>
466         <xi:include href="version-info.xml" xpointer="v253"/></listitem>
467       </varlistentry>
469       <varlistentry>
470         <term><option>--architecture=</option><arg>ARCH</arg></term>
472         <listitem><para>This option allows overriding the architecture used for architecture specific
473         partition types. For example, if set to <literal>arm64</literal> a partition type of
474         <literal>root-x86-64</literal> referenced in <filename>repart.d/</filename> drop-ins will be patched
475         dynamically to refer to <literal>root-arm64</literal> instead. Takes one of
476         <literal>alpha</literal>,
477         <literal>arc</literal>,
478         <literal>arm</literal>,
479         <literal>arm64</literal>,
480         <literal>ia64</literal>,
481         <literal>loongarch64</literal>,
482         <literal>mips-le</literal>,
483         <literal>mips64-le</literal>,
484         <literal>parisc</literal>,
485         <literal>ppc</literal>,
486         <literal>ppc64</literal>,
487         <literal>ppc64-le</literal>,
488         <literal>riscv32</literal>,
489         <literal>riscv64</literal>,
490         <literal>s390</literal>,
491         <literal>s390x</literal>,
492         <literal>tilegx</literal>,
493         <literal>x86</literal> or
494         <literal>x86-64</literal>.</para>
496         <xi:include href="version-info.xml" xpointer="v254"/></listitem>
497       </varlistentry>
499       <varlistentry>
500         <term><option>--offline=</option><arg>BOOL</arg></term>
502         <listitem><para>Instructs <command>systemd-repart</command> to build the image offline. Takes a
503         boolean or <literal>auto</literal>. Defaults to <literal>auto</literal>. If enabled, the image is
504         built without using loop devices. This is useful to build images unprivileged or when loop devices
505         are not available. If disabled, the image is always built using loop devices. If
506         <literal>auto</literal>, <command>systemd-repart</command> will build the image online if possible
507         and fall back to building the image offline if loop devices are not available or cannot be accessed
508         due to missing permissions.</para>
510         <xi:include href="version-info.xml" xpointer="v254"/></listitem>
511       </varlistentry>
513       <varlistentry>
514         <term><option>--copy-from=</option><arg>IMAGE</arg></term>
516         <listitem><para>Instructs <command>systemd-repart</command> to synthesize partition definitions from
517         the partition table in the given image. This option can be specified multiple times to synthesize
518         definitions from each of the given images. The generated definitions will copy the partitions into
519         the destination partition table. The copied partitions will have the same size, metadata and contents
520         but might have a different partition number and might be located at a different offset in the
521         destination partition table. These definitions can be combined with partition definitions read from
522         regular partition definition files. The synthesized definitions take precedence over the definitions
523         read from partition definition files.</para>
525         <xi:include href="version-info.xml" xpointer="v255"/></listitem>
526       </varlistentry>
528       <varlistentry>
529         <term><option>--copy-source=</option><replaceable>PATH</replaceable></term>
530         <term><option>-s</option> <replaceable>PATH</replaceable></term>
532         <listitem><para>Specifies a source directory all <varname>CopyFiles=</varname> source paths shall be
533         considered relative to. This is similar to <option>--root=</option>, but exclusively applies to the
534         <varname>CopyFiles=</varname> setting. If <option>--root=</option> and
535         <option>--copy-source=</option> are used in combination the former applies as usual, except for
536         <varname>CopyFiles=</varname> where the latter takes precedence.</para>
538         <xi:include href="version-info.xml" xpointer="v255"/></listitem>
539       </varlistentry>
541       <varlistentry>
542         <term><option>--make-ddi=</option><replaceable>TYPE</replaceable></term>
544         <listitem><para>Takes one of <literal>sysext</literal>, <literal>confext</literal> or
545         <literal>portable</literal>. Generates a Discoverable Disk Image (DDI) for a system extension
546         (sysext, see
547         <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry>
548         for details), configuration extension (confext) or <ulink
549         url="https://systemd.io/PORTABLE_SERVICES">portable service</ulink>. The generated image will consist
550         of a signed Verity <literal>erofs</literal> file system as root partition. In this mode of operation
551         the partition definitions in <filename>/usr/lib/repart.d/*.conf</filename> and related directories
552         are not read, and <option>--definitions=</option> is not supported, as appropriate definitions for
553         the selected DDI class will be chosen automatically.</para>
555         <para>Must be used in conjunction with <option>--copy-source=</option> to specify the file hierarchy
556         to populate the DDI with. The specified directory should contain an <filename>etc/</filename>
557         subdirectory if <literal>confext</literal> is selected. If <literal>sysext</literal> is selected it
558         should contain either a <filename>usr/</filename> or <filename>opt/</filename> directory, or both. If
559         <literal>portable</literal> is used a full OS file hierarchy can be provided.</para>
561         <para>This option implies <option>--empty=create</option>, <option>--size=auto</option> and
562         <option>--seed=random</option> (the latter two can be overridden).</para>
564         <para>The private key and certificate for signing the DDI must be specified via the
565         <option>--private-key=</option> and <option>--certificate=</option> switches.</para>
567         <xi:include href="version-info.xml" xpointer="v255"/></listitem>
568       </varlistentry>
570       <varlistentry>
571         <term><option>-S</option></term>
572         <term><option>-C</option></term>
573         <term><option>-P</option></term>
575         <listitem><para>Shortcuts for <option>--make-ddi=sysext</option>,
576         <option>--make-ddi=confext</option>, <option>--make-ddi=portable</option>,
577         respectively.</para>
579         <xi:include href="version-info.xml" xpointer="v255"/></listitem>
580       </varlistentry>
582       <xi:include href="standard-options.xml" xpointer="help" />
583       <xi:include href="standard-options.xml" xpointer="version" />
584       <xi:include href="standard-options.xml" xpointer="no-pager" />
585       <xi:include href="standard-options.xml" xpointer="no-legend" />
586       <xi:include href="standard-options.xml" xpointer="json" />
587     </variablelist>
588   </refsect1>
590   <refsect1>
591     <title>Exit status</title>
593     <para>On success, 0 is returned, and a non-zero failure code otherwise.</para>
594   </refsect1>
596   <refsect1>
597     <title>Example</title>
599     <example>
600       <title>Generate a configuration extension image</title>
602       <para>The following creates a configuration extension DDI (confext) for an
603       <filename>/etc/motd</filename> update:</para>
605       <programlisting>mkdir -p tree/etc/extension-release.d
606 echo "Hello World" >tree/etc/motd
607 cat >tree/etc/extension-release.d/extension-release.my-motd &lt;&lt;EOF
608 ID=fedora
609 VERSION_ID=38
610 IMAGE_ID=my-motd
611 IMAGE_VERSION=7
613 systemd-repart -C \
614   --private-key=privkey.pem \
615   --certificate=cert.crt \
616   -s tree/ \
617   /var/lib/confexts/my-motd.confext.raw
618 systemd-confext refresh</programlisting>
620       <para>The DDI generated that way may be applied to the system with
621       <citerefentry><refentrytitle>systemd-confext</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
622     </example>
624   </refsect1>
626   <refsect1>
627     <title>See Also</title>
628     <para>
629       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
630       <citerefentry><refentrytitle>repart.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
631       <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
632       <citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
633       <citerefentry><refentrytitle>portablectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
634       <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry>
635     </para>
636   </refsect1>
638 </refentry>