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 one of
61 the following special identifiers:
62
63 Table 1. GPT partition type identifiers
64 ┌──────────────────────┬────────────────────────────┐
65 │Identifier │ Explanation │
66 ├──────────────────────┼────────────────────────────┤
67 │esp │ EFI System Partition │
68 ├──────────────────────┼────────────────────────────┤
69 │xbootldr │ Extended Boot Loader │
70 │ │ Partition │
71 ├──────────────────────┼────────────────────────────┤
72 │swap │ Swap partition │
73 ├──────────────────────┼────────────────────────────┤
74 │home │ Home (/home/) partition │
75 ├──────────────────────┼────────────────────────────┤
76 │srv │ Server data (/srv/) │
77 │ │ partition │
78 ├──────────────────────┼────────────────────────────┤
79 │var │ Variable data (/var/) │
80 │ │ partition │
81 ├──────────────────────┼────────────────────────────┤
82 │tmp │ Temporary data (/var/tmp/) │
83 │ │ partition │
84 ├──────────────────────┼────────────────────────────┤
85 │linux-generic │ Generic Linux file system │
86 │ │ partition │
87 ├──────────────────────┼────────────────────────────┤
88 │root │ Root file system partition │
89 │ │ type appropriate for the │
90 │ │ local architecture (an │
91 │ │ alias for an architecture │
92 │ │ root file system partition │
93 │ │ type listed below, e.g. │
94 │ │ root-x86-64) │
95 ├──────────────────────┼────────────────────────────┤
96 │root-verity │ Verity data for the root │
97 │ │ file system partition for │
98 │ │ the local architecture │
99 ├──────────────────────┼────────────────────────────┤
100 │root-secondary │ Root file system partition │
101 │ │ of the secondary │
102 │ │ architecture of the local │
103 │ │ architecture (usually the │
104 │ │ matching 32bit │
105 │ │ architecture for the local │
106 │ │ 64bit architecture) │
107 ├──────────────────────┼────────────────────────────┤
108 │root-secondary-verity │ Verity data for the root │
109 │ │ file system partition of │
110 │ │ the secondary architecture │
111 ├──────────────────────┼────────────────────────────┤
112 │root-x86 │ Root file system partition │
113 │ │ for the x86 (32bit, aka │
114 │ │ i386) architecture │
115 ├──────────────────────┼────────────────────────────┤
116 │root-x86-verity │ Verity data for the x86 │
117 │ │ (32bit) root file system │
118 │ │ partition │
119 ├──────────────────────┼────────────────────────────┤
120 │root-x86-64 │ Root file system partition │
121 │ │ for the x86_64 (64bit, aka │
122 │ │ amd64) architecture │
123 ├──────────────────────┼────────────────────────────┤
124 │root-x86-64-verity │ Verity data for the x86_64 │
125 │ │ (64bit) root file system │
126 │ │ partition │
127 ├──────────────────────┼────────────────────────────┤
128 │root-arm │ Root file system partition │
129 │ │ for the ARM (32bit) │
130 │ │ architecture │
131 ├──────────────────────┼────────────────────────────┤
132 │root-arm-verity │ Verity data for the ARM │
133 │ │ (32bit) root file system │
134 │ │ partition │
135 ├──────────────────────┼────────────────────────────┤
136 │root-arm64 │ Root file system partition │
137 │ │ for the ARM (64bit, aka │
138 │ │ aarch64) architecture │
139 ├──────────────────────┼────────────────────────────┤
140 │root-arm64-verity │ Verity data for the ARM │
141 │ │ (64bit, aka aarch64) root │
142 │ │ file system partition │
143 ├──────────────────────┼────────────────────────────┤
144 │root-ia64 │ Root file system partition │
145 │ │ for the ia64 architecture │
146 ├──────────────────────┼────────────────────────────┤
147 │root-ia64-verity │ Verity data for the ia64 │
148 │ │ root file system partition │
149 ├──────────────────────┼────────────────────────────┤
150 │root-riscv32 │ Root file system partition │
151 │ │ for the RISC-V 32-bit │
152 │ │ architecture │
153 ├──────────────────────┼────────────────────────────┤
154 │root-riscv32-verity │ Verity data for the RISC-V │
155 │ │ 32-bit root file system │
156 │ │ partition │
157 ├──────────────────────┼────────────────────────────┤
158 │root-riscv64 │ Root file system partition │
159 │ │ for the RISC-V 64-bit │
160 │ │ architecture │
161 ├──────────────────────┼────────────────────────────┤
162 │root-riscv64-verity │ Verity data for the RISC-V │
163 │ │ 64-bit root file system │
164 │ │ partition │
165 ├──────────────────────┼────────────────────────────┤
166 │usr │ /usr/ file system │
167 │ │ partition type appropriate │
168 │ │ for the local architecture │
169 │ │ (an alias for an │
170 │ │ architecture /usr/ file │
171 │ │ system partition type │
172 │ │ listed below, e.g. │
173 │ │ usr-x86-64) │
174 ├──────────────────────┼────────────────────────────┤
175 │usr-verity │ Verity data for the /usr/ │
176 │ │ file system partition for │
177 │ │ the local architecture │
178 ├──────────────────────┼────────────────────────────┤
179 │usr-secondary │ /usr/ file system │
180 │ │ partition of the secondary │
181 │ │ architecture of the local │
182 │ │ architecture (usually the │
183 │ │ matching 32bit │
184 │ │ architecture for the local │
185 │ │ 64bit architecture) │
186 ├──────────────────────┼────────────────────────────┤
187 │usr-secondary-verity │ Verity data for the /usr/ │
188 │ │ file system partition of │
189 │ │ the secondary architecture │
190 ├──────────────────────┼────────────────────────────┤
191 │usr-x86 │ /usr/ file system │
192 │ │ partition for the x86 │
193 │ │ (32bit, aka i386) │
194 │ │ architecture │
195 ├──────────────────────┼────────────────────────────┤
196 │usr-x86-verity │ Verity data for the x86 │
197 │ │ (32bit) /usr/ file system │
198 │ │ partition │
199 ├──────────────────────┼────────────────────────────┤
200 │usr-x86-64 │ /usr/ file system │
201 │ │ partition for the x86_64 │
202 │ │ (64bit, aka amd64) │
203 │ │ architecture │
204 ├──────────────────────┼────────────────────────────┤
205 │usr-x86-64-verity │ Verity data for the x86_64 │
206 │ │ (64bit) /usr/ file system │
207 │ │ partition │
208 ├──────────────────────┼────────────────────────────┤
209 │usr-arm │ /usr/ file system │
210 │ │ partition for the ARM │
211 │ │ (32bit) architecture │
212 ├──────────────────────┼────────────────────────────┤
213 │usr-arm-verity │ Verity data for the ARM │
214 │ │ (32bit) /usr/ file system │
215 │ │ partition │
216 ├──────────────────────┼────────────────────────────┤
217 │usr-arm64 │ /usr/ file system │
218 │ │ partition for the ARM │
219 │ │ (64bit, aka aarch64) │
220 │ │ architecture │
221 ├──────────────────────┼────────────────────────────┤
222 │usr-arm64-verity │ Verity data for the ARM │
223 │ │ (64bit, aka aarch64) /usr/ │
224 │ │ file system partition │
225 ├──────────────────────┼────────────────────────────┤
226 │usr-ia64 │ /usr/ file system │
227 │ │ partition for the ia64 │
228 │ │ architecture │
229 ├──────────────────────┼────────────────────────────┤
230 │usr-ia64-verity │ Verity data for the ia64 │
231 │ │ /usr/ file system │
232 │ │ partition │
233 ├──────────────────────┼────────────────────────────┤
234 │usr-riscv32 │ /usr/ file system │
235 │ │ partition for the RISC-V │
236 │ │ 32-bit architecture │
237 ├──────────────────────┼────────────────────────────┤
238 │usr-riscv32-verity │ Verity data for the RISC-V │
239 │ │ 32-bit /usr/ file system │
240 │ │ partition │
241 ├──────────────────────┼────────────────────────────┤
242 │usr-riscv64 │ /usr/ file system │
243 │ │ partition for the RISC-V │
244 │ │ 64-bit architecture │
245 ├──────────────────────┼────────────────────────────┤
246 │usr-riscv64-verity │ Verity data for the RISC-V │
247 │ │ 64-bit /usr/ file system │
248 │ │ partition │
249 └──────────────────────┴────────────────────────────┘
250 This setting defaults to linux-generic.
251
252 Most of the partition type UUIDs listed above are defined in the
253 Discoverable Partitions Specification[1].
254
255 Label=
256 The textual label to assign to the partition if none is assigned
257 yet. Note that this setting is not used for matching. It is also
258 not used when a label is already set for an existing partition. It
259 is thus only used when a partition is newly created or when an
260 existing one had a no label set (that is: an empty label). If not
261 specified a label derived from the partition type is automatically
262 used. Simple specifier expansion is supported, see below.
263
264 UUID=
265 The UUID to assign to the partition if none is assigned yet. Note
266 that this setting is not used for matching. It is also not used
267 when a UUID is already set for an existing partition. It is thus
268 only used when a partition is newly created or when an existing one
269 had a all-zero UUID set. If not specified a UUID derived from the
270 partition type is automatically used.
271
272 Priority=
273 A numeric priority to assign to this partition, in the range
274 -2147483648...2147483647, with smaller values indicating higher
275 priority, and higher values indicating smaller priority. This
276 priority is used in case the configured size constraints on the
277 defined partitions do not permit fitting all partitions onto the
278 available disk space. If the partitions do not fit, the highest
279 numeric partition priority of all defined partitions is determined,
280 and all defined partitions with this priority are removed from the
281 list of new partitions to create (which may be multiple, if the
282 same priority is used for multiple partitions). The fitting
283 algorithm is then tried again. If the partitions still do not fit,
284 the now highest numeric partition priority is determined, and the
285 matching partitions removed too, and so on. Partitions of a
286 priority of 0 or lower are never removed. If all partitions with a
287 priority above 0 are removed and the partitions still do not fit on
288 the device the operation fails. Note that this priority has no
289 effect on ordering partitions, for that use the alphabetical order
290 of the filenames of the partition definition files. Defaults to 0.
291
292 Weight=
293 A numeric weight to assign to this partition in the range
294 0...1000000. Available disk space is assigned the defined
295 partitions according to their relative weights (subject to the size
296 constraints configured with SizeMinBytes=, SizeMaxBytes=), so that
297 a partition with weight 2000 gets double the space as one with
298 weight 1000, and a partition with weight 333 a third of that.
299 Defaults to 1000.
300
301 The Weight= setting is used to distribute available disk space in
302 an "elastic" fashion, based on the disk size and existing
303 partitions. If a partition shall have a fixed size use both
304 SizeMinBytes= and SizeMaxBytes= with the same value in order to
305 fixate the size to one value, in which case the weight has no
306 effect.
307
308 PaddingWeight=
309 Similar to Weight= but sets a weight for the free space after the
310 partition (the "padding"). When distributing available space the
311 weights of all partitions and all defined padding is summed, and
312 then each partition and padding gets the fraction defined by its
313 weight. Defaults to 0, i.e. by default no padding is applied.
314
315 Padding is useful if empty space shall be left for later additions
316 or a safety margin at the end of the device or between partitions.
317
318 SizeMinBytes=, SizeMaxBytes=
319 Specifies minimum and maximum size constraints in bytes. Takes the
320 usual K, M, G, T, ... suffixes (to the base of 1024). If
321 SizeMinBytes= is specified the partition is created at or grown to
322 at least the specified size. If SizeMaxBytes= is specified the
323 partition is created at or grown to at most the specified size. The
324 precise size is determined through the weight value value
325 configured with Weight=, see above. When SizeMinBytes= is set equal
326 to SizeMaxBytes= the configured weight has no effect as the
327 partition is explicitly sized to the specified fixed value. Note
328 that partitions are never created smaller than 4096 bytes, and
329 since partitions are never shrunk the previous size of the
330 partition (in case the partition already exists) is also enforced
331 as lower bound for the new size. The values should be specified as
332 multiples of 4096 bytes, and are rounded upwards (in case of
333 SizeMinBytes=) or downwards (in case of SizeMaxBytes=) otherwise.
334 If the backing device does not provide enough space to fulfill the
335 constraints placing the partition will fail. For partitions that
336 shall be created, depending on the setting of Priority= (see above)
337 the partition might be dropped and the placing algorithm restarted.
338 By default a minimum size constraint of 10M and no maximum size
339 constraint is set.
340
341 PaddingMinBytes=, PaddingMaxBytes=
342 Specifies minimum and maximum size constraints in bytes for the
343 free space after the partition (the "padding"). Semantics are
344 similar to SizeMinBytes= and SizeMaxBytes=, except that unlike
345 partition sizes free space can be shrunk and can be as small as
346 zero. By default no size constraints on padding are set, so that
347 only PaddingWeight= determines the size of the padding applied.
348
349 CopyBlocks=
350 Takes a path to a regular file, block device node or directory, or
351 the special value "auto". If specified and the partition is newly
352 created, the data from the specified path is written to the newly
353 created partition, on the block level. If a directory is specified,
354 the backing block device of the file system the directory is on is
355 determined, and the data read directly from that. This option is
356 useful to efficiently replicate existing file systems onto new
357 partitions on the block level — for example to build a simple OS
358 installer or an OS image builder.
359
360 If the special value "auto" is specified, the source to copy from
361 is automatically picked up from the running system (or the image
362 specified with --image= — if used). A partition that matches both
363 the configured partition type (as declared with Type= described
364 above), and the currently mounted directory appropriate for that
365 partition type is determined. For example, if the partition type is
366 set to "root" the partition backing the root directory (/) is used
367 as source to copy from — if its partition type is set to "root" as
368 well. If the declared type is "usr" the partition backing /usr/ is
369 used as source to copy blocks from — if its partition type is set
370 to "usr" too. The logic is capable of automatically tracking down
371 the backing partitions for encrypted and Verity-enabled volumes.
372 "CopyBlocks=auto" is useful for implementing "self-replicating"
373 systems, i.e. systems that are their own installer.
374
375 The file specified here must have a size that is a multiple of the
376 basic block size 512 and not be empty. If this option is used, the
377 size allocation algorithm is slightly altered: the partition is
378 created as least as big as required to fit the data in, i.e. the
379 data size is an additional minimum size value taken into
380 consideration for the allocation algorithm, similar to and in
381 addition to the SizeMin= value configured above.
382
383 This option has no effect if the partition it is declared for
384 already exists, i.e. existing data is never overwritten. Note that
385 the data is copied in before the partition table is updated, i.e.
386 before the partition actually is persistently created. This
387 provides robustness: it is guaranteed that the partition either
388 doesn't exist or exists fully populated; it is not possible that
389 the partition exists but is not or only partially populated.
390
391 This option cannot be combined with Format= or CopyFiles=.
392
393 Format=
394 Takes a file system name, such as "ext4", "btrfs", "xfs" or "vfat",
395 or the special value "swap". If specified and the partition is
396 newly created it is formatted with the specified file system (or as
397 swap device). The file system UUID and label are automatically
398 derived from the partition UUID and label. If this option is used,
399 the size allocation algorithm is slightly altered: the partition is
400 created as least as big as required for the minimal file system of
401 the specified type (or 4KiB if the minimal size is not known).
402
403 This option has no effect if the partition already exists.
404
405 Similar to the behaviour of CopyBlocks= the file system is
406 formatted before the partition is created, ensuring that the
407 partition only ever exists with a fully initialized file system.
408
409 This option cannot be combined with CopyBlocks=.
410
411 CopyFiles=
412 Takes a pair of colon separated absolute file system paths. The
413 first path refers to a source file or directory on the host, the
414 second path refers to a target in the file system of the newly
415 created partition and formatted file system. This setting may be
416 used to copy files or directories from the host into the file
417 system that is created due to the Format= option. If CopyFiles= is
418 used without Format= specified explicitly, "Format=" with a
419 suitable default is implied (currently "ext4", but this may change
420 in the future). This option may be used multiple times to copy
421 multiple files or directories from host into the newly formatted
422 file system. The colon and second path may be omitted in which case
423 the source path is also used as the target path (relative to the
424 root of the newly created file system). If the source path refers
425 to a directory it is copied recursively.
426
427 This option has no effect if the partition already exists: it
428 cannot be used to copy additional files into an existing partition,
429 it may only be used to populate a file system created anew.
430
431 The copy operation is executed before the file system is registered
432 in the partition table, thus ensuring that a file system populated
433 this way only ever exists fully initialized.
434
435 This option cannot be combined with CopyBlocks=.
436
437 When systemd-repart is invoked with the --image= or --root= command
438 line switches the source paths specified are taken relative to the
439 specified root directory or disk image root.
440
441 MakeDirectories=
442 Takes one or more absolute paths, separated by whitespace, each
443 declaring a directory to create within the new file system.
444 Behaviour is similar to CopyFiles=, but instead of copying in a set
445 of files this just creates the specified directories with the
446 default mode of 0755 owned by the root user and group, plus all
447 their parent directories (with the same ownership and access mode).
448 To configure directories with different ownership or access mode,
449 use CopyFiles= and specify a source tree to copy containing
450 appropriately owned/configured directories. This option may be used
451 more than once to create multiple directories. When CopyFiles= and
452 MakeDirectories= are used together the former is applied first. If
453 a directory listed already exists no operation is executed (in
454 particular, the ownership/access mode of the directories is left as
455 is).
456
457 The primary usecase for this option is to create a minimal set of
458 directories that may be mounted over by other partitions contained
459 in the same disk image. For example, a disk image where the root
460 file system is formatted at first boot might want to automatically
461 pre-create /usr/ in it this way, so that the "usr" partition may
462 over-mount it.
463
464 Consider using systemd-tmpfiles(8) with its --image= option to
465 pre-create other, more complex directory hierarchies (as well as
466 other inodes) with fine-grained control of ownership, access modes
467 and other file attributes.
468
469 Encrypt=
470 Takes one of "off", "key-file", "tpm2" and "key-file+tpm2"
471 (alternatively, also accepts a boolean value, which is mapped to
472 "off" when false, and "key-file" when true). Defaults to "off". If
473 not "off" the partition will be formatted with a LUKS2 superblock,
474 before the blocks configured with CopyBlocks= are copied in or the
475 file system configured with Format= is created.
476
477 The LUKS2 UUID is automatically derived from the partition UUID in
478 a stable fashion. If "key-file" or "key-file+tpm2" is used, a key
479 is added to the LUKS2 superblock, configurable with the --key-file=
480 option to systemd-repart. If "tpm2" or "key-file+tpm2" is used, a
481 key is added to the LUKS2 superblock that is enrolled to the local
482 TPM2 chip, as configured with the --tpm2-device= and --tpm2-pcrs=
483 options to systemd-repart.
484
485 When used this slightly alters the size allocation logic as the
486 implicit, minimal size limits of Format= and CopyBlocks= are
487 increased by the space necessary for the LUKS2 superblock (see
488 above).
489
490 This option has no effect if the partition already exists.
491
492 FactoryReset=
493 Takes a boolean argument. If specified the partition is marked for
494 removal during a factory reset operation. This functionality is
495 useful to implement schemes where images can be reset into their
496 original state by removing partitions and creating them anew.
497 Defaults to off.
498
499 Flags=
500 Configures the 64bit GPT partition flags field to set for the
501 partition when creating it. This option has no effect if the
502 partition already exists. If not specified the flags values is set
503 to all zeroes, except for the three bits that can also be
504 configured via NoAuto=, ReadOnly= and GrowFileSystem=; see below
505 for details on the defaults for these three flags. Specify the
506 flags value in hexadecimal (by prefixing it with "0x"), binary
507 (prefix "0b") or decimal (no prefix).
508
509 NoAuto=, ReadOnly=, GrowFileSystem=
510 Configures the No-Auto, Read-Only and Grow-File-System partition
511 flags (bit 63, 60 and 59) of the partition table entry, as defined
512 by the Discoverable Partitions Specification[1]. Only available for
513 partition types supported by the specification. This option is a
514 friendly way to set bits 63, 60 and 59 of the partition flags value
515 without setting any of the other bits, and may be set via Flags=
516 too, see above.
517
518 If Flags= is used in conjunction with one or more of
519 NoAuto=/ReadOnly=/GrowFileSystem= the latter control the value of
520 the relevant flags, i.e. the high-level settings
521 NoAuto=/ReadOnly=/GrowFileSystem= override the relevant bits of the
522 low-level setting Flags=.
523
524 Note that the three flags affect only automatic partition mounting,
525 as implemented by systemd-gpt-auto-generator(8) or the --image=
526 option of various commands (such as systemd-nspawn(1)). It has no
527 effect on explicit mounts, such as those done via mount(8) or
528 fstab(5).
529
530 If both bit 50 and 59 are set for a partition (i.e. the partition
531 is marked both read-only and marked for file system growing) the
532 latter is typically without effect: the read-only flag takes
533 precedence in most tools reading these flags, and since growing the
534 file system involves writing to the partition it is consequently
535 ignored.
536
537 NoAuto= defaults to off. ReadOnly= defaults to on for Verity
538 partition types, and off for all others. GrowFileSystem= defaults
539 to on for all partition types that support it, except if the
540 partition is marked read-only (and thus effectively, defaults to
541 off for Verity partitions).
542
544 Specifiers may be used in the Label=, CopyBlocks=, CopyFiles=,
545 MakeDirectories= settings. The following expansions are understood:
546
547 Table 2. Specifiers available
548 ┌──────────┬─────────────────────┬────────────────────────┐
549 │Specifier │ Meaning │ Details │
550 ├──────────┼─────────────────────┼────────────────────────┤
551 │"%a" │ Architecture │ A short string │
552 │ │ │ identifying the │
553 │ │ │ architecture of the │
554 │ │ │ local system. A │
555 │ │ │ string such as x86, │
556 │ │ │ x86-64 or arm64. │
557 │ │ │ See the │
558 │ │ │ architectures │
559 │ │ │ defined for │
560 │ │ │ ConditionArchitecture= │
561 │ │ │ in systemd.unit(5) │
562 │ │ │ for a full list. │
563 ├──────────┼─────────────────────┼────────────────────────┤
564 │"%A" │ Operating system │ The operating system │
565 │ │ image version │ image version │
566 │ │ │ identifier of the │
567 │ │ │ running system, as │
568 │ │ │ read from the │
569 │ │ │ IMAGE_VERSION= field │
570 │ │ │ of /etc/os-release. If │
571 │ │ │ not set, resolves to │
572 │ │ │ an empty string. See │
573 │ │ │ os-release(5) for more │
574 │ │ │ information. │
575 ├──────────┼─────────────────────┼────────────────────────┤
576 │"%b" │ Boot ID │ The boot ID of the │
577 │ │ │ running system, │
578 │ │ │ formatted as string. │
579 │ │ │ See random(4) for more │
580 │ │ │ information. │
581 ├──────────┼─────────────────────┼────────────────────────┤
582 │"%B" │ Operating system │ The operating system │
583 │ │ build ID │ build identifier of │
584 │ │ │ the running system, as │
585 │ │ │ read from the │
586 │ │ │ BUILD_ID= field of │
587 │ │ │ /etc/os-release. If │
588 │ │ │ not set, resolves to │
589 │ │ │ an empty string. See │
590 │ │ │ os-release(5) for more │
591 │ │ │ information. │
592 ├──────────┼─────────────────────┼────────────────────────┤
593 │"%H" │ Host name │ The hostname of the │
594 │ │ │ running system. │
595 ├──────────┼─────────────────────┼────────────────────────┤
596 │"%l" │ Short host name │ The hostname of the │
597 │ │ │ running system, │
598 │ │ │ truncated at the first │
599 │ │ │ dot to remove any │
600 │ │ │ domain component. │
601 ├──────────┼─────────────────────┼────────────────────────┤
602 │"%m" │ Machine ID │ The machine ID of the │
603 │ │ │ running system, │
604 │ │ │ formatted as string. │
605 │ │ │ See machine-id(5) for │
606 │ │ │ more information. │
607 ├──────────┼─────────────────────┼────────────────────────┤
608 │"%M" │ Operating system │ The operating system │
609 │ │ image identifier │ image identifier of │
610 │ │ │ the running system, as │
611 │ │ │ read from the │
612 │ │ │ IMAGE_ID= field of │
613 │ │ │ /etc/os-release. If │
614 │ │ │ not set, resolves to │
615 │ │ │ an empty string. See │
616 │ │ │ os-release(5) for more │
617 │ │ │ information. │
618 ├──────────┼─────────────────────┼────────────────────────┤
619 │"%o" │ Operating system ID │ The operating system │
620 │ │ │ identifier of the │
621 │ │ │ running system, as │
622 │ │ │ read from the ID= │
623 │ │ │ field of │
624 │ │ │ /etc/os-release. See │
625 │ │ │ os-release(5) for more │
626 │ │ │ information. │
627 ├──────────┼─────────────────────┼────────────────────────┤
628 │"%v" │ Kernel release │ Identical to uname -r │
629 │ │ │ output. │
630 ├──────────┼─────────────────────┼────────────────────────┤
631 │"%w" │ Operating system │ The operating system │
632 │ │ version ID │ version identifier of │
633 │ │ │ the running system, as │
634 │ │ │ read from the │
635 │ │ │ VERSION_ID= field of │
636 │ │ │ /etc/os-release. If │
637 │ │ │ not set, resolves to │
638 │ │ │ an empty string. See │
639 │ │ │ os-release(5) for more │
640 │ │ │ information. │
641 ├──────────┼─────────────────────┼────────────────────────┤
642 │"%W" │ Operating system │ The operating system │
643 │ │ variant ID │ variant identifier of │
644 │ │ │ the running system, as │
645 │ │ │ read from the │
646 │ │ │ VARIANT_ID= field of │
647 │ │ │ /etc/os-release. If │
648 │ │ │ not set, resolves to │
649 │ │ │ an empty string. See │
650 │ │ │ os-release(5) for more │
651 │ │ │ information. │
652 ├──────────┼─────────────────────┼────────────────────────┤
653 │"%T" │ Directory for │ This is either /tmp or │
654 │ │ temporary files │ the path "$TMPDIR", │
655 │ │ │ "$TEMP" or "$TMP" are │
656 │ │ │ set to. (Note that the │
657 │ │ │ directory may be │
658 │ │ │ specified without a │
659 │ │ │ trailing slash.) │
660 ├──────────┼─────────────────────┼────────────────────────┤
661 │"%V" │ Directory for │ This is either │
662 │ │ larger and │ /var/tmp or the path │
663 │ │ persistent │ "$TMPDIR", "$TEMP" or │
664 │ │ temporary files │ "$TMP" are set to. │
665 │ │ │ (Note that the │
666 │ │ │ directory may be │
667 │ │ │ specified without a │
668 │ │ │ trailing slash.) │
669 ├──────────┼─────────────────────┼────────────────────────┤
670 │"%%" │ Single percent sign │ Use "%%" in place of │
671 │ │ │ "%" to specify a │
672 │ │ │ single percent sign. │
673 └──────────┴─────────────────────┴────────────────────────┘
674
676 Example 1. Grow the root partition to the full disk size at first boot
677
678 With the following file the root partition is automatically grown to
679 the full disk if possible during boot.
680
681 # /usr/lib/repart.d/50-root.conf
682 [Partition]
683 Type=root
684
685
686 Example 2. Create a swap and home partition automatically on boot, if
687 missing
688
689 The home partition gets all available disk space while the swap
690 partition gets 1G at most and 64M at least. We set a priority > 0 on
691 the swap partition to ensure the swap partition is not used if not
692 enough space is available. For every three bytes assigned to the home
693 partition the swap partition gets assigned one.
694
695 # /usr/lib/repart.d/60-home.conf
696 [Partition]
697 Type=home
698
699 # /usr/lib/repart.d/70-swap.conf
700 [Partition]
701 Type=swap
702 SizeMinBytes=64M
703 SizeMaxBytes=1G
704 Priority=1
705 Weight=333
706
707
708 Example 3. Create B partitions in an A/B Verity setup, if missing
709
710 Let's say the vendor intends to update OS images in an A/B setup, i.e.
711 with two root partitions (and two matching Verity partitions) that
712 shall be used alternatingly during upgrades. To minimize image sizes
713 the original image is shipped only with one root and one Verity
714 partition (the "A" set), and the second root and Verity partitions (the
715 "B" set) shall be created on first boot on the free space on the
716 medium.
717
718 # /usr/lib/repart.d/50-root.conf
719 [Partition]
720 Type=root
721 SizeMinBytes=512M
722 SizeMaxBytes=512M
723
724 # /usr/lib/repart.d/60-root-verity.conf
725 [Partition]
726 Type=root-verity
727 SizeMinBytes=64M
728 SizeMaxBytes=64M
729
730 The definitions above cover the "A" set of root partition (of a fixed
731 512M size) and Verity partition for the root partition (of a fixed 64M
732 size). Let's use symlinks to create the "B" set of partitions, since
733 after all they shall have the same properties and sizes as the "A" set.
734
735 # ln -s 50-root.conf /usr/lib/repart.d/70-root-b.conf
736 # ln -s 60-root-verity.conf /usr/lib/repart.d/80-root-verity-b.conf
737
738
740 systemd(1), systemd-repart(8), sfdisk(8), systemd-cryptenroll(1)
741
743 1. Discoverable Partitions Specification
744 https://systemd.io/DISCOVERABLE_PARTITIONS
745
746
747
748systemd 249 REPART.D(5)