-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release, rpm2img, partyplanner: label BOTTLEROCKET-DATA during firstboot
Changes partitioning to append a fallback data partition to the os image. This is only applicable with the "split" partitioning plan. Nothing changes for the "unified" partitioning plan. We add three new services that run as part of 'local-fs.target' and before 'local.mount' and 'repart-local.service': * 'label-data-alt.service' * 'label-data-pref.service' * 'formalize-data-part.service' 'label-data-alt' and 'label-data-pref' will "compete" and both try to label 'BOTTLEROCKET-DATA' first with the partition they're each waiting for. 'label-data-pref' waits for the "preferred" data partition that either resides on a separate disk for "split" image configurations or on the same OS image for "unified" image configurations. Once that device is ready, we call 'systemd-repart' to relabel it as 'BOTTLEROCKET-DATA' and grow it as much as possible. 'label-data-alt' first waits for a moderate amount of time before kicking off. This gives 'label-data-pref' a chance to relabel the "preferred" partition as 'BOTTLEROCKET-DATA'. If the "preferred" data partition is not available for whatever reason, this service will call 'systemd-repart' to relabel the alternative/back-up data partition on the OS image as 'BOTTLEROCKET-DATA' and grow the partition to fill the remainder of the disk. 'formalize-data-part''s job is to wait for a partition labelled 'BOTTLEROCKET-DATA' to appear. Once it does, it forcibly stops and masks the the other two service units. All of this lets the host to boot if the "preferred" data partition doesn't exist and the root filesystem disk has leftover extra space to accommodate a reasonably-sized back-up data partition.
- Loading branch information
Showing
7 changed files
with
142 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[Unit] | ||
Description=Finalize BOTTLEROCKET-DATA | ||
DefaultDependencies=no | ||
Conflicts=shutdown.target | ||
# Wait for partition labeled 'BOTTLEROCKET-DATA' to appear. | ||
Wants=dev-disk-by\x2dpartlabel-BOTTLEROCKET\x2dDATA.device | ||
After=dev-disk-by\x2dpartlabel-BOTTLEROCKET\x2dDATA.device | ||
|
||
[Service] | ||
Type=oneshot | ||
# Once we have the 'BOTTLEROCKET-DATA' partition, the 'label-data-*' services should never run again. | ||
ExecStart=/usr/bin/systemctl stop label-data-alternative --no-block | ||
ExecStart=/usr/bin/systemctl stop label-data-preferred --no-block | ||
ExecStart=/usr/bin/systemctl mask label-data-alternative --no-block | ||
ExecStart=/usr/bin/systemctl mask label-data-preferred --no-block | ||
RemainAfterExit=true | ||
StandardError=journal+console | ||
|
||
[Install] | ||
WantedBy=local-fs.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Unit] | ||
Description=Label alternative data partition | ||
DefaultDependencies=no | ||
Conflicts=shutdown.target | ||
# Only run this if a partition labeled 'BOTTLEROCKET-DATA' does not exist already. | ||
ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA | ||
# This is the partition GUID for the fallback data partition. | ||
Wants=dev-disk-by\x2dpartuuid-69040874\x2d417d\x2d4e26\x2da764\x2d7885f22007ea.device | ||
After=dev-disk-by\x2dpartuuid-69040874\x2d417d\x2d4e26\x2da764\x2d7885f22007ea.device | ||
|
||
[Service] | ||
Type=oneshot | ||
|
||
ExecStartPre=-/usr/bin/sleep 30 | ||
# Label the partition as 'BOTTLEROCKET-DATA' and resize the partition, whether or not it resides on the same disk as /. | ||
ExecStart=-/usr/bin/systemd-repart --dry-run=no /dev/disk/by-partuuid/69040874-417d-4e26-a764-7885f22007ea | ||
|
||
[Install] | ||
WantedBy=local-fs.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=Label preferred data partition | ||
DefaultDependencies=no | ||
Conflicts=shutdown.target | ||
# Only run this if a partition labeled 'BOTTLEROCKET-DATA' does not exist already. | ||
ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA | ||
# This is the partition GUID for the preferred data partition. | ||
Wants=dev-disk-by\x2dpartuuid-5b94e8df\x2d28b8\x2d485c\x2d9d19\x2d362263b5944c.device | ||
After=dev-disk-by\x2dpartuuid-5b94e8df\x2d28b8\x2d485c\x2d9d19\x2d362263b5944c.device | ||
|
||
[Service] | ||
Type=oneshot | ||
|
||
# Label the partition as 'BOTTLEROCKET-DATA' and resize the partition, whether or not it resides on the same disk as /. | ||
ExecStart=-/usr/bin/systemd-repart --dry-run=no /dev/disk/by-partuuid/5b94e8df-28b8-485c-9d19-362263b5944c | ||
|
||
[Install] | ||
WantedBy=local-fs.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters