X Tutup
Skip to content

Commit dfb4d0a

Browse files
committed
man: document new repart features
1 parent f7011e1 commit dfb4d0a

File tree

2 files changed

+103
-13
lines changed

2 files changed

+103
-13
lines changed

man/repart.d.xml

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
partition slot greater than the highest slot number currently in use. Any existing partitions that have
5656
no matching partition file are left as they are.</para>
5757

58-
<para>Note that these partition definition files do not describe the contents of the partitions, such as
59-
the file system used. Separate mechanisms, such as
60-
<citerefentry><refentrytitle>systemd-growfs</refentrytitle><manvolnum>8</manvolnum></citerefentry> and
61-
<command>systemd-makefs</command> maybe be used to initialize or grow the file systems inside of these
62-
partitions.</para>
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>
6363
</refsect1>
6464

6565
<refsect1>
@@ -327,7 +327,72 @@
327327
data is never overwritten. Note that the data is copied in before the partition table is updated,
328328
i.e. before the partition actually is persistently created. This provides robustness: it is
329329
guaranteed that the partition either doesn't exist or exists fully populated; it is not possible that
330-
the partition exists but is not or only partially populated.</para></listitem>
330+
the partition exists but is not or only partially populated.</para>
331+
332+
<para>This option cannot be combined with <varname>Format=</varname> or
333+
<varname>CopyFiles=</varname>.</para></listitem>
334+
</varlistentry>
335+
336+
<varlistentry>
337+
<term><varname>Format=</varname></term>
338+
339+
<listitem><para>Takes a file system name, such as <literal>ext4</literal>, <literal>btrfs</literal>,
340+
<literal>xfs</literal> or <literal>vfat</literal>, or the special value <literal>swap</literal>. If
341+
specified and the partition is newly created it is formatted with the specified file system (or as
342+
swap device). The file system UUID and label are automatically derived from the partition UUID and
343+
label. If this option is used, the size allocation algorithm is slightly altered: the partition is
344+
created as least as big as required for the minimal file system of the specified type (or 4KiB if the
345+
minimal size is not known).</para>
346+
347+
<para>This option has no effect if the partition already exists.</para>
348+
349+
<para>Similar to the behaviour of <varname>CopyBlocks=</varname> the file system is formatted before
350+
the partition is created, ensuring that the partition only ever exists with a fully initialized
351+
file system.</para>
352+
353+
<para>This option cannot be combined with <varname>CopyBlocks=</varname>.</para></listitem>
354+
</varlistentry>
355+
356+
<varlistentry>
357+
<term><varname>CopyFiles=</varname></term>
358+
359+
<listitem><para>Takes a pair of colon separated absolute file system paths. The first path refers to
360+
a source file or directory on the host, the second path refers to a target in the file system of the
361+
newly created partition and formatted file system. This setting may be used to copy files or
362+
directories from the host into the file system that is created due to the <varname>Format=</varname>
363+
option. If <varname>CopyFiles=</varname> is used without <varname>Format=</varname> specified
364+
explicitly, <literal>Format=</literal> with a suitable default is implied (currently
365+
<literal>ext4</literal>, but this may change in the future). This option may be used multiple times
366+
to copy multiple files or directories from host into the newly formatted file system. The colon and
367+
second path may be omitted in which case the source path is also used as the target path (relative to
368+
the root of the newly created file system). If the source path refers to a directory it is copied
369+
recursively.</para>
370+
371+
<para>This option has no effect if the partition already exists: it cannot be used to copy additional
372+
files into an existing partition, it may only be used to populate a file system created anew.</para>
373+
374+
<para>The copy operation is executed before the file system is registered in the partition table,
375+
thus ensuring that a file system populated this way only ever exists fully initialized.</para>
376+
377+
<para>This option cannot be combined with <varname>CopyBlocks=</varname>.</para></listitem>
378+
</varlistentry>
379+
380+
<varlistentry>
381+
<term><varname>Encrypt=</varname></term>
382+
383+
<listitem><para>Takes a boolean parameter, defaulting to false. If true the partition will be
384+
formatted with a LUKS2 superblock, before the blocks configured with <varname>CopyBlocks=</varname>
385+
are copied in or the file system configured with <varname>Format=</varname> is created.</para>
386+
387+
<para>The LUKS2 UUID is automatically derived from the partition UUID in a stable fashion. A single
388+
key is added to the LUKS2 superblock, configurable with the <option>--key-file=</option> switch to
389+
<command>systemd-repart</command>.</para>
390+
391+
<para>When used this slightly alters the size allocation logic as the implicit, minimal size limits
392+
of <varname>Format=</varname> and <varname>CopyBlocks=</varname> are increased by the space necessary
393+
for the LUKS2 superblock (see above).</para>
394+
395+
<para>This option has no effect if the partition already exists.</para></listitem>
331396
</varlistentry>
332397

