1SYSTEMD-REPART(8)               systemd-repart               SYSTEMD-REPART(8)
2
3
4

NAME

6       systemd-repart, systemd-repart.service - Automatically grow and add
7       partitions
8

SYNOPSIS

10       systemd-repart [OPTIONS...] [[BLOCKDEVICE]...]
11
12       systemd-repart.service
13

DESCRIPTION

15       systemd-repart grows and adds partitions to a partition table, based on
16       the configuration files described in repart.d(5).
17
18       If invoked with no arguments, it operates on the block device backing
19       the root file system partition of the OS, thus growing and adding
20       partitions of the booted OS image itself. When called in the initial
21       RAM disk it operates on the block device backing /sysroot/ instead,
22       i.e. on the block device the system will soon transition into. The
23       systemd-repart.service service is generally run at boot in the initial
24       RAM disk, in order to augment the partition table of the OS before its
25       partitions are mounted.  systemd-repart (mostly) operates in a purely
26       incremental mode: it only grows existing and adds new partitions; it
27       does not shrink, delete or move existing partitions. The service is
28       intended to be run on every boot, but when it detects that the
29       partition table already matches the installed repart.d/*.conf
30       configuration files, it executes no operation.
31
32       systemd-repart is intended to be used when deploying OS images, to
33       automatically adjust them to the system they are running on, during
34       first boot. This way the deployed image can be minimal in size and may
35       be augmented automatically at boot when needed, taking possession of
36       disk space available but not yet used. Specifically the following use
37       cases are among those covered:
38
39       ·   The root partition may be grown to cover the whole available disk
40           space
41
42       ·   A /home/, swap or /srv partition can be added in
43
44       ·   A second (or third, ...) root partition may be added in, to cover
45           A/B style setups where a second version of the root file system is
46           alternatingly used for implementing update schemes. The deployed
47           image would carry only a single partition ("A") but on first boot a
48           second partition ("B") for this purpose is automatically created.
49
50       The algorithm executed by systemd-repart is roughly as follows:
51
52        1. The repart.d/*.conf configuration files are loaded and parsed, and
53           ordered by filename (without the directory suffix).
54
55        2. The partition table already existing on the block device is loaded
56           and parsed.
57
58        3. The existing partitions in the partition table are matched up with
59           the repart.d/*.conf files by GPT partition type UUID. The first
60           existing partition of a specific type is assigned the first
61           configuration file declaring the same type. The second existing
62           partition of a specific type is then assigned the second
63           configuration file declaring the same type, and so on. After this
64           iterative assigning is complete any left-over existing partitions
65           that have no matching configuration file are considered "foreign"
66           and left as they are. And any configuration files for which no
67           partition currently exists are understood as a request to create
68           such a partition.
69
70        4. Taking the size constraints and weights declared in the
71           configuration files into account, all partitions that shall be
72           created are now allocated to the disk, taking up all free space,
73           always respecting the size and padding requests. Similar, existing
74           partitions that are determined to grow are grown. New partitions
75           are always appended to the end of the existing partition table,
76           taking the first partition table slot whose index is greater than
77           the indexes of all existing partitions. Partition table slots are
78           never reordered and thus partition numbers are ensured to remain
79           stable. Note that this allocation happens in RAM only, the
80           partition table on disk is not updated yet.
81
82        5. All existing partitions for which configuration files exist and
83           which currently have no GPT partition label set will be assigned a
84           label, either explicitly configured in the configuration or (if
85           that's missing) derived automatically from the partition type. The
86           same is done for all partitions that are newly created. These
87           assignments are done in RAM only, too, the disk is not updated yet.
88
89        6. Similarly, all existing partitions for which configuration files
90           exist and which currently have an all-zero identifying UUID will be
91           assigned a new UUID. This UUID is cryptographically hashed from a
92           common seed value together with the partition type UUID (and a
93           counter in case multiple partitions of the same type are defined),
94           see below. The same is done for all partitions that are created
95           anew. These assignments are done in RAM only, too, the disk is not
96           updated yet.
97
98        7. Similarly, if the disk's volume UUID is all zeroes it is also
99           initialized, also cryptographically hashed from the same common
100           seed value. Also, in RAM only, too.
101
102        8. The disk space assigned to new partitions (i.e. what was previously
103           considered free space but is no longer) is now erased.
104           Specifically, all file system signatures are removed, and if the
105           device supports it the BLKDISCARD I/O control command is issued to
106           inform the hardware that the space is empty now. In addition any
107           "padding" between partitions and at the end of the device is
108           similarly erased.
109
110        9. The new partition table is finally written to disk. The kernel is
111           asked to reread the partition table.
112
113       As exception to the normally strictly incremental operation, when
114       called in a special "factory reset" mode systemd-repart may also be
115       used to erase select existing partitions to reset an installation back
116       to vendor defaults. This mode of operation is used when either the
117       --factory-reset=yes switch is passed on the tool's command line, or the
118       systemd.factory_reset=yes option specified on the kernel command line,
119       or the FactoryReset EFI variable (vendor UUID
120       8cf2644b-4b0b-428f-9387-6d876050dc67) is set to "yes". It alters the
121       algorithm above slightly: between the 3rd and the 4th step above the
122       any partition marked explicitly via the FactoryReset= boolean is
123       deleted, and the algorithm restarted, thus immediately re-creating
124       these partitions anew empty.
125
126       Note that systemd-repart only changes partition tables, it does not
127       create or resize any file systems within these partitions. A separate
128       mechanism should be used for that, for example systemd-growfs(8) and
129       systemd-makefs.
130
131       The UUIDs identifying the new partitions created (or assigned to
132       existing partitions that have no UUID yet), as well as the disk as a
133       whole are hashed cryptographically from a common seed value. This seed
134       value is usually the machine-id(5) of the system, so that the machine
135       ID reproducibly determines the UUIDs assigned to all partitions. If the
136       machine ID cannot be read (or the user passes --seed=random, see below)
137       the seed is generated randomly instead, so that the partition UUIDs are
138       also effectively random. The seed value may also be set explicitly,
139       formatted as UUID via the --seed= option. By hashing these UUIDs from a
140       common seed images prepared with this tool become reproducible and the
141       result of the algorithm above deterministic.
142

OPTIONS

144       The following options are understood:
145
146       --dry-run=
147           Takes a boolean. If this switch is not specified --dry-run=yes is
148           the implied default. Controls whether systemd-repart executes the
149           requested re-partition operations or whether it should only show
150           what it would do. Unless --dry-run=no is specified systemd-repart
151           will not actually touch the device's partition table.
152
153       --empty=
154           Takes one of "refuse", "allow", "require" or "force". Controls how
155           to operate on block devices that are entirely empty, i.e. carry no
156           partition table/disk label yet. If this switch is not specified the
157           implied default is "refuse".
158
159           If "refuse" systemd-repart requires that the block device it shall
160           operate on already carries a partition table and refuses operation
161           if none is found. If "allow" the command will extend an existing
162           partition table or create a new one if none exists. If "require"
163           the command will create a new partition table if none exists so
164           far, and refuse operation if one already exists. If "force" it will
165           create a fresh partition table unconditionally, erasing the disk
166           fully in effect. If "force" no existing partitions will be taken
167           into account or survive the operation. Hence: use with care, this
168           is a great way to lose all your data.
169
170       --discard=
171           Takes a boolean. If this switch is not specified --discard=yes is
172           the implied default. Controls whether to issue the BLKDISCARD I/O
173           control command on the space taken up by any added partitions or on
174           the space in between them. Usually, it's a good idea to issue this
175           request since it tells the underlying hardware that the covered
176           blocks shall be considered empty, improving performance.
177
178       --factory-reset=
179           Takes boolean. If this switch is not specified --factory=reset=no
180           is the implied default. Controls whether to operate in "factory
181           reset" mode, see above. If set to true this will remove all
182           existing partitions marked with FactoryReset= set to yes early
183           while executing the re-partitioning algorithm. Use with care, this
184           is a great way to lose all your data. Note that partition files
185           need to explicitly turn FactoryReset= on, as the option defaults to
186           off. If no partitions are marked for factory reset this switch has
187           no effect. Note that there are two other methods to request factory
188           reset operation: via the kernel command line and via an EFI
189           variable, see above.
190
191       --can-factory-reset
192           If this switch is specified the disk is not re-partitioned. Instead
193           it is determined if any existing partitions are marked with
194           FactoryReset=. If there are the tool will exit with exit status
195           zero, otherwise non-zero. This switch may be used to quickly
196           determine whether the running system supports a factory reset
197           mechanism built on systemd-repart.
198
199       --root=
200           Takes a path to a directory to use as root file system when
201           searching for repart.d/*.conf files and for the machine ID file to
202           use as seed. By default when invoked on the regular system this
203           defaults to the host's root file system /. If invoked from the
204           initial RAM disk this defaults to /sysroot/, so that the tool
205           operates on the configuration and machine ID stored in the root
206           file system later transitioned into itself.
207
208       --seed=
209           Takes a UUID as argument or the special value random. If a UUID is
210           specified the UUIDs to assign to partitions and the partition table
211           itself are derived via cryptographic hashing from it. If not
212           specified it is attempted to read the machine ID from the host (or
213           more precisely, the root directory configured via --root=) and use
214           it as seed instead, falling back to a randomized seed otherwise.
215           Use --seed=random to force a randomized seed. Explicitly specifying
216           the seed may be used to generated strictly reproducible partition
217           tables.
218
219       --pretty=
220           Takes a boolean argument. If this switch is not specified, it
221           defaults to on when called from an interactive terminal and off
222           otherwise. Controls whether to show a user friendly table and
223           graphic illustrating the changes applied.
224
225       --definitions=
226           Takes a file system path. If specified the *.conf are directly read
227           from the specified directory instead of searching in
228           /usr/lib/repart.d/*.conf, /etc/repart.d/*.conf,
229           /run/repart.d/*.conf.
230
231       -h, --help
232           Print a short help text and exit.
233
234       --version
235           Print a short version string and exit.
236

SEE ALSO

238       systemd(1), repart.d(5), machine-id(5)
239
240
241
242systemd 245                                                  SYSTEMD-REPART(8)
Impressum