1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
|
'\" t
.TH "REPART\&.D" "5" "" "systemd 255" "repart.d"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
repart.d \- Partition Definition Files for Automatic Boot\-Time Repartitioning
.SH "SYNOPSIS"
.PP
.nf
/etc/repart\&.d/*\&.conf
/run/repart\&.d/*\&.conf
/usr/lib/repart\&.d/*\&.conf
.fi
.SH "DESCRIPTION"
.PP
repart\&.d/*\&.conf
files describe basic properties of partitions of block devices of the local system\&. They may be used to declare types, names and sizes of partitions that shall exist\&. The
\fBsystemd-repart\fR(8)
service reads these files and attempts to add new partitions currently missing and enlarge existing partitions according to these definitions\&. Operation is generally incremental, i\&.e\&. when applied, what exists already is left intact, and partitions are never shrunk, moved or deleted\&.
.PP
These definition files are useful for implementing operating system images that are prepared and delivered with minimally sized images (for example lacking any state or swap partitions), and which on first boot automatically take possession of any remaining disk space following a few basic rules\&.
.PP
Currently, support for partition definition files is only implemented for GPT partition tables\&.
.PP
Partition files are generally matched against any partitions already existing on disk in a simple algorithm: the partition files are sorted by their filename (ignoring the directory prefix), and then compared in order against existing partitions matching the same partition type UUID\&. Specifically, the first existing partition with a specific partition type UUID is assigned the first definition file with the same partition type UUID, and the second existing partition with a specific type UUID the second partition file with the same type UUID, and so on\&. Any left\-over partition files that have no matching existing partition are assumed to define new partition that shall be created\&. Such partitions are appended to the end of the partition table, in the order defined by their names utilizing the first partition slot greater than the highest slot number currently in use\&. Any existing partitions that have no matching partition file are left as they are\&.
.PP
Note that these definitions may only be used to create and initialize new partitions or to grow existing ones\&. In the latter case it will not grow the contained files systems however; separate mechanisms, such as
\fBsystemd-growfs\fR(8)
may be used to grow the file systems inside of these partitions\&. Partitions may also be marked for automatic growing via the
\fIGrowFileSystem=\fR
setting, in which case the file system is grown on first mount by tools that respect this flag\&. See below for details\&.
.SH "[PARTITION] SECTION OPTIONS"
.PP
\fIType=\fR
.RS 4
The GPT partition type UUID to match\&. This may be a GPT partition type UUID such as
\fB4f68bce3\-e8cd\-4db1\-96e7\-fbcaf984b709\fR, or an identifier\&. Architecture specific partition types can use one of these architecture identifiers:
\fBalpha\fR,
\fBarc\fR,
\fBarm\fR
(32\-bit),
\fBarm64\fR
(64\-bit, aka aarch64),
\fBia64\fR,
\fBloongarch64\fR,
\fBmips\-le\fR,
\fBmips64\-le\fR,
\fBparisc\fR,
\fBppc\fR,
\fBppc64\fR,
\fBppc64\-le\fR,
\fBriscv32\fR,
\fBriscv64\fR,
\fBs390\fR,
\fBs390x\fR,
\fBtilegx\fR,
\fBx86\fR
(32\-bit, aka i386) and
\fBx86\-64\fR
(64\-bit, aka amd64)\&.
.sp
The supported identifiers are:
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.B Table\ \&1.\ \&GPT partition type identifiers
.TS
allbox tab(:);
lB lB.
T{
Identifier
T}:T{
Explanation
T}
.T&
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l.
T{
\fBesp\fR
T}:T{
EFI System Partition
T}
T{
\fBxbootldr\fR
T}:T{
Extended Boot Loader Partition
T}
T{
\fBswap\fR
T}:T{
Swap partition
T}
T{
\fBhome\fR
T}:T{
Home (/home/) partition
T}
T{
\fBsrv\fR
T}:T{
Server data (/srv/) partition
T}
T{
\fBvar\fR
T}:T{
Variable data (/var/) partition
T}
T{
\fBtmp\fR
T}:T{
Temporary data (/var/tmp/) partition
T}
T{
\fBlinux\-generic\fR
T}:T{
Generic Linux file system partition
T}
T{
\fBroot\fR
T}:T{
Root file system partition type appropriate for the local architecture (an alias for an architecture root file system partition type listed below, e\&.g\&. \fBroot\-x86\-64\fR)
T}
T{
\fBroot\-verity\fR
T}:T{
Verity data for the root file system partition for the local architecture
T}
T{
\fBroot\-verity\-sig\fR
T}:T{
Verity signature data for the root file system partition for the local architecture
T}
T{
\fBroot\-secondary\fR
T}:T{
Root file system partition of the secondary architecture of the local architecture (usually the matching 32\-bit architecture for the local 64\-bit architecture)
T}
T{
\fBroot\-secondary\-verity\fR
T}:T{
Verity data for the root file system partition of the secondary architecture
T}
T{
\fBroot\-secondary\-verity\-sig\fR
T}:T{
Verity signature data for the root file system partition of the secondary architecture
T}
T{
\fBroot\-{arch}\fR
T}:T{
Root file system partition of the given architecture (such as \fBroot\-x86\-64\fR or \fBroot\-riscv64\fR)
T}
T{
\fBroot\-{arch}\-verity\fR
T}:T{
Verity data for the root file system partition of the given architecture
T}
T{
\fBroot\-{arch}\-verity\-sig\fR
T}:T{
Verity signature data for the root file system partition of the given architecture
T}
T{
\fBusr\fR
T}:T{
/usr/ file system partition type appropriate for the local architecture (an alias for an architecture /usr/ file system partition type listed below, e\&.g\&. \fBusr\-x86\-64\fR)
T}
T{
\fBusr\-verity\fR
T}:T{
Verity data for the /usr/ file system partition for the local architecture
T}
T{
\fBusr\-verity\-sig\fR
T}:T{
Verity signature data for the /usr/ file system partition for the local architecture
T}
T{
\fBusr\-secondary\fR
T}:T{
/usr/ file system partition of the secondary architecture of the local architecture (usually the matching 32\-bit architecture for the local 64\-bit architecture)
T}
T{
\fBusr\-secondary\-verity\fR
T}:T{
Verity data for the /usr/ file system partition of the secondary architecture
T}
T{
\fBusr\-secondary\-verity\-sig\fR
T}:T{
Verity signature data for the /usr/ file system partition of the secondary architecture
T}
T{
\fBusr\-{arch}\fR
T}:T{
/usr/ file system partition of the given architecture
T}
T{
\fBusr\-{arch}\-verity\fR
T}:T{
Verity data for the /usr/ file system partition of the given architecture
T}
T{
\fBusr\-{arch}\-verity\-sig\fR
T}:T{
Verity signature data for the /usr/ file system partition of the given architecture
T}
.TE
.sp 1
This setting defaults to
\fBlinux\-generic\fR\&.
.sp
Most of the partition type UUIDs listed above are defined in the
\m[blue]\fBDiscoverable Partitions Specification\fR\m[]\&\s-2\u[1]\d\s+2\&.
.sp
Added in version 245\&.
.RE
.PP
\fILabel=\fR
.RS 4
The textual label to assign to the partition if none is assigned yet\&. Note that this setting is not used for matching\&. It is also not used when a label is already set for an existing partition\&. It is thus only used when a partition is newly created or when an existing one had a no label set (that is: an empty label)\&. If not specified a label derived from the partition type is automatically used\&. Simple specifier expansion is supported, see below\&.
.sp
Added in version 245\&.
.RE
.PP
\fIUUID=\fR
.RS 4
The UUID to assign to the partition if none is assigned yet\&. Note that this setting is not used for matching\&. It is also not used when a UUID is already set for an existing partition\&. It is thus only used when a partition is newly created or when an existing one had a all\-zero UUID set\&. If set to
"null", the UUID is set to all zeroes\&. If not specified a UUID derived from the partition type is automatically used\&.
.sp
Added in version 246\&.
.RE
.PP
\fIPriority=\fR
.RS 4
A numeric priority to assign to this partition, in the range \-2147483648\&...2147483647, with smaller values indicating higher priority, and higher values indicating smaller priority\&. This priority is used in case the configured size constraints on the defined partitions do not permit fitting all partitions onto the available disk space\&. If the partitions do not fit, the highest numeric partition priority of all defined partitions is determined, and all defined partitions with this priority are removed from the list of new partitions to create (which may be multiple, if the same priority is used for multiple partitions)\&. The fitting algorithm is then tried again\&. If the partitions still do not fit, the now highest numeric partition priority is determined, and the matching partitions removed too, and so on\&. Partitions of a priority of 0 or lower are never removed\&. If all partitions with a priority above 0 are removed and the partitions still do not fit on the device the operation fails\&. Note that this priority has no effect on ordering partitions, for that use the alphabetical order of the filenames of the partition definition files\&. Defaults to 0\&.
.sp
Added in version 245\&.
.RE
.PP
\fIWeight=\fR
.RS 4
A numeric weight to assign to this partition in the range 0\&...1000000\&. Available disk space is assigned the defined partitions according to their relative weights (subject to the size constraints configured with
\fISizeMinBytes=\fR,
\fISizeMaxBytes=\fR), so that a partition with weight 2000 gets double the space as one with weight 1000, and a partition with weight 333 a third of that\&. Defaults to 1000\&.
.sp
The
\fIWeight=\fR
setting is used to distribute available disk space in an "elastic" fashion, based on the disk size and existing partitions\&. If a partition shall have a fixed size use both
\fISizeMinBytes=\fR
and
\fISizeMaxBytes=\fR
with the same value in order to fixate the size to one value, in which case the weight has no effect\&.
.sp
Added in version 245\&.
.RE
.PP
\fIPaddingWeight=\fR
.RS 4
Similar to
\fIWeight=\fR, but sets a weight for the free space after the partition (the "padding")\&. When distributing available space the weights of all partitions and all defined padding is summed, and then each partition and padding gets the fraction defined by its weight\&. Defaults to 0, i\&.e\&. by default no padding is applied\&.
.sp
Padding is useful if empty space shall be left for later additions or a safety margin at the end of the device or between partitions\&.
.sp
Added in version 245\&.
.RE
.PP
\fISizeMinBytes=\fR, \fISizeMaxBytes=\fR
.RS 4
Specifies minimum and maximum size constraints in bytes\&. Takes the usual K, M, G, T, \&... suffixes (to the base of 1024)\&. If
\fISizeMinBytes=\fR
is specified the partition is created at or grown to at least the specified size\&. If
\fISizeMaxBytes=\fR
is specified the partition is created at or grown to at most the specified size\&. The precise size is determined through the weight value configured with
\fIWeight=\fR, see above\&. When
\fISizeMinBytes=\fR
is set equal to
\fISizeMaxBytes=\fR
the configured weight has no effect as the partition is explicitly sized to the specified fixed value\&. Note that partitions are never created smaller than 4096 bytes, and since partitions are never shrunk the previous size of the partition (in case the partition already exists) is also enforced as lower bound for the new size\&. The values should be specified as multiples of 4096 bytes, and are rounded upwards (in case of
\fISizeMinBytes=\fR) or downwards (in case of
\fISizeMaxBytes=\fR) otherwise\&. If the backing device does not provide enough space to fulfill the constraints placing the partition will fail\&. For partitions that shall be created, depending on the setting of
\fIPriority=\fR
(see above) the partition might be dropped and the placing algorithm restarted\&. By default a minimum size constraint of 10M and no maximum size constraint is set\&.
.sp
Added in version 245\&.
.RE
.PP
\fIPaddingMinBytes=\fR, \fIPaddingMaxBytes=\fR
.RS 4
Specifies minimum and maximum size constraints in bytes for the free space after the partition (the "padding")\&. Semantics are similar to
\fISizeMinBytes=\fR
and
\fISizeMaxBytes=\fR, except that unlike partition sizes free space can be shrunk and can be as small as zero\&. By default no size constraints on padding are set, so that only
\fIPaddingWeight=\fR
determines the size of the padding applied\&.
.sp
Added in version 245\&.
.RE
.PP
\fICopyBlocks=\fR
.RS 4
Takes a path to a regular file, block device node or directory, or the special value
"auto"\&. If specified and the partition is newly created, the data from the specified path is written to the newly created partition, on the block level\&. If a directory is specified, the backing block device of the file system the directory is on is determined, and the data read directly from that\&. This option is useful to efficiently replicate existing file systems onto new partitions on the block level \(em for example to build a simple OS installer or an OS image builder\&.
.sp
If the special value
"auto"
is specified, the source to copy from is automatically picked up from the running system (or the image specified with
\fB\-\-image=\fR
\(em if used)\&. A partition that matches both the configured partition type (as declared with
\fIType=\fR
described above), and the currently mounted directory appropriate for that partition type is determined\&. For example, if the partition type is set to
"root"
the partition backing the root directory (/) is used as source to copy from \(em if its partition type is set to
"root"
as well\&. If the declared type is
"usr"
the partition backing
/usr/
is used as source to copy blocks from \(em if its partition type is set to
"usr"
too\&. The logic is capable of automatically tracking down the backing partitions for encrypted and Verity\-enabled volumes\&.
"CopyBlocks=auto"
is useful for implementing "self\-replicating" systems, i\&.e\&. systems that are their own installer\&.
.sp
The file specified here must have a size that is a multiple of the basic block size 512 and not be empty\&. If this option is used, the size allocation algorithm is slightly altered: the partition is created as least as big as required to fit the data in, i\&.e\&. the data size is an additional minimum size value taken into consideration for the allocation algorithm, similar to and in addition to the
\fISizeMin=\fR
value configured above\&.
.sp
This option has no effect if the partition it is declared for already exists, i\&.e\&. existing data is never overwritten\&. Note that the data is copied in before the partition table is updated, i\&.e\&. before the partition actually is persistently created\&. This provides robustness: it is guaranteed that the partition either doesn\*(Aqt exist or exists fully populated; it is not possible that the partition exists but is not or only partially populated\&.
.sp
This option cannot be combined with
\fIFormat=\fR
or
\fICopyFiles=\fR\&.
.sp
Added in version 246\&.
.RE
.PP
\fIFormat=\fR
.RS 4
Takes a file system name, such as
"ext4",
"btrfs",
"xfs",
"vfat",
"erofs",
"squashfs"
or the special value
"swap"\&. If specified and the partition is newly created it is formatted with the specified file system (or as swap device)\&. The file system UUID and label are automatically derived from the partition UUID and label\&. If this option is used, the size allocation algorithm is slightly altered: the partition is created as least as big as required for the minimal file system of the specified type (or 4KiB if the minimal size is not known)\&.
.sp
This option has no effect if the partition already exists\&.
.sp
Similarly to the behaviour of
\fICopyBlocks=\fR, the file system is formatted before the partition is created, ensuring that the partition only ever exists with a fully initialized file system\&.
.sp
This option cannot be combined with
\fICopyBlocks=\fR\&.
.sp
Added in version 247\&.
.RE
.PP
\fICopyFiles=\fR
.RS 4
Takes a pair of colon separated absolute file system paths\&. The first path refers to a source file or directory on the host, the second path refers to a target in the file system of the newly created partition and formatted file system\&. This setting may be used to copy files or directories from the host into the file system that is created due to the
\fIFormat=\fR
option\&. If
\fICopyFiles=\fR
is used without
\fIFormat=\fR
specified explicitly,
"Format="
with a suitable default is implied (currently
"vfat"
for
"ESP"
and
"XBOOTLDR"
partitions, and
"ext4"
otherwise, but this may change in the future)\&. This option may be used multiple times to copy multiple files or directories from host into the newly formatted file system\&. The colon and second path may be omitted in which case the source path is also used as the target path (relative to the root of the newly created file system)\&. If the source path refers to a directory it is copied recursively\&.
.sp
This option has no effect if the partition already exists: it cannot be used to copy additional files into an existing partition, it may only be used to populate a file system created anew\&.
.sp
The copy operation is executed before the file system is registered in the partition table, thus ensuring that a file system populated this way only ever exists fully initialized\&.
.sp
Note that
\fICopyFiles=\fR
will skip copying files that aren\*(Aqt supported by the target filesystem (e\&.g symlinks, fifos, sockets and devices on vfat)\&. When an unsupported file type is encountered,
\fBsystemd\-repart\fR
will skip copying this file and write a log message about it\&.
.sp
Note that
\fBsystemd\-repart\fR
does not change the UIDs/GIDs of any copied files and directories\&. When running
\fBsystemd\-repart\fR
as an unprivileged user to build an image of files and directories owned by the same user, you can run
\fBsystemd\-repart\fR
in a user namespace with the current user mapped to the root user to make sure the files and directories in the image are owned by the root user\&.
.sp
Note that when populating XFS filesystems with
\fBsystemd\-repart\fR
and loop devices are not available, populating XFS filesystems with files containing spaces, tabs or newlines might fail on old versions of
\fBmkfs.xfs\fR(8)
due to limitations of its protofile format\&.
.sp
Note that when populating XFS filesystems with
\fBsystemd\-repart\fR
and loop devices are not available, extended attributes will not be copied into generated XFS filesystems due to limitations
\fBmkfs.xfs\fR(8)\*(Aqs protofile format\&.
.sp
This option cannot be combined with
\fICopyBlocks=\fR\&.
.sp
When
\fBsystemd-repart\fR(8)
is invoked with the
\fB\-\-copy\-source=\fR
command line switch the file paths are taken relative to the specified directory\&. If
\fB\-\-copy\-source=\fR
is not used, but the
\fB\-\-image=\fR
or
\fB\-\-root=\fR
switches are used, the source paths are taken relative to the specified root directory or disk image root\&.
.sp
Added in version 247\&.
.RE
.PP
\fIExcludeFiles=\fR, \fIExcludeFilesTarget=\fR
.RS 4
Takes an absolute file system path referring to a source file or directory on the host\&. This setting may be used to exclude files or directories from the host from being copied into the file system when
\fICopyFiles=\fR
is used\&. This option may be used multiple times to exclude multiple files or directories from host from being copied into the newly formatted file system\&.
.sp
If the path is a directory and ends with
"/", only the directory\*(Aqs contents are excluded but not the directory itself\&. If the path is a directory and does not end with
"/", both the directory and its contents are excluded\&.
.sp
\fIExcludeFilesTarget=\fR
is like
\fIExcludeFiles=\fR
except that instead of excluding the path on the host from being copied into the partition, we exclude any files and directories from being copied into the given path in the partition\&.
.sp
When
\fBsystemd-repart\fR(8)
is invoked with the
\fB\-\-image=\fR
or
\fB\-\-root=\fR
command line switches the paths specified are taken relative to the specified root directory or disk image root\&.
.sp
Added in version 254\&.
.RE
.PP
\fIMakeDirectories=\fR
.RS 4
Takes one or more absolute paths, separated by whitespace, each declaring a directory to create within the new file system\&. Behaviour is similar to
\fICopyFiles=\fR, but instead of copying in a set of files this just creates the specified directories with the default mode of 0755 owned by the root user and group, plus all their parent directories (with the same ownership and access mode)\&. To configure directories with different ownership or access mode, use
\fICopyFiles=\fR
and specify a source tree to copy containing appropriately owned/configured directories\&. This option may be used more than once to create multiple directories\&. When
\fICopyFiles=\fR
and
\fIMakeDirectories=\fR
are used together the former is applied first\&. If a directory listed already exists no operation is executed (in particular, the ownership/access mode of the directories is left as is)\&.
.sp
The primary use case for this option is to create a minimal set of directories that may be mounted over by other partitions contained in the same disk image\&. For example, a disk image where the root file system is formatted at first boot might want to automatically pre\-create
/usr/
in it this way, so that the
"usr"
partition may over\-mount it\&.
.sp
Consider using
\fBsystemd-tmpfiles\fR(8)
with its
\fB\-\-image=\fR
option to pre\-create other, more complex directory hierarchies (as well as other inodes) with fine\-grained control of ownership, access modes and other file attributes\&.
.sp
Added in version 249\&.
.RE
.PP
\fISubvolumes=\fR
.RS 4
Takes one or more absolute paths, separated by whitespace, each declaring a directory that should be a subvolume within the new file system\&. This option may be used more than once to specify multiple directories\&. Note that this setting does not create the directories themselves, that can be configured with
\fIMakeDirectories=\fR
and
\fICopyFiles=\fR\&.
.sp
Note that this option only takes effect if the target filesystem supports subvolumes, such as
"btrfs"\&.
.sp
Note that due to limitations of
"mkfs\&.btrfs", this option is only supported when running with
\fB\-\-offline=no\fR\&.
.sp
Added in version 255\&.
.RE
.PP
\fIEncrypt=\fR
.RS 4
Takes one of
"off",
"key\-file",
"tpm2"
and
"key\-file+tpm2"
(alternatively, also accepts a boolean value, which is mapped to
"off"
when false, and
"key\-file"
when true)\&. Defaults to
"off"\&. If not
"off"
the partition will be formatted with a LUKS2 superblock, before the blocks configured with
\fICopyBlocks=\fR
are copied in or the file system configured with
\fIFormat=\fR
is created\&.
.sp
The LUKS2 UUID is automatically derived from the partition UUID in a stable fashion\&. If
"key\-file"
or
"key\-file+tpm2"
is used, a key is added to the LUKS2 superblock, configurable with the
\fB\-\-key\-file=\fR
option to
\fBsystemd\-repart\fR\&. If
"tpm2"
or
"key\-file+tpm2"
is used, a key is added to the LUKS2 superblock that is enrolled to the local TPM2 chip, as configured with the
\fB\-\-tpm2\-device=\fR
and
\fB\-\-tpm2\-pcrs=\fR
options to
\fBsystemd\-repart\fR\&.
.sp
When used this slightly alters the size allocation logic as the implicit, minimal size limits of
\fIFormat=\fR
and
\fICopyBlocks=\fR
are increased by the space necessary for the LUKS2 superblock (see above)\&.
.sp
This option has no effect if the partition already exists\&.
.sp
Added in version 247\&.
.RE
.PP
\fIVerity=\fR
.RS 4
Takes one of
"off",
"data",
"hash"
or
"signature"\&. Defaults to
"off"\&. If set to
"off"
or
"data", the partition is populated with content as specified by
\fICopyBlocks=\fR
or
\fICopyFiles=\fR\&. If set to
"hash", the partition will be populated with verity hashes from the matching verity data partition\&. If set to
"signature", the partition will be populated with a JSON object containing a signature of the verity root hash of the matching verity hash partition\&.
.sp
A matching verity partition is a partition with the same verity match key (as configured with
\fIVerityMatchKey=\fR)\&.
.sp
If not explicitly configured, the data partition\*(Aqs UUID will be set to the first 128 bits of the verity root hash\&. Similarly, if not configured, the hash partition\*(Aqs UUID will be set to the final 128 bits of the verity root hash\&. The verity root hash itself will be included in the output of
\fBsystemd\-repart\fR\&.
.sp
This option has no effect if the partition already exists\&.
.sp
Usage of this option in combination with
\fIEncrypt=\fR
is not supported\&.
.sp
For each unique
\fIVerityMatchKey=\fR
value, a single verity data partition ("Verity=data") and a single verity hash partition ("Verity=hash") must be defined\&.
.sp
Added in version 252\&.
.RE
.PP
\fIVerityMatchKey=\fR
.RS 4
Takes a short, user\-chosen identifier string\&. This setting is used to find sibling verity partitions for the current verity partition\&. See the description for
\fIVerity=\fR\&.
.sp
Added in version 252\&.
.RE
.PP
\fIVerityDataBlockSizeBytes=\fR
.RS 4
Configures the data block size of the generated verity hash partition\&. Must be between 512 and 4096 bytes and must be a power of 2\&. Defaults to the sector size if configured explicitly, or the underlying block device sector size, or 4K if systemd\-repart is not operating on a block device\&.
.sp
Added in version 255\&.
.RE
.PP
\fIVerityHashBlockSizeBytes=\fR
.RS 4
Configures the hash block size of the generated verity hash partition\&. Must be between 512 and 4096 bytes and must be a power of 2\&. Defaults to the sector size if configured explicitly, or the underlying block device sector size, or 4K if systemd\-repart is not operating on a block device\&.
.sp
Added in version 255\&.
.RE
.PP
\fIFactoryReset=\fR
.RS 4
Takes a boolean argument\&. If specified the partition is marked for removal during a factory reset operation\&. This functionality is useful to implement schemes where images can be reset into their original state by removing partitions and creating them anew\&. Defaults to off\&.
.sp
Added in version 245\&.
.RE
.PP
\fIFlags=\fR
.RS 4
Configures the 64\-bit GPT partition flags field to set for the partition when creating it\&. This option has no effect if the partition already exists\&. If not specified the flags values is set to all zeroes, except for the three bits that can also be configured via
\fINoAuto=\fR,
\fIReadOnly=\fR
and
\fIGrowFileSystem=\fR; see below for details on the defaults for these three flags\&. Specify the flags value in hexadecimal (by prefixing it with
"0x"), binary (prefix
"0b") or decimal (no prefix)\&.
.sp
Added in version 249\&.
.RE
.PP
\fINoAuto=\fR, \fIReadOnly=\fR, \fIGrowFileSystem=\fR
.RS 4
Configures the No\-Auto, Read\-Only and Grow\-File\-System partition flags (bit 63, 60 and 59) of the partition table entry, as defined by the
\m[blue]\fBDiscoverable Partitions Specification\fR\m[]\&\s-2\u[1]\d\s+2\&. Only available for partition types supported by the specification\&. This option is a friendly way to set bits 63, 60 and 59 of the partition flags value without setting any of the other bits, and may be set via
\fIFlags=\fR
too, see above\&.
.sp
If
\fIFlags=\fR
is used in conjunction with one or more of
\fINoAuto=\fR/\fIReadOnly=\fR/\fIGrowFileSystem=\fR
the latter control the value of the relevant flags, i\&.e\&. the high\-level settings
\fINoAuto=\fR/\fIReadOnly=\fR/\fIGrowFileSystem=\fR
override the relevant bits of the low\-level setting
\fIFlags=\fR\&.
.sp
Note that the three flags affect only automatic partition mounting, as implemented by
\fBsystemd-gpt-auto-generator\fR(8)
or the
\fB\-\-image=\fR
option of various commands (such as
\fBsystemd-nspawn\fR(1))\&. It has no effect on explicit mounts, such as those done via
\fBmount\fR(8)
or
\fBfstab\fR(5)\&.
.sp
If both bit 50 and 59 are set for a partition (i\&.e\&. the partition is marked both read\-only and marked for file system growing) the latter is typically without effect: the read\-only flag takes precedence in most tools reading these flags, and since growing the file system involves writing to the partition it is consequently ignored\&.
.sp
\fINoAuto=\fR
defaults to off\&.
\fIReadOnly=\fR
defaults to on for Verity partition types, and off for all others\&.
\fIGrowFileSystem=\fR
defaults to on for all partition types that support it, except if the partition is marked read\-only (and thus effectively, defaults to off for Verity partitions)\&.
.sp
Added in version 249\&.
.RE
.PP
\fISplitName=\fR
.RS 4
Configures the suffix to append to split artifacts when the
\fB\-\-split\fR
option of
\fBsystemd-repart\fR(8)
is used\&. Simple specifier expansion is supported, see below\&. Defaults to
"%t"\&. To disable split artifact generation for a partition, set
\fISplitName=\fR
to
"\-"\&.
.sp
Added in version 252\&.
.RE
.PP
\fIMinimize=\fR
.RS 4
Takes one of
"off",
"best", and
"guess"
(alternatively, also accepts a boolean value, which is mapped to
"off"
when false, and
"best"
when true)\&. Defaults to
"off"\&. If set to
"best", the partition will have the minimal size required to store the sources configured with
\fICopyFiles=\fR\&.
"best"
is currently only supported for read\-only filesystems\&. If set to
"guess", the partition is created at least as big as required to store the sources configured with
\fICopyFiles=\fR\&. Note that unless the filesystem is a read\-only filesystem,
\fBsystemd\-repart\fR
will have to populate the filesystem twice to guess the minimal required size, so enabling this option might slow down repart when populating large partitions\&.
.sp
Added in version 253\&.
.RE
.SH "SPECIFIERS"
.PP
Specifiers may be used in the
\fILabel=\fR,
\fICopyBlocks=\fR,
\fICopyFiles=\fR,
\fIMakeDirectories=\fR,
\fISplitName=\fR
settings\&. The following expansions are understood:
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.B Table\ \&2.\ \&Specifiers available
.TS
allbox tab(:);
lB lB lB.
T{
Specifier
T}:T{
Meaning
T}:T{
Details
T}
.T&
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l.
T{
"%a"
T}:T{
Architecture
T}:T{
A short string identifying the architecture of the local system\&. A string such as \fBx86\fR, \fBx86\-64\fR or \fBarm64\fR\&. See the architectures defined for \fIConditionArchitecture=\fR in \fBsystemd.unit\fR(5) for a full list\&.
T}
T{
"%A"
T}:T{
Operating system image version
T}:T{
The operating system image version identifier of the running system, as read from the \fIIMAGE_VERSION=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
T}
T{
"%b"
T}:T{
Boot ID
T}:T{
The boot ID of the running system, formatted as string\&. See \fBrandom\fR(4) for more information\&.
T}
T{
"%B"
T}:T{
Operating system build ID
T}:T{
The operating system build identifier of the running system, as read from the \fIBUILD_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
T}
T{
"%H"
T}:T{
Host name
T}:T{
The hostname of the running system\&.
T}
T{
"%l"
T}:T{
Short host name
T}:T{
The hostname of the running system, truncated at the first dot to remove any domain component\&.
T}
T{
"%m"
T}:T{
Machine ID
T}:T{
The machine ID of the running system, formatted as string\&. See \fBmachine-id\fR(5) for more information\&.
T}
T{
"%M"
T}:T{
Operating system image identifier
T}:T{
The operating system image identifier of the running system, as read from the \fIIMAGE_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
T}
T{
"%o"
T}:T{
Operating system ID
T}:T{
The operating system identifier of the running system, as read from the \fIID=\fR field of /etc/os\-release\&. See \fBos-release\fR(5) for more information\&.
T}
T{
"%v"
T}:T{
Kernel release
T}:T{
Identical to \fBuname \-r\fR output\&.
T}
T{
"%w"
T}:T{
Operating system version ID
T}:T{
The operating system version identifier of the running system, as read from the \fIVERSION_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
T}
T{
"%W"
T}:T{
Operating system variant ID
T}:T{
The operating system variant identifier of the running system, as read from the \fIVARIANT_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
T}
T{
"%T"
T}:T{
Directory for temporary files
T}:T{
This is either /tmp or the path "$TMPDIR", "$TEMP" or "$TMP" are set to\&. (Note that the directory may be specified without a trailing slash\&.)
T}
T{
"%V"
T}:T{
Directory for larger and persistent temporary files
T}:T{
This is either /var/tmp or the path "$TMPDIR", "$TEMP" or "$TMP" are set to\&. (Note that the directory may be specified without a trailing slash\&.)
T}
T{
"%%"
T}:T{
Single percent sign
T}:T{
Use "%%" in place of "%" to specify a single percent sign\&.
T}
.TE
.sp 1
.PP
Additionally, for the
\fISplitName=\fR
setting, the following specifiers are also understood:
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.B Table\ \&3.\ \&Specifiers available
.TS
allbox tab(:);
lB lB lB.
T{
Specifier
T}:T{
Meaning
T}:T{
Details
T}
.T&
l l l
l l l
l l l
l l l.
T{
"%T"
T}:T{
Partition Type UUID
T}:T{
The partition type UUID, as configured with \fIType=\fR
T}
T{
"%t"
T}:T{
Partition Type Identifier
T}:T{
The partition type identifier corresponding to the partition type UUID
T}
T{
"%U"
T}:T{
Partition UUID
T}:T{
The partition UUID, as configured with \fIUUID=\fR
T}
T{
"%n"
T}:T{
Partition Number
T}:T{
The partition number assigned to the partition
T}
.TE
.sp 1
.SH "EXAMPLES"
.PP
\fBExample\ \&1.\ \&Grow the root partition to the full disk size at first boot\fR
.PP
With the following file the root partition is automatically grown to the full disk if possible during boot\&.
.PP
.if n \{\
.RS 4
.\}
.nf
# /usr/lib/repart\&.d/50\-root\&.conf
[Partition]
Type=root
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&2.\ \&Create a swap and home partition automatically on boot, if missing\fR
.PP
The home partition gets all available disk space while the swap partition gets 1G at most and 64M at least\&. We set a priority > 0 on the swap partition to ensure the swap partition is not used if not enough space is available\&. For every three bytes assigned to the home partition the swap partition gets assigned one\&.
.PP
.if n \{\
.RS 4
.\}
.nf
# /usr/lib/repart\&.d/60\-home\&.conf
[Partition]
Type=home
.fi
.if n \{\
.RE
.\}
.PP
.if n \{\
.RS 4
.\}
.nf
# /usr/lib/repart\&.d/70\-swap\&.conf
[Partition]
Type=swap
SizeMinBytes=64M
SizeMaxBytes=1G
Priority=1
Weight=333
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&3.\ \&Create B partitions in an A/B Verity setup, if missing\fR
.PP
Let\*(Aqs say the vendor intends to update OS images in an A/B setup, i\&.e\&. with two root partitions (and two matching Verity partitions) that shall be used alternatingly during upgrades\&. To minimize image sizes the original image is shipped only with one root and one Verity partition (the "A" set), and the second root and Verity partitions (the "B" set) shall be created on first boot on the free space on the medium\&.
.PP
.if n \{\
.RS 4
.\}
.nf
# /usr/lib/repart\&.d/50\-root\&.conf
[Partition]
Type=root
SizeMinBytes=512M
SizeMaxBytes=512M
.fi
.if n \{\
.RE
.\}
.PP
.if n \{\
.RS 4
.\}
.nf
# /usr/lib/repart\&.d/60\-root\-verity\&.conf
[Partition]
Type=root\-verity
SizeMinBytes=64M
SizeMaxBytes=64M
.fi
.if n \{\
.RE
.\}
.PP
The definitions above cover the "A" set of root partition (of a fixed 512M size) and Verity partition for the root partition (of a fixed 64M size)\&. Let\*(Aqs use symlinks to create the "B" set of partitions, since after all they shall have the same properties and sizes as the "A" set\&.
.PP
.if n \{\
.RS 4
.\}
.nf
# ln \-s 50\-root\&.conf /usr/lib/repart\&.d/70\-root\-b\&.conf
# ln \-s 60\-root\-verity\&.conf /usr/lib/repart\&.d/80\-root\-verity\-b\&.conf
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&4.\ \&Create a data partition and corresponding verity partitions from a OS tree\fR
.PP
Assuming we have an OS tree at
/var/tmp/os\-tree
that we want to package in a root partition together with matching verity partitions, we can do so as follows:
.PP
.if n \{\
.RS 4
.\}
.nf
# 50\-root\&.conf
[Partition]
Type=root
CopyFiles=/var/tmp/os\-tree
Verity=data
VerityMatchKey=root
Minimize=guess
.fi
.if n \{\
.RE
.\}
.PP
.if n \{\
.RS 4
.\}
.nf
# 60\-root\-verity\&.conf
[Partition]
Type=root\-verity
Verity=hash
VerityMatchKey=root
# Explicitly set the hash and data block size to 4K
VerityDataBlockSizeBytes=4096
VerityHashBlockSizeBytes=4096
Minimize=best
.fi
.if n \{\
.RE
.\}
.PP
.if n \{\
.RS 4
.\}
.nf
# 70\-root\-verity\-sig\&.conf
[Partition]
Type=root\-verity\-sig
Verity=signature
VerityMatchKey=root
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemd-repart\fR(8),
\fBsfdisk\fR(8),
\fBsystemd-cryptenroll\fR(1)
.SH "NOTES"
.IP " 1." 4
Discoverable Partitions Specification
.RS 4
\%https://uapi-group.org/specifications/specs/discoverable_partitions_specification
.RE
|