333398
<varlistentry>

man/systemd-repart.xml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,26 @@
202202
<varlistentry>
203203
<term><option>--size=</option></term>
204204

205-
<listitem><para>Takes a size in bytes, using the usual K, M, G, T suffixes. If used the specified
206-
device node path must refer to a regular file, which is then grown to the specified size if smaller,
207-
before any change is made to the partition table. This is not supported if the specified node is a
208-
block device. This switch has no effect if the file is already as large as the specified size or
209-
larger. The specified size is implicitly rounded up to multiples of 4096. When used with
210-
<option>--empty=create</option> this specifies the initial size of the loopback file to
211-
create.</para></listitem>
205+
<listitem><para>Takes a size in bytes, using the usual K, M, G, T suffixes, or the special value
206+
<literal>auto</literal>. If used the specified device node path must refer to a regular file, which
207+
is then grown to the specified size if smaller, before any change is made to the partition table. If
208+
specified as <literal>auto</literal> the minimal size for the disk image is automatically determined
209+
(i.e. the minimal sizes of all partitions are summed up, taking space for additional metadata into
210+
account). This switch is not supported if the specified node is a block device. This switch has no
211+
effect if the file is already as large as the specified size or larger. The specified size is
212+
implicitly rounded up to multiples of 4096. When used with <option>--empty=create</option> this
213+
specifies the initial size of the loopback file to create.</para>
214+
215+
<para>The <option>--size=auto</option> option takes the sizes of pre-existing partitions into
216+
account. However, it does not accomodate for partition tables that are not tightly packed: the
217+
configured partitions might still not fit into the backing device if empty space exists between
218+
pre-existing partitions (or before the first partition) that cannot be fully filled by partitions to
219+
grow or create.</para>
220+
221+
<para>Also note that the automatic size determination does not take files or directories specified
222+
with <option>CopyFiles=</option> into account: operation might fail if the specified files or
223+
directories require more disk space then the configured per-partition minimal size
224+
limit.</para></listitem>
212225
</varlistentry>
213226

214227
<varlistentry>
@@ -283,6 +296,18 @@
283296
<filename>/run/repart.d/*.conf</filename>.</para></listitem>
284297
</varlistentry>
285298

299+
<varlistentry>
300+
<term><option>--key-file=</option></term>
301+
302+
<listitem><para>Takes a file system path. Configures the encryption key to use when setting up LUKS2
303+
volumes configured with the <varname>Encrypt=</varname> setting in partition files. Should refer to a
304+
regular file containing the key, or an <constant>AF_UNIX</constant> stream socket in the file
305+
system. In the latter case a connection is made to it and the key read from it. If this switch is not
306+
specified the empty key (i.e. zero length key) is used. This behaviour is useful for setting up encrypted
307+
partitions during early first boot that receive their user-supplied password only in a later setup
308+
step.</para></listitem>
309+
</varlistentry>
310+
286311
<xi:include href="standard-options.xml" xpointer="help" />
287312
<xi:include href="standard-options.xml" xpointer="version" />
288313
</variablelist>

0 commit comments

Comments
 (0)
X Tutup