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