Skip to content

Commit 5be64a5

Browse files
keszybzbluca
authored andcommitted
man/systemd-repart: extend description and reword some sentences
The page was written when systemd-repart was primarily intended to be used on a running system. But nowadays it's more often used to create images, so extend that part of the description. While at it, fix some whitespace issues and trim some overly complicated sentences. (cherry picked from commit d202ea5) (cherry picked from commit e60d01b)
1 parent 69681c2 commit 5be64a5

File tree

1 file changed

+55
-50
lines changed

1 file changed

+55
-50
lines changed

man/systemd-repart.xml

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,34 @@
3535
<refsect1>
3636
<title>Description</title>
3737

38-
<para><command>systemd-repart</command> grows and adds partitions to a partition table, based on the
39-
configuration files described in
38+
<para><command>systemd-repart</command> creates partition tables, and adds or grows partitions,
39+
based on the configuration files described in
4040
<citerefentry><refentrytitle>repart.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
4141
</para>
4242

43-
<para>If invoked with no arguments, it operates on the block device backing the root file system
44-
partition of the running OS, thus growing and adding partitions of the booted OS image itself. If
45-
<varname>--image=</varname> is used it will operate on the specified image file. When called in the
46-
initrd it operates on the block device backing <filename>/sysroot/</filename> instead, i.e. on the block
47-
device the system will soon transition into. The <filename>systemd-repart.service</filename> service is
48-
generally run at boot in the initrd, in order to augment the partition table of the OS before its
49-
partitions are mounted. <command>systemd-repart</command> (mostly) operates in a purely incremental mode:
50-
it only grows existing and adds new partitions; it does not shrink, delete or move existing partitions.
51-
The service is intended to be run on every boot, but when it detects that the partition table already
52-
matches the installed <filename>repart.d/*.conf</filename> configuration files, it executes no
53-
operation.</para>
54-
55-
<para><command>systemd-repart</command> is intended to be used when deploying OS images, to automatically
56-
adjust them to the system they are running on, during first boot. This way the deployed image can be
57-
minimal in size and may be augmented automatically at boot when needed, taking possession of disk space
58-
available but not yet used. Specifically the following use cases are among those covered:</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>
47+
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>
55+
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>
60+
61+
<para>The following use cases are among those covered:</para>
5962

6063
<itemizedlist>
6164
<listitem><para>The root partition may be grown to cover the whole available disk space.</para></listitem>
62-
<listitem><para>A <filename>/home/</filename>, swap or <filename>/srv/</filename> partition can be
65+
<listitem><para>A <filename>/home/</filename>, swap, or <filename>/srv/</filename> partition can be
6366
added.</para></listitem>
6467
<listitem><para>A second (or third, …) root partition may be added, to cover A/B style setups
6568
where a second version of the root file system is alternatingly used for implementing update
@@ -70,23 +73,22 @@
7073
<para>The algorithm executed by <command>systemd-repart</command> is roughly as follows:</para>
7174

7275
<orderedlist>
73-
<listitem><para>The <filename>repart.d/*.conf</filename> configuration files are loaded and parsed,
74-
and ordered by filename (without the directory prefix). For each configuration file,
75-
drop-in files are looked for in directories with same name as the configuration file
76-
with a suffix ".d" added.</para></listitem>
77-
78-
<listitem><para>The partition table already existing on the block device is loaded and
79-
parsed.</para></listitem>
80-
81-
<listitem><para>The existing partitions in the partition table are matched up with the
82-
<filename>repart.d/*.conf</filename> files by GPT partition type UUID. The first existing partition
83-
of a specific type is assigned the first configuration file declaring the same type. The second
84-
existing partition of a specific type is then assigned the second configuration file declaring the same
85-
type, and so on. After this iterative assigning is complete any left-over existing partitions that have
86-
no matching configuration file are considered "foreign" and left as they are. And any configuration
87-
files for which no partition currently exists are understood as a request to create such a partition.
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>
80+
81+
<listitem><para>The partition table on the block device is loaded and parsed, if present.
8882
</para></listitem>
8983

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>
91+
9092
<listitem><para>Partitions that shall be created are now allocated on the disk, taking the size
9193
constraints and weights declared in the configuration files into account. Free space is used within the
9294
limits set by size and padding requests. In addition, existing partitions that should be grown are
@@ -124,12 +126,11 @@
124126
partition table.</para></listitem>
125127
</orderedlist>
126128

127-
<para>As exception to the normally strictly incremental operation, when called in a special "factory
128-
reset" mode, <command>systemd-repart</command> may also be used to erase existing partitions to
129-
reset an installation back to vendor defaults. This mode of operation is used when either the
130-
<option>--factory-reset=yes</option> switch is passed on the tool's command line, or the
131-
<option>systemd.factory_reset=yes</option> option specified on the kernel command line, or the
132-
<varname>FactoryReset</varname> EFI variable (vendor UUID
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
133134
<constant>8cf2644b-4b0b-428f-9387-6d876050dc67</constant>) is set to "yes". It alters the algorithm above
134135
slightly: between the 3rd and the 4th step above any partition marked explicitly via the
135136
<varname>FactoryReset=</varname> boolean is deleted, and the algorithm restarted, thus immediately
@@ -153,11 +154,9 @@
153154
from a common seed images prepared with this tool become reproducible and the result of the algorithm
154155
above deterministic.</para>
155156

156-
<para>The positional argument should specify the block device to operate on. Instead of a block device
157-
node path a regular file may be specified too, in which case the command operates on it like it would if
158-
a loopback block device node was specified with the file attached. If <option>--empty=create</option> is
159-
specified the specified path is created as regular file, which is useful for generating disk images from
160-
scratch.</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>
161160
</refsect1>
162161

163162
<refsect1>
@@ -168,6 +167,7 @@
168167
<variablelist>
169168
<varlistentry>
170169
<term><option>--dry-run=</option></term>
170+
171171
<listitem><para>Takes a boolean. If this switch is not specified <option>--dry-run=yes</option> is
172172
the implied default. Controls whether <filename>systemd-repart</filename> executes the requested
173173
re-partition operations or whether it should only show what it would do. Unless
@@ -179,6 +179,7 @@
179179

180180
<varlistentry>
181181
<term><option>--empty=</option></term>
182+
182183
<listitem><para>Takes one of <literal>refuse</literal>, <literal>allow</literal>,
183184
<literal>require</literal>, <literal>force</literal> or <literal>create</literal>. Controls how to
184185
operate on block devices that are entirely empty, i.e. carry no partition table/disk label yet. If
@@ -589,7 +590,7 @@
589590
<refsect1>
590591
<title>Exit status</title>
591592

592-
<para>On success, 0 is returned, a non-zero failure code otherwise.</para>
593+
<para>On success, 0 is returned, and a non-zero failure code otherwise.</para>
593594
</refsect1>
594595

595596
<refsect1>
@@ -601,15 +602,19 @@
601602
<para>The following creates a configuration extension DDI (confext) for an
602603
<filename>/etc/motd</filename> update:</para>
603604

604-
<programlisting>mkdir tree tree/etc tree/etc/extension-release.d
605-
echo "Hello World" > tree/etc/motd
606-
cat > tree/etc/extension-release.d/extension-release.my-motd &lt;&lt;EOF
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
607608
ID=fedora
608609
VERSION_ID=38
609610
IMAGE_ID=my-motd
610611
IMAGE_VERSION=7
611612
EOF
612-
systemd-repart -C --private-key=privkey.pem --certificate=cert.crt -s tree/ /var/lib/confexts/my-motd.confext.raw
613+
systemd-repart -C \
614+
--private-key=privkey.pem \
615+
--certificate=cert.crt \
616+
-s tree/ \
617+
/var/lib/confexts/my-motd.confext.raw
613618
systemd-confext refresh</programlisting>
614619

615620
<para>The DDI generated that way may be applied to the system with

0 commit comments

Comments
 (0)