1REPART.D(5) repart.d REPART.D(5)
2
3
4
6 repart.d - Partition Definition Files for Automatic Boot-Time
7 Repartitioning
8
10 /etc/repart.d/*.conf
11 /run/repart.d/*.conf
12 /usr/lib/repart.d/*.conf
13
14
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 partitition 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
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 (32bit), arm64
63 (64bit, aka aarch64), ia64, loongarch64, mips-le, mips64-le,
64 parisc, ppc, ppc64, ppc64-le, riscv32, riscv64, s390, s390x,
65 tilegx, x86 (32bit, aka i386) and x86-64 (64bit, aka amd64). The
66 supported identifiers are:
67
68 Table 1. GPT partition type identifiers
69 ┌──────────────────────────┬────────────────────────────┐
70 │Identifier │ Explanation │
71 ├──────────────────────────┼────────────────────────────┤
72 │esp │ EFI System Partition │
73 ├──────────────────────────┼────────────────────────────┤
74 │xbootldr │ Extended Boot Loader │
75 │ │ Partition │
76 ├──────────────────────────┼────────────────────────────┤
77 │swap │ Swap partition │
78 ├──────────────────────────┼────────────────────────────┤
79 │home │ Home (/home/) partition │
80 ├──────────────────────────┼────────────────────────────┤
81 │srv │ Server data (/srv/) │
82 │ │ partition │
83 ├──────────────────────────┼────────────────────────────┤
84 │var │ Variable data (/var/) │
85 │ │ partition │
86 ├──────────────────────────┼────────────────────────────┤
87 │tmp │ Temporary data (/var/tmp/) │
88 │ │ partition │
89 ├──────────────────────────┼────────────────────────────┤
90 │linux-generic │ Generic Linux file system │
91 │ │ partition │
92 ├──────────────────────────┼────────────────────────────┤
93 │root │ 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 ├──────────────────────────┼────────────────────────────┤
101 │root-verity │ Verity data for the root │
102 │ │ file system partition for │
103 │ │ the local architecture │
104 ├──────────────────────────┼────────────────────────────┤
105 │root-verity-sig │ Verity signature data for │
106 │ │ the root file system │
107 │ │ partition for the local │
108 │ │ architecture │
109 ├──────────────────────────┼────────────────────────────┤
110 │root-secondary │ Root file system partition │
111 │ │ of the secondary │
112 │ │ architecture of the local │
113 │ │ architecture (usually the │
114 │ │ matching 32bit │
115 │ │ architecture for the local │
116 │ │ 64bit architecture) │
117 ├──────────────────────────┼────────────────────────────┤
118 │root-secondary-verity │ Verity data for the root │
119 │ │ file system partition of │
120 │ │ the secondary architecture │
121 ├──────────────────────────┼────────────────────────────┤
122 │root-secondary-verity-sig │ Verity signature data for │
123 │ │ the root file system │
124 │ │ partition of the secondary │
125 │ │ architecture │
126 ├──────────────────────────┼────────────────────────────┤
127 │root-{arch} │ Root file system partition │
128 │ │ of the given architecture │
129 │ │ (such as root-x86-64 or │
130 │ │ root-riscv64) │
131 ├──────────────────────────┼────────────────────────────┤
132 │root-{arch}-verity │ Verity data for the root │
133 │ │ file system partition of │
134 │ │ the given architecture │
135 ├──────────────────────────┼────────────────────────────┤
136 │root-{arch}-verity-sig │ Verity signature data for │
137 │ │ the root file system │
138 │ │ partition of the given │
139 │ │ architecture │
140 ├──────────────────────────┼────────────────────────────┤
141 │usr │ /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 ├──────────────────────────┼────────────────────────────┤
150 │usr-verity │ Verity data for the /usr/ │
151 │ │ file system partition for │
152 │ │ the local architecture │
153 ├──────────────────────────┼────────────────────────────┤
154 │usr-verity-sig │ Verity signature data for │
155 │ │ the /usr/ file system │
156 │ │ partition for the local │
157 │ │ architecture │
158 ├──────────────────────────┼────────────────────────────┤
159 │usr-secondary │ /usr/ file system │
160 │ │ partition of the secondary │
161 │ │ architecture of the local │
162 │ │ architecture (usually the │
163 │ │ matching 32bit │
164 │ │ architecture for the local │
165 │ │ 64bit architecture) │
166 ├──────────────────────────┼────────────────────────────┤
167 │usr-secondary-verity │ Verity data for the /usr/ │
168 │ │ file system partition of │
169 │ │ the secondary architecture │
170 ├──────────────────────────┼────────────────────────────┤
171 │usr-secondary-verity-sig │ Verity signature data for │
172 │ │ the /usr/ file system │
173 │ │ partition of the secondary │
174 │ │ architecture │
175 ├──────────────────────────┼────────────────────────────┤
176 │usr-{arch} │ /usr/ file system │
177 │ │ partition of the given │
178 │ │ architecture │
179 ├──────────────────────────┼────────────────────────────┤
180 │usr-{arch}-verity │ Verity data for the /usr/ │
181 │ │ file system partition of │
182 │ │ the given architecture │
183 ├──────────────────────────┼────────────────────────────┤
184 │usr-{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 "ext4", but this may change
361 in the future). This option may be used multiple times to copy
362 multiple files or directories from host into the newly formatted
363 file system. The colon and second path may be omitted in which case
364 the source path is also used as the target path (relative to the
365 root of the newly created file system). If the source path refers
366 to a directory it is copied recursively.
367
368 This option has no effect if the partition already exists: it
369 cannot be used to copy additional files into an existing partition,
370 it may only be used to populate a file system created anew.
371
372 The copy operation is executed before the file system is registered
373 in the partition table, thus ensuring that a file system populated
374 this way only ever exists fully initialized.
375
376 Note that CopyFiles= will skip copying files that aren't supported
377 by the target filesystem (e.g symlinks, fifos, sockets and devices
378 on vfat). When an unsupported file type is encountered,
379 systemd-repart will skip copying this file and write a log message
380 about it.
381
382 Note that systemd-repart does not change the UIDs/GIDs of any
383 copied files and directories. When running systemd-repart as an
384 unprivileged user to build an image of files and directories owned
385 by the same user, you can run systemd-repart in a user namespace
386 with the current user mapped to the root user to make sure the
387 files and directories in the image are owned by the root user.
388
389 Note that when populating XFS filesystems with systemd-repart and
390 loop devices are not available, populating XFS filesystems with
391 files containing spaces, tabs or newlines will fail due to
392 limitations of mkfs.xfs(8) protofile format.
393
394 Note that when populating XFS filesystems with systemd-repart and
395 loop devices are not available, extended attributes will not be
396 copied into generated XFS filesystems due to limitations
397 mkfs.xfs(8)'s protofile format.
398
399 This option cannot be combined with CopyBlocks=.
400
401 When systemd-repart(8) is invoked with the --image= or --root=
402 command line switches the source paths specified are taken relative
403 to the specified root directory or disk image root.
404
405 MakeDirectories=
406 Takes one or more absolute paths, separated by whitespace, each
407 declaring a directory to create within the new file system.
408 Behaviour is similar to CopyFiles=, but instead of copying in a set
409 of files this just creates the specified directories with the
410 default mode of 0755 owned by the root user and group, plus all
411 their parent directories (with the same ownership and access mode).
412 To configure directories with different ownership or access mode,
413 use CopyFiles= and specify a source tree to copy containing
414 appropriately owned/configured directories. This option may be used
415 more than once to create multiple directories. When CopyFiles= and
416 MakeDirectories= are used together the former is applied first. If
417 a directory listed already exists no operation is executed (in
418 particular, the ownership/access mode of the directories is left as
419 is).
420
421 The primary usecase for this option is to create a minimal set of
422 directories that may be mounted over by other partitions contained
423 in the same disk image. For example, a disk image where the root
424 file system is formatted at first boot might want to automatically
425 pre-create /usr/ in it this way, so that the "usr" partition may
426 over-mount it.
427
428 Consider using systemd-tmpfiles(8) with its --image= option to
429 pre-create other, more complex directory hierarchies (as well as
430 other inodes) with fine-grained control of ownership, access modes
431 and other file attributes.
432
433 Encrypt=
434 Takes one of "off", "key-file", "tpm2" and "key-file+tpm2"
435 (alternatively, also accepts a boolean value, which is mapped to
436 "off" when false, and "key-file" when true). Defaults to "off". If
437 not "off" the partition will be formatted with a LUKS2 superblock,
438 before the blocks configured with CopyBlocks= are copied in or the
439 file system configured with Format= is created.
440
441 The LUKS2 UUID is automatically derived from the partition UUID in
442 a stable fashion. If "key-file" or "key-file+tpm2" is used, a key
443 is added to the LUKS2 superblock, configurable with the --key-file=
444 option to systemd-repart. If "tpm2" or "key-file+tpm2" is used, a
445 key is added to the LUKS2 superblock that is enrolled to the local
446 TPM2 chip, as configured with the --tpm2-device= and --tpm2-pcrs=
447 options to systemd-repart.
448
449 When used this slightly alters the size allocation logic as the
450 implicit, minimal size limits of Format= and CopyBlocks= are
451 increased by the space necessary for the LUKS2 superblock (see
452 above).
453
454 This option has no effect if the partition already exists.
455
456 Verity=
457 Takes one of "off", "data", "hash" or "signature". Defaults to
458 "off". If set to "off" or "data", the partition is populated with
459 content as specified by CopyBlocks= or CopyFiles=. If set to
460 "hash", the partition will be populated with verity hashes from the
461 matching verity data partition. If set to "signature", the
462 partition will be populated with a JSON object containing a
463 signature of the verity root hash of the matching verity hash
464 partition.
465
466 A matching verity partition is a partition with the same verity
467 match key (as configured with VerityMatchKey=).
468
469 If not explicitly configured, the data partition's UUID will be set
470 to the first 128 bits of the verity root hash. Similarly, if not
471 configured, the hash partition's UUID will be set to the final 128
472 bits of the verity root hash. The verity root hash itself will be
473 included in the output of systemd-repart.
474
475 This option has no effect if the partition already exists.
476
477 Usage of this option in combination with Encrypt= is not supported.
478
479 For each unique VerityMatchKey= value, a single verity data
480 partition ("Verity=data") and a single verity hash partition
481 ("Verity=hash") must be defined.
482
483 VerityMatchKey=
484 Takes a short, user-chosen identifier string. This setting is used
485 to find sibling verity partitions for the current verity partition.
486 See the description for Verity=.
487
488 FactoryReset=
489 Takes a boolean argument. If specified the partition is marked for
490 removal during a factory reset operation. This functionality is
491 useful to implement schemes where images can be reset into their
492 original state by removing partitions and creating them anew.
493 Defaults to off.
494
495 Flags=
496 Configures the 64bit GPT partition flags field to set for the
497 partition when creating it. This option has no effect if the
498 partition already exists. If not specified the flags values is set
499 to all zeroes, except for the three bits that can also be
500 configured via NoAuto=, ReadOnly= and GrowFileSystem=; see below
501 for details on the defaults for these three flags. Specify the
502 flags value in hexadecimal (by prefixing it with "0x"), binary
503 (prefix "0b") or decimal (no prefix).
504
505 NoAuto=, ReadOnly=, GrowFileSystem=
506 Configures the No-Auto, Read-Only and Grow-File-System partition
507 flags (bit 63, 60 and 59) of the partition table entry, as defined
508 by the Discoverable Partitions Specification[1]. Only available for
509 partition types supported by the specification. This option is a
510 friendly way to set bits 63, 60 and 59 of the partition flags value
511 without setting any of the other bits, and may be set via Flags=
512 too, see above.
513
514 If Flags= is used in conjunction with one or more of
515 NoAuto=/ReadOnly=/GrowFileSystem= the latter control the value of
516 the relevant flags, i.e. the high-level settings
517 NoAuto=/ReadOnly=/GrowFileSystem= override the relevant bits of the
518 low-level setting Flags=.
519
520 Note that the three flags affect only automatic partition mounting,
521 as implemented by systemd-gpt-auto-generator(8) or the --image=
522 option of various commands (such as systemd-nspawn(1)). It has no
523 effect on explicit mounts, such as those done via mount(8) or
524 fstab(5).
525
526 If both bit 50 and 59 are set for a partition (i.e. the partition
527 is marked both read-only and marked for file system growing) the
528 latter is typically without effect: the read-only flag takes
529 precedence in most tools reading these flags, and since growing the
530 file system involves writing to the partition it is consequently
531 ignored.
532
533 NoAuto= defaults to off. ReadOnly= defaults to on for Verity
534 partition types, and off for all others. GrowFileSystem= defaults
535 to on for all partition types that support it, except if the
536 partition is marked read-only (and thus effectively, defaults to
537 off for Verity partitions).
538
539 SplitName=
540 Configures the suffix to append to split artifacts when the --split
541 option of systemd-repart(8) is used. Simple specifier expansion is
542 supported, see below. Defaults to "%t". To disable split artifact
543 generation for a partition, set SplitName= to "-".
544
545 Minimize=
546 Takes one of "off", "best", and "guess" (alternatively, also
547 accepts a boolean value, which is mapped to "off" when false, and
548 "best" when true). Defaults to "off". If set to "best", the
549 partition will have the minimal size required to store the sources
550 configured with CopyFiles=. "best" is currently only supported for
551 read-only filesystems. If set to "guess", the partition is created
552 at least as big as required to store the sources configured with
553 CopyFiles=. Note that unless the filesystem is a read-only
554 filesystem, systemd-repart will have to populate the filesystem
555 twice to guess the minimal required size, so enabling this option
556 might slow down repart when populating large partitions.
557
559 Specifiers may be used in the Label=, CopyBlocks=, CopyFiles=,
560 MakeDirectories=, SplitName= settings. The following expansions are
561 understood:
562
563 Table 2. Specifiers available
564 ┌──────────┬─────────────────────┬────────────────────────┐
565 │Specifier │ Meaning │ Details │
566 ├──────────┼─────────────────────┼────────────────────────┤
567 │"%a" │ Architecture │ A short string │
568 │ │ │ identifying the │
569 │ │ │ architecture of the │
570 │ │ │ local system. A │
571 │ │ │ string such as x86, │
572 │ │ │ x86-64 or arm64. │
573 │ │ │ See the │
574 │ │ │ architectures │
575 │ │ │ defined for │
576 │ │ │ ConditionArchitecture= │
577 │ │ │ in systemd.unit(5) │
578 │ │ │ for a full list. │
579 ├──────────┼─────────────────────┼────────────────────────┤
580 │"%A" │ Operating system │ The operating system │
581 │ │ image version │ image version │
582 │ │ │ identifier of the │
583 │ │ │ running system, as │
584 │ │ │ read from the │
585 │ │ │ IMAGE_VERSION= field │
586 │ │ │ of /etc/os-release. If │
587 │ │ │ not set, resolves to │
588 │ │ │ an empty string. See │
589 │ │ │ os-release(5) for more │
590 │ │ │ information. │
591 ├──────────┼─────────────────────┼────────────────────────┤
592 │"%b" │ Boot ID │ The boot ID of the │
593 │ │ │ running system, │
594 │ │ │ formatted as string. │
595 │ │ │ See random(4) for more │
596 │ │ │ information. │
597 ├──────────┼─────────────────────┼────────────────────────┤
598 │"%B" │ Operating system │ The operating system │
599 │ │ build ID │ build identifier of │
600 │ │ │ the running system, as │
601 │ │ │ read from the │
602 │ │ │ BUILD_ID= field of │
603 │ │ │ /etc/os-release. If │
604 │ │ │ not set, resolves to │
605 │ │ │ an empty string. See │
606 │ │ │ os-release(5) for more │
607 │ │ │ information. │
608 ├──────────┼─────────────────────┼────────────────────────┤
609 │"%H" │ Host name │ The hostname of the │
610 │ │ │ running system. │
611 ├──────────┼─────────────────────┼────────────────────────┤
612 │"%l" │ Short host name │ The hostname of the │
613 │ │ │ running system, │
614 │ │ │ truncated at the first │
615 │ │ │ dot to remove any │
616 │ │ │ domain component. │
617 ├──────────┼─────────────────────┼────────────────────────┤
618 │"%m" │ Machine ID │ The machine ID of the │
619 │ │ │ running system, │
620 │ │ │ formatted as string. │
621 │ │ │ See machine-id(5) for │
622 │ │ │ more information. │
623 ├──────────┼─────────────────────┼────────────────────────┤
624 │"%M" │ Operating system │ The operating system │
625 │ │ image identifier │ image identifier of │
626 │ │ │ the running system, as │
627 │ │ │ read from the │
628 │ │ │ IMAGE_ID= field of │
629 │ │ │ /etc/os-release. If │
630 │ │ │ not set, resolves to │
631 │ │ │ an empty string. See │
632 │ │ │ os-release(5) for more │
633 │ │ │ information. │
634 ├──────────┼─────────────────────┼────────────────────────┤
635 │"%o" │ Operating system ID │ The operating system │
636 │ │ │ identifier of the │
637 │ │ │ running system, as │
638 │ │ │ read from the ID= │
639 │ │ │ field of │
640 │ │ │ /etc/os-release. See │
641 │ │ │ os-release(5) for more │
642 │ │ │ information. │
643 ├──────────┼─────────────────────┼────────────────────────┤
644 │"%v" │ Kernel release │ Identical to uname -r │
645 │ │ │ output. │
646 ├──────────┼─────────────────────┼────────────────────────┤
647 │"%w" │ Operating system │ The operating system │
648 │ │ version ID │ version identifier of │
649 │ │ │ the running system, as │
650 │ │ │ read from the │
651 │ │ │ VERSION_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 │"%W" │ Operating system │ The operating system │
659 │ │ variant ID │ variant identifier of │
660 │ │ │ the running system, as │
661 │ │ │ read from the │
662 │ │ │ VARIANT_ID= field of │
663 │ │ │ /etc/os-release. If │
664 │ │ │ not set, resolves to │
665 │ │ │ an empty string. See │
666 │ │ │ os-release(5) for more │
667 │ │ │ information. │
668 ├──────────┼─────────────────────┼────────────────────────┤
669 │"%T" │ Directory for │ This is either /tmp or │
670 │ │ temporary files │ the path "$TMPDIR", │
671 │ │ │ "$TEMP" or "$TMP" are │
672 │ │ │ set to. (Note that the │
673 │ │ │ directory may be │
674 │ │ │ specified without a │
675 │ │ │ trailing slash.) │
676 ├──────────┼─────────────────────┼────────────────────────┤
677 │"%V" │ Directory for │ This is either │
678 │ │ larger and │ /var/tmp or the path │
679 │ │ persistent │ "$TMPDIR", "$TEMP" or │
680 │ │ temporary files │ "$TMP" are set to. │
681 │ │ │ (Note that the │
682 │ │ │ directory may be │
683 │ │ │ specified without a │
684 │ │ │ trailing slash.) │
685 ├──────────┼─────────────────────┼────────────────────────┤
686 │"%%" │ Single percent sign │ Use "%%" in place of │
687 │ │ │ "%" to specify a │
688 │ │ │ single percent sign. │
689 └──────────┴─────────────────────┴────────────────────────┘
690
691 Additionally, for the SplitName= setting, the following specifiers are
692 also understood:
693
694 Table 3. Specifiers available
695 ┌──────────┬─────────────────────┬─────────────────────┐
696 │Specifier │ Meaning │ Details │
697 ├──────────┼─────────────────────┼─────────────────────┤
698 │"%T" │ Partition Type UUID │ The partition type │
699 │ │ │ UUID, as configured │
700 │ │ │ with Type= │
701 ├──────────┼─────────────────────┼─────────────────────┤
702 │"%t" │ Partition Type │ The partition type │
703 │ │ Identifier │ identifier │
704 │ │ │ corresponding to │
705 │ │ │ the partition type │
706 │ │ │ UUID │
707 ├──────────┼─────────────────────┼─────────────────────┤
708 │"%U" │ Partition UUID │ The partition UUID, │
709 │ │ │ as configured with │
710 │ │ │ UUID= │
711 ├──────────┼─────────────────────┼─────────────────────┤
712 │"%n" │ Partition Number │ The partition │
713 │ │ │ number assigned to │
714 │ │ │ the partition │
715 └──────────┴─────────────────────┴─────────────────────┘
716
718 Example 1. Grow the root partition to the full disk size at first boot
719
720 With the following file the root partition is automatically grown to
721 the full disk if possible during boot.
722
723 # /usr/lib/repart.d/50-root.conf
724 [Partition]
725 Type=root
726
727
728 Example 2. Create a swap and home partition automatically on boot, if
729 missing
730
731 The home partition gets all available disk space while the swap
732 partition gets 1G at most and 64M at least. We set a priority > 0 on
733 the swap partition to ensure the swap partition is not used if not
734 enough space is available. For every three bytes assigned to the home
735 partition the swap partition gets assigned one.
736
737 # /usr/lib/repart.d/60-home.conf
738 [Partition]
739 Type=home
740
741 # /usr/lib/repart.d/70-swap.conf
742 [Partition]
743 Type=swap
744 SizeMinBytes=64M
745 SizeMaxBytes=1G
746 Priority=1
747 Weight=333
748
749
750 Example 3. Create B partitions in an A/B Verity setup, if missing
751
752 Let's say the vendor intends to update OS images in an A/B setup, i.e.
753 with two root partitions (and two matching Verity partitions) that
754 shall be used alternatingly during upgrades. To minimize image sizes
755 the original image is shipped only with one root and one Verity
756 partition (the "A" set), and the second root and Verity partitions (the
757 "B" set) shall be created on first boot on the free space on the
758 medium.
759
760 # /usr/lib/repart.d/50-root.conf
761 [Partition]
762 Type=root
763 SizeMinBytes=512M
764 SizeMaxBytes=512M
765
766 # /usr/lib/repart.d/60-root-verity.conf
767 [Partition]
768 Type=root-verity
769 SizeMinBytes=64M
770 SizeMaxBytes=64M
771
772 The definitions above cover the "A" set of root partition (of a fixed
773 512M size) and Verity partition for the root partition (of a fixed 64M
774 size). Let's use symlinks to create the "B" set of partitions, since
775 after all they shall have the same properties and sizes as the "A" set.
776
777 # ln -s 50-root.conf /usr/lib/repart.d/70-root-b.conf
778 # ln -s 60-root-verity.conf /usr/lib/repart.d/80-root-verity-b.conf
779
780
781 Example 4. Create a data and verity partition from a OS tree
782
783 Assuming we have an OS tree at /var/tmp/os-tree that we want to package
784 in a root partition together with a matching verity partition, we can
785 do so as follows:
786
787 # 50-root.conf
788 [Partition]
789 Type=root
790 CopyFiles=/var/tmp/os-tree
791 Verity=data
792 VerityMatchKey=root
793
794 # 60-root-verity.conf
795 [Partition]
796 Type=root-verity
797 Verity=hash
798 VerityMatchKey=root
799
800
802 systemd(1), systemd-repart(8), sfdisk(8), systemd-cryptenroll(1)
803
805 1. Discoverable Partitions Specification
806 https://uapi-group.org/specifications/specs/discoverable_partitions_specification
807
808
809
810systemd 253 REPART.D(5)