1REPART.D(5)                        repart.d                        REPART.D(5)
2
3
4

NAME

6       repart.d - Partition Definition Files for Automatic Boot-Time
7       Repartitioning
8

SYNOPSIS

10       /etc/repart.d/*.conf
11       /run/repart.d/*.conf
12       /usr/lib/repart.d/*.conf
13
14

DESCRIPTION

16       repart.d/*.conf files describe basic properties of partitions of block
17       devices of the local system. They may be used to declare types, names
18       and sizes of partitions that shall exist. The systemd-repart(8) service
19       reads these files and attempts to add new partitions currently missing
20       and enlarge existing partitions according to these definitions.
21       Operation is generally incremental, i.e. when applied, what exists
22       already is left intact, and partitions are never shrunk, moved or
23       deleted.
24
25       These definition files are useful for implementing operating system
26       images that are prepared and delivered with minimally sized images (for
27       example lacking any state or swap partitions), and which on first boot
28       automatically take possession of any remaining disk space following a
29       few basic rules.
30
31       Currently, support for partition definition files is only implemented
32       for GPT partition tables.
33
34       Partition files are generally matched against any partitions already
35       existing on disk in a simple algorithm: the partition files are sorted
36       by their filename (ignoring the directory prefix), and then compared in
37       order against existing partitions matching the same partition type
38       UUID. Specifically, the first existing partition with a specific
39       partition type UUID is assigned the first definition file with the same
40       partition type UUID, and the second existing partition with a specific
41       type UUID the second partition file with the same type UUID, and so on.
42       Any left-over partition files that have no matching existing partition
43       are assumed to define new partition that shall be created. Such
44       partitions are appended to the end of the partition table, in the order
45       defined by their names utilizing the first partition slot greater than
46       the highest slot number currently in use. Any existing partitions that
47       have no matching partition file are left as they are.
48
49       Note that these definitions may only be used to create and initialize
50       new partitions or to grow existing ones. In the latter case it will not
51       grow the contained files systems however; separate mechanisms, such as
52       systemd-growfs(8) may be used to grow the file systems inside of these
53       partitions. Partitions may also be marked for automatic growing via the
54       GrowFileSystem= setting, in which case the file system is grown on
55       first mount by tools that respect this flag. See below for details.
56

[PARTITION] SECTION OPTIONS

58       Type=
59           The GPT partition type UUID to match. This may be a GPT partition
60           type UUID such as 4f68bce3-e8cd-4db1-96e7-fbcaf984b709, or an
61           identifier. Architecture specific partition types can use one of
62           these architecture identifiers: alpha, arc, arm (32-bit), arm64
63           (64-bit, aka aarch64), ia64, loongarch64, mips-le, mips64-le,
64           parisc, ppc, ppc64, ppc64-le, riscv32, riscv64, s390, s390x,
65           tilegx, x86 (32-bit, aka i386) and x86-64 (64-bit, aka amd64). The
66           supported identifiers are:
67
68           Table 1. GPT partition type identifiers
69           ┌──────────────────────────┬────────────────────────────┐
70Identifier                Explanation                
71           ├──────────────────────────┼────────────────────────────┤
72esp                       │ EFI System Partition       │
73           ├──────────────────────────┼────────────────────────────┤
74xbootldr                  │ Extended Boot Loader       │
75           │                          │ Partition                  │
76           ├──────────────────────────┼────────────────────────────┤
77swap                      │ Swap partition             │
78           ├──────────────────────────┼────────────────────────────┤
79home                      │ Home (/home/) partition    │
80           ├──────────────────────────┼────────────────────────────┤
81srv                       │ Server data (/srv/)        │
82           │                          │ partition                  │
83           ├──────────────────────────┼────────────────────────────┤
84var                       │ Variable data (/var/)      │
85           │                          │ partition                  │
86           ├──────────────────────────┼────────────────────────────┤
87tmp                       │ Temporary data (/var/tmp/) │
88           │                          │ partition                  │
89           ├──────────────────────────┼────────────────────────────┤
90linux-generic             │ Generic Linux file system  │
91           │                          │ partition                  │
92           ├──────────────────────────┼────────────────────────────┤
93root                      │ Root file system partition │
94           │                          │ type appropriate for the   │
95           │                          │ local architecture (an     │
96           │                          │ alias for an architecture  │
97           │                          │ root file system partition │
98           │                          │ type listed below, e.g.    │
99           │                          │ root-x86-64)               │
100           ├──────────────────────────┼────────────────────────────┤
101root-verity               │ Verity data for the root   │
102           │                          │ file system partition for  │
103           │                          │ the local architecture     │
104           ├──────────────────────────┼────────────────────────────┤
105root-verity-sig           │ Verity signature data for  │
106           │                          │ the root file system       │
107           │                          │ partition for the local    │
108           │                          │ architecture               │
109           ├──────────────────────────┼────────────────────────────┤
110root-secondary            │ Root file system partition │
111           │                          │ of the secondary           │
112           │                          │ architecture of the local  │
113           │                          │ architecture (usually the  │
114           │                          │ matching 32-bit            │
115           │                          │ architecture for the local │
116           │                          │ 64-bit architecture)       │
117           ├──────────────────────────┼────────────────────────────┤
118root-secondary-verity     │ Verity data for the root   │
119           │                          │ file system partition of   │
120           │                          │ the secondary architecture │
121           ├──────────────────────────┼────────────────────────────┤
122root-secondary-verity-sig │ Verity signature data for  │
123           │                          │ the root file system       │
124           │                          │ partition of the secondary │
125           │                          │ architecture               │
126           ├──────────────────────────┼────────────────────────────┤
127root-{arch}               │ Root file system partition │
128           │                          │ of the given architecture  │
129           │                          │ (such as root-x86-64 or    │
130           │                          │ root-riscv64)              │
131           ├──────────────────────────┼────────────────────────────┤
132root-{arch}-verity        │ Verity data for the root   │
133           │                          │ file system partition of   │
134           │                          │ the given architecture     │
135           ├──────────────────────────┼────────────────────────────┤
136root-{arch}-verity-sig    │ Verity signature data for  │
137           │                          │ the root file system       │
138           │                          │ partition of the given     │
139           │                          │ architecture               │
140           ├──────────────────────────┼────────────────────────────┤
141usr                       │ /usr/ file system          │
142           │                          │ partition type appropriate │
143           │                          │ for the local architecture │
144           │                          │ (an alias for an           │
145           │                          │ architecture /usr/ file    │
146           │                          │ system partition type      │
147           │                          │ listed below, e.g.         │
148           │                          │ usr-x86-64)                │
149           ├──────────────────────────┼────────────────────────────┤
150usr-verity                │ Verity data for the /usr/  │
151           │                          │ file system partition for  │
152           │                          │ the local architecture     │
153           ├──────────────────────────┼────────────────────────────┤
154usr-verity-sig            │ Verity signature data for  │
155           │                          │ the /usr/ file system      │
156           │                          │ partition for the local    │
157           │                          │ architecture               │
158           ├──────────────────────────┼────────────────────────────┤
159usr-secondary             │ /usr/ file system          │
160           │                          │ partition of the secondary │
161           │                          │ architecture of the local  │
162           │                          │ architecture (usually the  │
163           │                          │ matching 32-bit            │
164           │                          │ architecture for the local │
165           │                          │ 64-bit architecture)       │
166           ├──────────────────────────┼────────────────────────────┤
167usr-secondary-verity      │ Verity data for the /usr/  │
168           │                          │ file system partition of   │
169           │                          │ the secondary architecture │
170           ├──────────────────────────┼────────────────────────────┤
171usr-secondary-verity-sig  │ Verity signature data for  │
172           │                          │ the /usr/ file system      │
173           │                          │ partition of the secondary │
174           │                          │ architecture               │
175           ├──────────────────────────┼────────────────────────────┤
176usr-{arch}                │ /usr/ file system          │
177           │                          │ partition of the given     │
178           │                          │ architecture               │
179           ├──────────────────────────┼────────────────────────────┤
180usr-{arch}-verity         │ Verity data for the /usr/  │
181           │                          │ file system partition of   │
182           │                          │ the given architecture     │
183           ├──────────────────────────┼────────────────────────────┤
184usr-{arch}-verity-sig     │ Verity signature data for  │
185           │                          │ the /usr/ file system      │
186           │                          │ partition of the given     │
187           │                          │ architecture               │
188           └──────────────────────────┴────────────────────────────┘
189           This setting defaults to linux-generic.
190
191           Most of the partition type UUIDs listed above are defined in the
192           Discoverable Partitions Specification[1].
193
194       Label=
195           The textual label to assign to the partition if none is assigned
196           yet. Note that this setting is not used for matching. It is also
197           not used when a label is already set for an existing partition. It
198           is thus only used when a partition is newly created or when an
199           existing one had a no label set (that is: an empty label). If not
200           specified a label derived from the partition type is automatically
201           used. Simple specifier expansion is supported, see below.
202
203       UUID=
204           The UUID to assign to the partition if none is assigned yet. Note
205           that this setting is not used for matching. It is also not used
206           when a UUID is already set for an existing partition. It is thus
207           only used when a partition is newly created or when an existing one
208           had a all-zero UUID set. If set to "null", the UUID is set to all
209           zeroes. If not specified a UUID derived from the partition type is
210           automatically used.
211
212       Priority=
213           A numeric priority to assign to this partition, in the range
214           -2147483648...2147483647, with smaller values indicating higher
215           priority, and higher values indicating smaller priority. This
216           priority is used in case the configured size constraints on the
217           defined partitions do not permit fitting all partitions onto the
218           available disk space. If the partitions do not fit, the highest
219           numeric partition priority of all defined partitions is determined,
220           and all defined partitions with this priority are removed from the
221           list of new partitions to create (which may be multiple, if the
222           same priority is used for multiple partitions). The fitting
223           algorithm is then tried again. If the partitions still do not fit,
224           the now highest numeric partition priority is determined, and the
225           matching partitions removed too, and so on. Partitions of a
226           priority of 0 or lower are never removed. If all partitions with a
227           priority above 0 are removed and the partitions still do not fit on
228           the device the operation fails. Note that this priority has no
229           effect on ordering partitions, for that use the alphabetical order
230           of the filenames of the partition definition files. Defaults to 0.
231
232       Weight=
233           A numeric weight to assign to this partition in the range
234           0...1000000. Available disk space is assigned the defined
235           partitions according to their relative weights (subject to the size
236           constraints configured with SizeMinBytes=, SizeMaxBytes=), so that
237           a partition with weight 2000 gets double the space as one with
238           weight 1000, and a partition with weight 333 a third of that.
239           Defaults to 1000.
240
241           The Weight= setting is used to distribute available disk space in
242           an "elastic" fashion, based on the disk size and existing
243           partitions. If a partition shall have a fixed size use both
244           SizeMinBytes= and SizeMaxBytes= with the same value in order to
245           fixate the size to one value, in which case the weight has no
246           effect.
247
248       PaddingWeight=
249           Similar to Weight=, but sets a weight for the free space after the
250           partition (the "padding"). When distributing available space the
251           weights of all partitions and all defined padding is summed, and
252           then each partition and padding gets the fraction defined by its
253           weight. Defaults to 0, i.e. by default no padding is applied.
254
255           Padding is useful if empty space shall be left for later additions
256           or a safety margin at the end of the device or between partitions.
257
258       SizeMinBytes=, SizeMaxBytes=
259           Specifies minimum and maximum size constraints in bytes. Takes the
260           usual K, M, G, T, ... suffixes (to the base of 1024). If
261           SizeMinBytes= is specified the partition is created at or grown to
262           at least the specified size. If SizeMaxBytes= is specified the
263           partition is created at or grown to at most the specified size. The
264           precise size is determined through the weight value configured with
265           Weight=, see above. When SizeMinBytes= is set equal to
266           SizeMaxBytes= the configured weight has no effect as the partition
267           is explicitly sized to the specified fixed value. Note that
268           partitions are never created smaller than 4096 bytes, and since
269           partitions are never shrunk the previous size of the partition (in
270           case the partition already exists) is also enforced as lower bound
271           for the new size. The values should be specified as multiples of
272           4096 bytes, and are rounded upwards (in case of SizeMinBytes=) or
273           downwards (in case of SizeMaxBytes=) otherwise. If the backing
274           device does not provide enough space to fulfill the constraints
275           placing the partition will fail. For partitions that shall be
276           created, depending on the setting of Priority= (see above) the
277           partition might be dropped and the placing algorithm restarted. By
278           default a minimum size constraint of 10M and no maximum size
279           constraint is set.
280
281       PaddingMinBytes=, PaddingMaxBytes=
282           Specifies minimum and maximum size constraints in bytes for the
283           free space after the partition (the "padding"). Semantics are
284           similar to SizeMinBytes= and SizeMaxBytes=, except that unlike
285           partition sizes free space can be shrunk and can be as small as
286           zero. By default no size constraints on padding are set, so that
287           only PaddingWeight= determines the size of the padding applied.
288
289       CopyBlocks=
290           Takes a path to a regular file, block device node or directory, or
291           the special value "auto". If specified and the partition is newly
292           created, the data from the specified path is written to the newly
293           created partition, on the block level. If a directory is specified,
294           the backing block device of the file system the directory is on is
295           determined, and the data read directly from that. This option is
296           useful to efficiently replicate existing file systems onto new
297           partitions on the block level — for example to build a simple OS
298           installer or an OS image builder.
299
300           If the special value "auto" is specified, the source to copy from
301           is automatically picked up from the running system (or the image
302           specified with --image= — if used). A partition that matches both
303           the configured partition type (as declared with Type= described
304           above), and the currently mounted directory appropriate for that
305           partition type is determined. For example, if the partition type is
306           set to "root" the partition backing the root directory (/) is used
307           as source to copy from — if its partition type is set to "root" as
308           well. If the declared type is "usr" the partition backing /usr/ is
309           used as source to copy blocks from — if its partition type is set
310           to "usr" too. The logic is capable of automatically tracking down
311           the backing partitions for encrypted and Verity-enabled volumes.
312           "CopyBlocks=auto" is useful for implementing "self-replicating"
313           systems, i.e. systems that are their own installer.
314
315           The file specified here must have a size that is a multiple of the
316           basic block size 512 and not be empty. If this option is used, the
317           size allocation algorithm is slightly altered: the partition is
318           created as least as big as required to fit the data in, i.e. the
319           data size is an additional minimum size value taken into
320           consideration for the allocation algorithm, similar to and in
321           addition to the SizeMin= value configured above.
322
323           This option has no effect if the partition it is declared for
324           already exists, i.e. existing data is never overwritten. Note that
325           the data is copied in before the partition table is updated, i.e.
326           before the partition actually is persistently created. This
327           provides robustness: it is guaranteed that the partition either
328           doesn't exist or exists fully populated; it is not possible that
329           the partition exists but is not or only partially populated.
330
331           This option cannot be combined with Format= or CopyFiles=.
332
333       Format=
334           Takes a file system name, such as "ext4", "btrfs", "xfs", "vfat",
335           "erofs", "squashfs" or the special value "swap". If specified and
336           the partition is newly created it is formatted with the specified
337           file system (or as swap device). The file system UUID and label are
338           automatically derived from the partition UUID and label. If this
339           option is used, the size allocation algorithm is slightly altered:
340           the partition is created as least as big as required for the
341           minimal file system of the specified type (or 4KiB if the minimal
342           size is not known).
343
344           This option has no effect if the partition already exists.
345
346           Similarly to the behaviour of CopyBlocks=, the file system is
347           formatted before the partition is created, ensuring that the
348           partition only ever exists with a fully initialized file system.
349
350           This option cannot be combined with CopyBlocks=.
351
352       CopyFiles=
353           Takes a pair of colon separated absolute file system paths. The
354           first path refers to a source file or directory on the host, the
355           second path refers to a target in the file system of the newly
356           created partition and formatted file system. This setting may be
357           used to copy files or directories from the host into the file
358           system that is created due to the Format= option. If CopyFiles= is
359           used without Format= specified explicitly, "Format=" with a
360           suitable default is implied (currently "vfat" for "ESP" and
361           "XBOOTLDR" partitions, and "ext4" otherwise, but this may change in
362           the future). This option may be used multiple times to copy
363           multiple files or directories from host into the newly formatted
364           file system. The colon and second path may be omitted in which case
365           the source path is also used as the target path (relative to the
366           root of the newly created file system). If the source path refers
367           to a directory it is copied recursively.
368
369           This option has no effect if the partition already exists: it
370           cannot be used to copy additional files into an existing partition,
371           it may only be used to populate a file system created anew.
372
373           The copy operation is executed before the file system is registered
374           in the partition table, thus ensuring that a file system populated
375           this way only ever exists fully initialized.
376
377           Note that CopyFiles= will skip copying files that aren't supported
378           by the target filesystem (e.g symlinks, fifos, sockets and devices
379           on vfat). When an unsupported file type is encountered,
380           systemd-repart will skip copying this file and write a log message
381           about it.
382
383           Note that systemd-repart does not change the UIDs/GIDs of any
384           copied files and directories. When running systemd-repart as an
385           unprivileged user to build an image of files and directories owned
386           by the same user, you can run systemd-repart in a user namespace
387           with the current user mapped to the root user to make sure the
388           files and directories in the image are owned by the root user.
389
390           Note that when populating XFS filesystems with systemd-repart and
391           loop devices are not available, populating XFS filesystems with
392           files containing spaces, tabs or newlines might fail on old
393           versions of mkfs.xfs(8) due to limitations of its protofile format.
394
395           Note that when populating XFS filesystems with systemd-repart and
396           loop devices are not available, extended attributes will not be
397           copied into generated XFS filesystems due to limitations
398           mkfs.xfs(8)'s protofile format.
399
400           This option cannot be combined with CopyBlocks=.
401
402           When systemd-repart(8) is invoked with the --image= or --root=
403           command line switches the source paths specified are taken relative
404           to the specified root directory or disk image root.
405
406       ExcludeFiles=, ExcludeFilesTarget=
407           Takes an absolute file system path referring to a source file or
408           directory on the host. This setting may be used to exclude files or
409           directories from the host from being copied into the file system
410           when CopyFiles= is used. This option may be used multiple times to
411           exclude multiple files or directories from host from being copied
412           into the newly formatted file system.
413
414           If the path is a directory and ends with "/", only the directory's
415           contents are excluded but not the directory itself. If the path is
416           a directory and does not end with "/", both the directory and its
417           contents are excluded.
418
419           ExcludeFilesTarget= is like ExcludeFiles= except that instead of
420           excluding the path on the host from being copied into the
421           partition, we exclude any files and directories from being copied
422           into the given path in the partition.
423
424           When systemd-repart(8) is invoked with the --image= or --root=
425           command line switches the paths specified are taken relative to the
426           specified root directory or disk image root.
427
428       MakeDirectories=
429           Takes one or more absolute paths, separated by whitespace, each
430           declaring a directory to create within the new file system.
431           Behaviour is similar to CopyFiles=, but instead of copying in a set
432           of files this just creates the specified directories with the
433           default mode of 0755 owned by the root user and group, plus all
434           their parent directories (with the same ownership and access mode).
435           To configure directories with different ownership or access mode,
436           use CopyFiles= and specify a source tree to copy containing
437           appropriately owned/configured directories. This option may be used
438           more than once to create multiple directories. When CopyFiles= and
439           MakeDirectories= are used together the former is applied first. If
440           a directory listed already exists no operation is executed (in
441           particular, the ownership/access mode of the directories is left as
442           is).
443
444           The primary use case for this option is to create a minimal set of
445           directories that may be mounted over by other partitions contained
446           in the same disk image. For example, a disk image where the root
447           file system is formatted at first boot might want to automatically
448           pre-create /usr/ in it this way, so that the "usr" partition may
449           over-mount it.
450
451           Consider using systemd-tmpfiles(8) with its --image= option to
452           pre-create other, more complex directory hierarchies (as well as
453           other inodes) with fine-grained control of ownership, access modes
454           and other file attributes.
455
456       Encrypt=
457           Takes one of "off", "key-file", "tpm2" and "key-file+tpm2"
458           (alternatively, also accepts a boolean value, which is mapped to
459           "off" when false, and "key-file" when true). Defaults to "off". If
460           not "off" the partition will be formatted with a LUKS2 superblock,
461           before the blocks configured with CopyBlocks= are copied in or the
462           file system configured with Format= is created.
463
464           The LUKS2 UUID is automatically derived from the partition UUID in
465           a stable fashion. If "key-file" or "key-file+tpm2" is used, a key
466           is added to the LUKS2 superblock, configurable with the --key-file=
467           option to systemd-repart. If "tpm2" or "key-file+tpm2" is used, a
468           key is added to the LUKS2 superblock that is enrolled to the local
469           TPM2 chip, as configured with the --tpm2-device= and --tpm2-pcrs=
470           options to systemd-repart.
471
472           When used this slightly alters the size allocation logic as the
473           implicit, minimal size limits of Format= and CopyBlocks= are
474           increased by the space necessary for the LUKS2 superblock (see
475           above).
476
477           This option has no effect if the partition already exists.
478
479       Verity=
480           Takes one of "off", "data", "hash" or "signature". Defaults to
481           "off". If set to "off" or "data", the partition is populated with
482           content as specified by CopyBlocks= or CopyFiles=. If set to
483           "hash", the partition will be populated with verity hashes from the
484           matching verity data partition. If set to "signature", the
485           partition will be populated with a JSON object containing a
486           signature of the verity root hash of the matching verity hash
487           partition.
488
489           A matching verity partition is a partition with the same verity
490           match key (as configured with VerityMatchKey=).
491
492           If not explicitly configured, the data partition's UUID will be set
493           to the first 128 bits of the verity root hash. Similarly, if not
494           configured, the hash partition's UUID will be set to the final 128
495           bits of the verity root hash. The verity root hash itself will be
496           included in the output of systemd-repart.
497
498           This option has no effect if the partition already exists.
499
500           Usage of this option in combination with Encrypt= is not supported.
501
502           For each unique VerityMatchKey= value, a single verity data
503           partition ("Verity=data") and a single verity hash partition
504           ("Verity=hash") must be defined.
505
506       VerityMatchKey=
507           Takes a short, user-chosen identifier string. This setting is used
508           to find sibling verity partitions for the current verity partition.
509           See the description for Verity=.
510
511       FactoryReset=
512           Takes a boolean argument. If specified the partition is marked for
513           removal during a factory reset operation. This functionality is
514           useful to implement schemes where images can be reset into their
515           original state by removing partitions and creating them anew.
516           Defaults to off.
517
518       Flags=
519           Configures the 64-bit GPT partition flags field to set for the
520           partition when creating it. This option has no effect if the
521           partition already exists. If not specified the flags values is set
522           to all zeroes, except for the three bits that can also be
523           configured via NoAuto=, ReadOnly= and GrowFileSystem=; see below
524           for details on the defaults for these three flags. Specify the
525           flags value in hexadecimal (by prefixing it with "0x"), binary
526           (prefix "0b") or decimal (no prefix).
527
528       NoAuto=, ReadOnly=, GrowFileSystem=
529           Configures the No-Auto, Read-Only and Grow-File-System partition
530           flags (bit 63, 60 and 59) of the partition table entry, as defined
531           by the Discoverable Partitions Specification[1]. Only available for
532           partition types supported by the specification. This option is a
533           friendly way to set bits 63, 60 and 59 of the partition flags value
534           without setting any of the other bits, and may be set via Flags=
535           too, see above.
536
537           If Flags= is used in conjunction with one or more of
538           NoAuto=/ReadOnly=/GrowFileSystem= the latter control the value of
539           the relevant flags, i.e. the high-level settings
540           NoAuto=/ReadOnly=/GrowFileSystem= override the relevant bits of the
541           low-level setting Flags=.
542
543           Note that the three flags affect only automatic partition mounting,
544           as implemented by systemd-gpt-auto-generator(8) or the --image=
545           option of various commands (such as systemd-nspawn(1)). It has no
546           effect on explicit mounts, such as those done via mount(8) or
547           fstab(5).
548
549           If both bit 50 and 59 are set for a partition (i.e. the partition
550           is marked both read-only and marked for file system growing) the
551           latter is typically without effect: the read-only flag takes
552           precedence in most tools reading these flags, and since growing the
553           file system involves writing to the partition it is consequently
554           ignored.
555
556           NoAuto= defaults to off.  ReadOnly= defaults to on for Verity
557           partition types, and off for all others.  GrowFileSystem= defaults
558           to on for all partition types that support it, except if the
559           partition is marked read-only (and thus effectively, defaults to
560           off for Verity partitions).
561
562       SplitName=
563           Configures the suffix to append to split artifacts when the --split
564           option of systemd-repart(8) is used. Simple specifier expansion is
565           supported, see below. Defaults to "%t". To disable split artifact
566           generation for a partition, set SplitName= to "-".
567
568       Minimize=
569           Takes one of "off", "best", and "guess" (alternatively, also
570           accepts a boolean value, which is mapped to "off" when false, and
571           "best" when true). Defaults to "off". If set to "best", the
572           partition will have the minimal size required to store the sources
573           configured with CopyFiles=.  "best" is currently only supported for
574           read-only filesystems. If set to "guess", the partition is created
575           at least as big as required to store the sources configured with
576           CopyFiles=. Note that unless the filesystem is a read-only
577           filesystem, systemd-repart will have to populate the filesystem
578           twice to guess the minimal required size, so enabling this option
579           might slow down repart when populating large partitions.
580

SPECIFIERS

582       Specifiers may be used in the Label=, CopyBlocks=, CopyFiles=,
583       MakeDirectories=, SplitName= settings. The following expansions are
584       understood:
585
586       Table 2. Specifiers available
587       ┌──────────┬─────────────────────┬────────────────────────┐
588Specifier Meaning             Details                
589       ├──────────┼─────────────────────┼────────────────────────┤
590       │"%a"      │ Architecture        │ A short string         │
591       │          │                     │ identifying the        │
592       │          │                     │ architecture of the    │
593       │          │                     │ local system. A        │
594       │          │                     │ string such as x86,    │
595       │          │                     │ x86-64 or arm64.       │
596       │          │                     │ See the                │
597       │          │                     │ architectures          │
598       │          │                     │ defined for            │
599       │          │                     │ ConditionArchitecture=
600       │          │                     │ in systemd.unit(5)
601       │          │                     │ for a full list.       │
602       ├──────────┼─────────────────────┼────────────────────────┤
603       │"%A"      │ Operating system    │ The operating system   │
604       │          │ image version       │ image version          │
605       │          │                     │ identifier of the      │
606       │          │                     │ running system, as     │
607       │          │                     │ read from the          │
608       │          │                     │ IMAGE_VERSION= field   │
609       │          │                     │ of /etc/os-release. If │
610       │          │                     │ not set, resolves to   │
611       │          │                     │ an empty string. See   │
612       │          │                     │ os-release(5) for more │
613       │          │                     │ information.           │
614       ├──────────┼─────────────────────┼────────────────────────┤
615       │"%b"      │ Boot ID             │ The boot ID of the     │
616       │          │                     │ running system,        │
617       │          │                     │ formatted as string.   │
618       │          │                     │ See random(4) for more │
619       │          │                     │ information.           │
620       ├──────────┼─────────────────────┼────────────────────────┤
621       │"%B"      │ Operating system    │ The operating system   │
622       │          │ build ID            │ build identifier of    │
623       │          │                     │ the running system, as │
624       │          │                     │ read from the          │
625       │          │                     │ BUILD_ID= field of     │
626       │          │                     │ /etc/os-release. If    │
627       │          │                     │ not set, resolves to   │
628       │          │                     │ an empty string. See   │
629       │          │                     │ os-release(5) for more │
630       │          │                     │ information.           │
631       ├──────────┼─────────────────────┼────────────────────────┤
632       │"%H"      │ Host name           │ The hostname of the    │
633       │          │                     │ running system.        │
634       ├──────────┼─────────────────────┼────────────────────────┤
635       │"%l"      │ Short host name     │ The hostname of the    │
636       │          │                     │ running system,        │
637       │          │                     │ truncated at the first │
638       │          │                     │ dot to remove any      │
639       │          │                     │ domain component.      │
640       ├──────────┼─────────────────────┼────────────────────────┤
641       │"%m"      │ Machine ID          │ The machine ID of the  │
642       │          │                     │ running system,        │
643       │          │                     │ formatted as string.   │
644       │          │                     │ See machine-id(5) for  │
645       │          │                     │ more information.      │
646       ├──────────┼─────────────────────┼────────────────────────┤
647       │"%M"      │ Operating system    │ The operating system   │
648       │          │ image identifier    │ image identifier of    │
649       │          │                     │ the running system, as │
650       │          │                     │ read from the          │
651       │          │                     │ IMAGE_ID= field of     │
652       │          │                     │ /etc/os-release. If    │
653       │          │                     │ not set, resolves to   │
654       │          │                     │ an empty string. See   │
655       │          │                     │ os-release(5) for more │
656       │          │                     │ information.           │
657       ├──────────┼─────────────────────┼────────────────────────┤
658       │"%o"      │ Operating system ID │ The operating system   │
659       │          │                     │ identifier of the      │
660       │          │                     │ running system, as     │
661       │          │                     │ read from the ID=
662       │          │                     │ field of               │
663       │          │                     │ /etc/os-release. See   │
664       │          │                     │ os-release(5) for more │
665       │          │                     │ information.           │
666       ├──────────┼─────────────────────┼────────────────────────┤
667       │"%v"      │ Kernel release      │ Identical to uname -r  
668       │          │                     │ output.                │
669       ├──────────┼─────────────────────┼────────────────────────┤
670       │"%w"      │ Operating system    │ The operating system   │
671       │          │ version ID          │ version identifier of  │
672       │          │                     │ the running system, as │
673       │          │                     │ read from the          │
674       │          │                     │ VERSION_ID= field of   │
675       │          │                     │ /etc/os-release. If    │
676       │          │                     │ not set, resolves to   │
677       │          │                     │ an empty string. See   │
678       │          │                     │ os-release(5) for more │
679       │          │                     │ information.           │
680       ├──────────┼─────────────────────┼────────────────────────┤
681       │"%W"      │ Operating system    │ The operating system   │
682       │          │ variant ID          │ variant identifier of  │
683       │          │                     │ the running system, as │
684       │          │                     │ read from the          │
685       │          │                     │ VARIANT_ID= field of   │
686       │          │                     │ /etc/os-release. If    │
687       │          │                     │ not set, resolves to   │
688       │          │                     │ an empty string. See   │
689       │          │                     │ os-release(5) for more │
690       │          │                     │ information.           │
691       ├──────────┼─────────────────────┼────────────────────────┤
692       │"%T"      │ Directory for       │ This is either /tmp or │
693       │          │ temporary files     │ the path "$TMPDIR",    │
694       │          │                     │ "$TEMP" or "$TMP" are  │
695       │          │                     │ set to. (Note that the │
696       │          │                     │ directory may be       │
697       │          │                     │ specified without a    │
698       │          │                     │ trailing slash.)       │
699       ├──────────┼─────────────────────┼────────────────────────┤
700       │"%V"      │ Directory for       │ This is either         │
701       │          │ larger and          │ /var/tmp or the path   │
702       │          │ persistent          │ "$TMPDIR", "$TEMP" or  │
703       │          │ temporary files     │ "$TMP" are set to.     │
704       │          │                     │ (Note that the         │
705       │          │                     │ directory may be       │
706       │          │                     │ specified without a    │
707       │          │                     │ trailing slash.)       │
708       ├──────────┼─────────────────────┼────────────────────────┤
709       │"%%"      │ Single percent sign │ Use "%%" in place of   │
710       │          │                     │ "%" to specify a       │
711       │          │                     │ single percent sign.   │
712       └──────────┴─────────────────────┴────────────────────────┘
713
714       Additionally, for the SplitName= setting, the following specifiers are
715       also understood:
716
717       Table 3. Specifiers available
718       ┌──────────┬─────────────────────┬─────────────────────┐
719Specifier Meaning             Details             
720       ├──────────┼─────────────────────┼─────────────────────┤
721       │"%T"      │ Partition Type UUID │ The partition type  │
722       │          │                     │ UUID, as configured │
723       │          │                     │ with Type=
724       ├──────────┼─────────────────────┼─────────────────────┤
725       │"%t"      │ Partition Type      │ The partition type  │
726       │          │ Identifier          │ identifier          │
727       │          │                     │ corresponding to    │
728       │          │                     │ the partition type  │
729       │          │                     │ UUID                │
730       ├──────────┼─────────────────────┼─────────────────────┤
731       │"%U"      │ Partition UUID      │ The partition UUID, │
732       │          │                     │ as configured with  │
733       │          │                     │ UUID=
734       ├──────────┼─────────────────────┼─────────────────────┤
735       │"%n"      │ Partition Number    │ The partition       │
736       │          │                     │ number assigned to  │
737       │          │                     │ the partition       │
738       └──────────┴─────────────────────┴─────────────────────┘
739

EXAMPLES

741       Example 1. Grow the root partition to the full disk size at first boot
742
743       With the following file the root partition is automatically grown to
744       the full disk if possible during boot.
745
746           # /usr/lib/repart.d/50-root.conf
747           [Partition]
748           Type=root
749
750
751       Example 2. Create a swap and home partition automatically on boot, if
752       missing
753
754       The home partition gets all available disk space while the swap
755       partition gets 1G at most and 64M at least. We set a priority > 0 on
756       the swap partition to ensure the swap partition is not used if not
757       enough space is available. For every three bytes assigned to the home
758       partition the swap partition gets assigned one.
759
760           # /usr/lib/repart.d/60-home.conf
761           [Partition]
762           Type=home
763
764           # /usr/lib/repart.d/70-swap.conf
765           [Partition]
766           Type=swap
767           SizeMinBytes=64M
768           SizeMaxBytes=1G
769           Priority=1
770           Weight=333
771
772
773       Example 3. Create B partitions in an A/B Verity setup, if missing
774
775       Let's say the vendor intends to update OS images in an A/B setup, i.e.
776       with two root partitions (and two matching Verity partitions) that
777       shall be used alternatingly during upgrades. To minimize image sizes
778       the original image is shipped only with one root and one Verity
779       partition (the "A" set), and the second root and Verity partitions (the
780       "B" set) shall be created on first boot on the free space on the
781       medium.
782
783           # /usr/lib/repart.d/50-root.conf
784           [Partition]
785           Type=root
786           SizeMinBytes=512M
787           SizeMaxBytes=512M
788
789           # /usr/lib/repart.d/60-root-verity.conf
790           [Partition]
791           Type=root-verity
792           SizeMinBytes=64M
793           SizeMaxBytes=64M
794
795       The definitions above cover the "A" set of root partition (of a fixed
796       512M size) and Verity partition for the root partition (of a fixed 64M
797       size). Let's use symlinks to create the "B" set of partitions, since
798       after all they shall have the same properties and sizes as the "A" set.
799
800           # ln -s 50-root.conf /usr/lib/repart.d/70-root-b.conf
801           # ln -s 60-root-verity.conf /usr/lib/repart.d/80-root-verity-b.conf
802
803
804       Example 4. Create a data and verity partition from a OS tree
805
806       Assuming we have an OS tree at /var/tmp/os-tree that we want to package
807       in a root partition together with a matching verity partition, we can
808       do so as follows:
809
810           # 50-root.conf
811           [Partition]
812           Type=root
813           CopyFiles=/var/tmp/os-tree
814           Verity=data
815           VerityMatchKey=root
816
817           # 60-root-verity.conf
818           [Partition]
819           Type=root-verity
820           Verity=hash
821           VerityMatchKey=root
822
823

SEE ALSO

825       systemd(1), systemd-repart(8), sfdisk(8), systemd-cryptenroll(1)
826

NOTES

828        1. Discoverable Partitions Specification
829           https://uapi-group.org/specifications/specs/discoverable_partitions_specification
830
831
832
833systemd 254                                                        REPART.D(5)
Impressum