Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label BOTTLEROCKET-DATA at runtime #2807

Merged
merged 3 commits into from
Mar 8, 2023

Conversation

etungsten
Copy link
Contributor

@etungsten etungsten commented Feb 15, 2023

Issue number:
Resolves #2822

Description of changes:


    release,os: ensure data partition label/resize services only run once
    
    This adds additional safeguards to prevent a different data partition
    from being labeled and resized if the host has ever booted successfully
    in the past with an original data partition.

    signpost: mark if boot has succeeded before, add subcommand for checking
    
    'mark-successful-boot' now also updates BOTTLEROCKET_PRIVATE's GPT table
    attribute to indicate whether boot has ever succeeded before.
    
    Add a new 'has-boot-ever-succeeded' subcommand for checking if boot has
    ever succeeded before
    release, rpm2img, partyplanner: label BOTTLEROCKET-DATA during firstboot
    
    Changes partitioning to always keep a data partition on the os image.
    We grow and label data partition at runtime. We will still create a
    separate data partiion on the second volume/disk for "split" partition
    layouts.
    
    We add two new services that run as part of 'local-fs.target' and
    before 'local.mount' and 'repart-local.service':
      * 'label-data-a.service'
      * 'label-data-b.service'
    
    'label-data-a' and 'label-data-b' will "compete" and both try to
    label 'BOTTLEROCKET-DATA' first with the partition they're each waiting
    for.
    
    'label-data-a' waits for the data partition that resides on the OS disk
    image. Once that device is ready, we call 'systemd-repart' to relabel it
    as 'BOTTLEROCKET-DATA' and grow it as much as possible.
    
    'label-data-b' calls 'systemd-repart' to label the data partition on
    the data image as 'BOTTLEROCKET-DATA' and grow the partition to fill the
    remainder of the disk.
    
    All of this lets the host to boot if data partition on the data image
    doesn't exist and the root filesystem disk has leftover extra space to
    accommodate a reasonably-sized back-up data partition.

Testing done:

Instance with the aws-k8s-1.24 AMI as is without modification.

The host comes up as expected and system logs doesn't show any abnormalities:

...
         Starting Rule-based Manager for Device Events and Files...
[  OK  ] Started Rule-based Manager for Device Events and Files.
[  OK  ] Found device Amazon Elastic Block Store 1.
[  OK  ] Found device Amazon Elastic Block Store 13.
[  OK  ] Found device Amazon Elastic Block Store BOTTLEROCKET-PRIVATE.
         Starting Label alternative data partition...
         Starting Label preferred data partition...
[  OK  ] Finished Label alternative data partition.
[  OK  ] Finished Label preferred data partition.
[  OK  ] Found device Amazon Elastic Block Store BOTTLEROCKET-DATA.
         Mounting Containerd Configuration Directory (/etc/containerd)...
         Mounting Host containers Configurat…irectory (/etc/host-containers)...
         Mounting Kubernetes PKI private dir…y (/etc/kubernetes/pki/private)...
         Mounting Local Directory (/local)...
         Mounting AWS configuration directory (/root/.aws)...
[  OK  ] Mounted Containerd Configuration Directory (/etc/containerd).
[  OK  ] Mounted Host containers Configurati… Directory (/etc/host-containers).
[  OK  ] Mounted Kubernetes PKI private dire…ory (/etc/kubernetes/pki/private).
[  OK  ] Mounted AWS configuration directory (/root/.aws).
[  OK  ] Mounted Local Directory (/local).

...

The status label-data-preferred, label-data-alternative, repart-local shows the data partition gets labelled and the local fs gets created and grows successfully.

bash-5.1# systemctl status label-data-preferred label-data-alternative repart-local
● label-data-preferred.service - Label preferred data partition
     Loaded: loaded (/aarch64-bottlerocket-linux-gnu/sys-root/usr/lib/systemd/system/label-data-preferred.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2023-02-17 23:16:16 UTC; 2h 26min ago
   Main PID: 881 (code=exited, status=0/SUCCESS)

Feb 17 23:16:16 localhost systemd[1]: Starting Label preferred data partition...
Feb 17 23:16:16 localhost systemd-repart[881]: Applying changes.
Feb 17 23:16:16 localhost systemd-repart[881]: Storage does not support discard, not discarding gap at beginning of disk.
Feb 17 23:16:16 localhost systemd-repart[881]: Growing existing partition 0.
Feb 17 23:16:16 localhost systemd-repart[881]: Setting partition label of existing partition 0.
Feb 17 23:16:16 localhost systemd-repart[881]: Writing new partition table.
Feb 17 23:16:16 localhost systemd-repart[881]: Telling kernel to reread partition table.
Feb 17 23:16:16 localhost systemd-repart[881]: All done.
Feb 17 23:16:16 localhost systemd[1]: Finished Label preferred data partition.

● label-data-alternative.service - Label alternative data partition
     Loaded: loaded (/aarch64-bottlerocket-linux-gnu/sys-root/usr/lib/systemd/system/label-data-alternative.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2023-02-17 23:16:16 UTC; 2h 26min ago
   Main PID: 880 (code=killed, signal=ABRT)

Feb 17 23:16:16 localhost systemd[1]: Starting Label alternative data partition...
Feb 17 23:16:16 localhost systemd-repart[880]: Assertion 'amount <= total' failed at src/partition/repart.c:533, function charge_size(). Aborting.
Feb 17 23:16:16 localhost systemd[1]: Finished Label alternative data partition.

● repart-local.service - Resize Data Partition
     Loaded: loaded (/aarch64-bottlerocket-linux-gnu/sys-root/usr/lib/systemd/system/repart-local.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2023-02-17 23:16:17 UTC; 2h 26min ago
   Main PID: 927 (code=exited, status=0/SUCCESS)

Feb 17 23:16:17 localhost systemd[1]: Starting Resize Data Partition...
Feb 17 23:16:17 localhost systemd-growfs[927]: Successfully resized "/local" to 19.9G bytes.
Feb 17 23:16:17 localhost systemd[1]: Finished Resize Data Partition.

blkid shows the expected new partition UUIDs for the data partitions

bash-5.1# blkid | sort
/dev/dm-0: UUID="1c118fe4-f172-4dda-8e90-e07c76b787f8" BLOCK_SIZE="4096" TYPE="ext4"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/nvme0n1p10: PARTLABEL="BOTTLEROCKET-HASH-B" PARTUUID="07fd37a6-0c06-4728-bd2d-0131b65c7000"
/dev/nvme0n1p11: PARTLABEL="BOTTLEROCKET-RESERVED-B" PARTUUID="cdc6aab5-5549-410d-b716-4d90c8a93372"
/dev/nvme0n1p12: UUID="ee5e711f-4217-4a46-884d-b069fa502260" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-PRIVATE" PARTUUID="b0cbafc7-ff84-4361-93bc-1029d1efee63"
/dev/nvme0n1p13: UUID="892c66e2-bf1e-42e4-b358-554e2c55860a" BLOCK_SIZE="1024" TYPE="ext4" PARTUUID="69040874-417d-4e26-a764-7885f22007ea"
/dev/nvme0n1p1: PARTLABEL="BIOS-BOOT" PARTUUID="0da51cfe-8a04-43c2-a8c2-917c9c7370f8"
/dev/nvme0n1p2: SEC_TYPE="msdos" UUID="A3C3-D6E8" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI-SYSTEM" PARTUUID="d3472a38-c8a0-4f27-80d9-d2f924ce9021"
/dev/nvme0n1p3: UUID="6aaf9639-5654-4e61-9abd-4228b8aacb4f" BLOCK_SIZE="1024" TYPE="ext4" PARTLABEL="BOTTLEROCKET-BOOT-A" PARTUUID="d062f4d5-a027-47b1-8528-e73d2f2032da"
/dev/nvme0n1p4: UUID="1c118fe4-f172-4dda-8e90-e07c76b787f8" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-ROOT-A" PARTUUID="b7cc8d9a-c075-4ce4-bcc2-aefab130e286"
/dev/nvme0n1p5: UUID="bc552628-baa0-4201-bfad-84d0abf3f32e" TYPE="DM_verity_hash" PARTLABEL="BOTTLEROCKET-HASH-A" PARTUUID="ded71c16-6020-4fcb-8130-adb4b01df3a6"
/dev/nvme0n1p6: PARTLABEL="BOTTLEROCKET-RESERVED-A" PARTUUID="413c75b9-6ecc-4577-a4a3-971a7ba93d4f"
/dev/nvme0n1p7: PARTLABEL="EFI-BACKUP" PARTUUID="cc18beca-3432-41bf-bf11-e26c1e6b674a"
/dev/nvme0n1p8: PARTLABEL="BOTTLEROCKET-BOOT-B" PARTUUID="e8789cf6-e927-4014-aa05-ef1d2340b432"
/dev/nvme0n1p9: PARTLABEL="BOTTLEROCKET-ROOT-B" PARTUUID="3e86e59f-4716-4b8a-affe-ad74be4563e7"
/dev/nvme1n1p1: UUID="b04e749b-cb13-49e9-a532-457de5cec304" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-DATA" PARTUUID="5b94e8df-28b8-485c-9d19-362263b5944c"

lsblk looks normal

bash-5.1# lsblk                                                                                                 
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0          7:0    0 11.8M  1 loop /var/lib/kernel-devel/.overlay/lower
loop1          7:1    0  304K  1 loop /aarch64-bottlerocket-linux-gnu/sys-root/usr/share/licenses
nvme0n1      259:0    0    2G  0 disk 
|-nvme0n1p1  259:3    0    4M  0 part 
|-nvme0n1p2  259:4    0    5M  0 part 
|-nvme0n1p3  259:5    0   40M  0 part /boot
|-nvme0n1p4  259:6    0  920M  0 part 
|-nvme0n1p5  259:7    0   10M  0 part 
|-nvme0n1p6  259:8    0   25M  0 part 
|-nvme0n1p7  259:9    0    5M  0 part 
|-nvme0n1p8  259:10   0   40M  0 part 
|-nvme0n1p9  259:11   0  920M  0 part 
|-nvme0n1p10 259:12   0   10M  0 part 
|-nvme0n1p11 259:13   0   25M  0 part 
|-nvme0n1p12 259:14   0   41M  0 part /var/lib/bottlerocket
`-nvme0n1p13 259:15   0    1M  0 part 
nvme1n1      259:1    0   20G  0 disk 
`-nvme1n1p1  259:16   0   20G  0 part /opt
                                      /var
                                      /mnt
                                      /local

Upon reboot, label-data-* oneshot service units do not run since a partition labelled BOTTLEROCKET-DATA already exists:

bash-5.1# systemctl status label-data-pref label-data-alt
○ label-data-pref.service
     Loaded: masked (Reason: Unit label-data-pref.service is masked.)
     Active: inactive (dead)
  Condition: start condition failed at Wed 2023-02-15 23:10:42 UTC; 3min 11s ago

Feb 15 23:10:42 localhost systemd[1]: Label preferred data partition was skipped because of a failed condition check (ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA).

○ label-data-alt.service
     Loaded: masked (Reason: Unit label-data-alt.service is masked.)
     Active: inactive (dead)
  Condition: start condition failed at Wed 2023-02-15 23:10:42 UTC; 3min 11s ago

Feb 15 23:10:42 localhost systemd[1]: Label alternative data partition was skipped because of a failed condition check (ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA).

Instance with the aws-k8s-1.24 AMI but with the default 20 GB data EBS volume removed. The single root EBS volume size increased from 2GB to 12GB

The host boots and comes up even though it's missing the data EBS volume:

        Starting Apply Kernel Variables...
[  OK  ] Finished Apply Kernel Variables.
[  OK  ] Found device Amazon Elastic Block Store 13.
[  OK  ] Found device Amazon Elastic Block Store BOTTLEROCKET-PRIVATE.
         Starting Label alternative data partition...
[  OK  ] Finished Label alternative data partition.
[  OK  ] Found device Amazon Elastic Block Store BOTTLEROCKET-DATA.
         Mounting Local Directory (/local)...
[  OK  ] Mounted Local Directory (/local).

e (dead)


The status `label-data-preferred`, `label-data-alternative`, `repart-local` shows the data partition gets labelled and the local fs gets created and grows successfully:
```bash
bash-5.1# systemctl status label-data-preferred label-data-alternative repart-local
○ label-data-preferred.service - Label preferred data partition
     Loaded: loaded (/aarch64-bottlerocket-linux-gnu/sys-root/usr/lib/systemd/system/label-data-preferred.service; enabled; vendor preset: enabled)
     Active: inactive (dead)
  Condition: start condition failed at Fri 2023-02-17 23:36:18 UTC; 2h 12min ago
             └─ ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA was not met

Feb 17 23:36:18 ip-192-168-7-234.us-west-2.compute.internal systemd[1]: Label preferred data partition was skipped because of a failed condition check (ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA).

● label-data-alternative.service - Label alternative data partition
     Loaded: loaded (/aarch64-bottlerocket-linux-gnu/sys-root/usr/lib/systemd/system/label-data-alternative.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2023-02-17 23:34:49 UTC; 2h 13min ago
   Main PID: 800 (code=exited, status=0/SUCCESS)

Feb 17 23:34:49 localhost systemd[1]: Starting Label alternative data partition...
Feb 17 23:34:49 localhost systemd-repart[800]: Applying changes.
Feb 17 23:34:49 localhost systemd-repart[800]: Storage does not support discard, not discarding gap at beginning of disk.
Feb 17 23:34:49 localhost systemd-repart[800]: Growing existing partition 12.
Feb 17 23:34:49 localhost systemd-repart[800]: Setting partition label of existing partition 12.
Feb 17 23:34:49 localhost systemd-repart[800]: Writing new partition table.
Feb 17 23:34:49 localhost systemd-repart[800]: Telling kernel to reread partition table.
Feb 17 23:34:49 localhost systemd-repart[800]: All done.
Feb 17 23:34:49 localhost systemd[1]: Finished Label alternative data partition.

● repart-local.service - Resize Data Partition
     Loaded: loaded (/aarch64-bottlerocket-linux-gnu/sys-root/usr/lib/systemd/system/repart-local.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2023-02-17 23:34:50 UTC; 2h 13min ago
   Main PID: 838 (code=exited, status=0/SUCCESS)

Feb 17 23:34:49 localhost systemd[1]: Starting Resize Data Partition...
Feb 17 23:34:49 localhost systemd-repart[822]: Can't fit requested partitions into available free space (1004.0K), refusing.
Feb 17 23:34:49 localhost systemd-repart[822]: Automatically determined minimal disk image size as 12.0G, current image size is 12.0G.
Feb 17 23:34:50 localhost systemd-growfs[838]: Successfully resized "/local" to 10.0G bytes.
Feb 17 23:34:50 localhost systemd[1]: Finished Resize Data Partition.

blkid shows the expected static partition UUIDs and no second NVMe disk

bash-5.1# blkid | sort                                                                                                                                                                         
/dev/dm-0: UUID="3ced6171-f404-4d16-9fbb-03dcc8cc9a7e" BLOCK_SIZE="4096" TYPE="ext4"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/nvme0n1p10: PARTLABEL="BOTTLEROCKET-HASH-B" PARTUUID="a84cc2e6-9cf5-4f7d-aa12-329528bb3134"
/dev/nvme0n1p11: PARTLABEL="BOTTLEROCKET-RESERVED-B" PARTUUID="0cb8a41e-704f-4a21-aa56-a671913a8d61"
/dev/nvme0n1p12: UUID="c28859e5-dd8b-4fa5-90ac-de60b963ecc5" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-PRIVATE" PARTUUID="f27b75bc-0441-47f0-84ec-09e298f95bb5"
/dev/nvme0n1p13: UUID="ab366348-471b-4fa2-91cf-26e0ab4ba5f2" BLOCK_SIZE="1024" TYPE="ext4" PARTLABEL="BOTTLEROCKET-DATA" PARTUUID="69040874-417d-4e26-a764-7885f22007ea"
/dev/nvme0n1p1: PARTLABEL="BIOS-BOOT" PARTUUID="03f45119-fffa-45f8-bcfd-77541c732a37"
/dev/nvme0n1p2: SEC_TYPE="msdos" UUID="E651-2BEE" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI-SYSTEM" PARTUUID="1219a1cf-cd0e-4e4b-9122-b62ed1e797a3"
/dev/nvme0n1p3: UUID="6b841fe7-b045-446c-a1c4-d672648aaea9" BLOCK_SIZE="1024" TYPE="ext4" PARTLABEL="BOTTLEROCKET-BOOT-A" PARTUUID="3ef63431-77ba-4472-94af-7af42c150473"
/dev/nvme0n1p4: UUID="3ced6171-f404-4d16-9fbb-03dcc8cc9a7e" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-ROOT-A" PARTUUID="f6ccee74-df82-438a-a0c9-96d8523d6e17"
/dev/nvme0n1p5: UUID="c7e7f22f-5d4e-498e-888b-4df0ce03c29e" TYPE="DM_verity_hash" PARTLABEL="BOTTLEROCKET-HASH-A" PARTUUID="6f414b51-b546-444f-82c6-315da3fadb2b"
/dev/nvme0n1p6: PARTLABEL="BOTTLEROCKET-RESERVED-A" PARTUUID="95d3fc19-e86d-4ed8-9de0-bb2ddc8311c8"
/dev/nvme0n1p7: PARTLABEL="EFI-BACKUP" PARTUUID="fb81ad6e-ea24-4304-b028-f45bb17ad4a1"
/dev/nvme0n1p8: PARTLABEL="BOTTLEROCKET-BOOT-B" PARTUUID="9717564c-47bb-421d-ac5f-ff2d0643e68b"
/dev/nvme0n1p9: PARTLABEL="BOTTLEROCKET-ROOT-B" PARTUUID="807bc9c8-8e0e-4578-a440-b0363cd8def9"

lsblk looks normal.

bash-5.1# lsblk                                                                                                                                    
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0          7:0    0 11.8M  1 loop /var/lib/kernel-devel/.overlay/lower
loop1          7:1    0  304K  1 loop /aarch64-bottlerocket-linux-gnu/sys-root/usr/share/licenses
nvme0n1      259:0    0   12G  0 disk 
|-nvme0n1p1  259:1    0    4M  0 part 
|-nvme0n1p2  259:2    0    5M  0 part 
|-nvme0n1p3  259:3    0   40M  0 part /boot
|-nvme0n1p4  259:4    0  920M  0 part 
|-nvme0n1p5  259:5    0   10M  0 part 
|-nvme0n1p6  259:6    0   25M  0 part 
|-nvme0n1p7  259:7    0    5M  0 part 
|-nvme0n1p8  259:8    0   40M  0 part 
|-nvme0n1p9  259:9    0  920M  0 part 
|-nvme0n1p10 259:10   0   10M  0 part 
|-nvme0n1p11 259:11   0   25M  0 part 
|-nvme0n1p12 259:12   0   41M  0 part /var/lib/bottlerocket
`-nvme0n1p13 259:13   0   10G  0 part /opt
                                      /var
                                      /mnt
                                      /local

AMI with "unified" image layout

The host comes up as fine. There is no change to the image layout from before this change.

         Starting Label preferred data partition...
[  OK  ] Finished Label preferred data partition.
[  OK  ] Found device Amazon Elastic Block Store BOTTLEROCKET-DATA.
         Mounting Containerd Configuration Directory (/etc/containerd)...
         Mounting Host containers Configurat…irectory (/etc/host-containers)...
         Mounting Kubernetes PKI private dir…y (/etc/kubernetes/pki/private)...
         Mounting Local Directory (/local)...
         Mounting AWS configuration directory (/root/.aws)...
[  OK  ] Mounted Containerd Configuration Directory (/etc/containerd).
[  OK  ] Mounted Host containers Configurati… Directory (/etc/host-containers).
[  OK  ] Mounted Kubernetes PKI private dire…ory (/etc/kubernetes/pki/private).
[  OK  ] Mounted Local Directory (/local).

The status label-data-preferred, label-data-alternative, repart-local shows the data partition gets labelled and the local fs gets created and grows successfully:

bash-5.1# systemctl status label-data-preferred label-data-alternative repart-local
● label-data-preferred.service - Label preferred data partition
     Loaded: loaded (/aarch64-bottlerocket-linux-gnu/sys-root/usr/lib/systemd/system/label-data-preferred.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2023-02-17 23:58:23 UTC; 1h 53min ago
   Main PID: 867 (code=exited, status=0/SUCCESS)

Feb 17 23:58:23 localhost systemd[1]: Starting Label preferred data partition...
Feb 17 23:58:23 localhost systemd-repart[867]: Applying changes.
Feb 17 23:58:23 localhost systemd-repart[867]: Storage does not support discard, not discarding gap at beginning of disk.
Feb 17 23:58:23 localhost systemd-repart[867]: Growing existing partition 12.
Feb 17 23:58:23 localhost systemd-repart[867]: Setting partition label of existing partition 12.
Feb 17 23:58:23 localhost systemd-repart[867]: Writing new partition table.
Feb 17 23:58:23 localhost systemd-repart[867]: Telling kernel to reread partition table.
Feb 17 23:58:23 localhost systemd-repart[867]: All done.
Feb 17 23:58:23 localhost systemd[1]: Finished Label preferred data partition.

○ label-data-alternative.service - Label alternative data partition
     Loaded: loaded (/aarch64-bottlerocket-linux-gnu/sys-root/usr/lib/systemd/system/label-data-alternative.service; enabled; vendor preset: enabled)
     Active: inactive (dead)
  Condition: start condition failed at Fri 2023-02-17 23:59:53 UTC; 1h 52min ago
             └─ ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA was not met

Feb 17 23:59:53 ip-192-168-9-148.us-west-2.compute.internal systemd[1]: Label alternative data partition was skipped because of a failed condition check (ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA).

● repart-local.service - Resize Data Partition
     Loaded: loaded (/aarch64-bottlerocket-linux-gnu/sys-root/usr/lib/systemd/system/repart-local.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2023-02-17 23:58:24 UTC; 1h 53min ago
   Main PID: 895 (code=exited, status=0/SUCCESS)

Feb 17 23:58:24 localhost systemd[1]: Starting Resize Data Partition...
Feb 17 23:58:24 localhost systemd-repart[894]: No changes.
Feb 17 23:58:24 localhost systemd-growfs[895]: Successfully resized "/local" to 20.0G bytes.
Feb 17 23:58:24 localhost systemd[1]: Finished Resize Data Partition.
                                                                                                                                                      

blkid looks fine:

bash-5.1# blkid | sort                                                                                                                                                                                                     
/dev/dm-0: UUID="5d667680-3724-4e5b-93ae-cda44de314fc" BLOCK_SIZE="4096" TYPE="ext4"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/nvme0n1p10: PARTLABEL="BOTTLEROCKET-HASH-B" PARTUUID="bace40c4-18a6-4947-8a77-5cb4a35f4484"
/dev/nvme0n1p11: PARTLABEL="BOTTLEROCKET-RESERVED-B" PARTUUID="7b0a6af4-b095-4e43-beba-c37f6696dcf7"
/dev/nvme0n1p12: UUID="9ddce00a-e071-401d-b708-5e4b587e6348" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-PRIVATE" PARTUUID="125f6bfe-f71d-4eb7-9039-3b4a597798ae"
/dev/nvme0n1p13: UUID="003d02e2-8057-4043-80fb-211108ca2b77" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-DATA" PARTUUID="5b94e8df-28b8-485c-9d19-362263b5944c"
/dev/nvme0n1p1: PARTLABEL="BIOS-BOOT" PARTUUID="d7f2098b-2a3b-413f-b0d9-5a170869e27d"
/dev/nvme0n1p2: SEC_TYPE="msdos" UUID="2704-81C7" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI-SYSTEM" PARTUUID="cee0268b-5831-4767-b66c-0ddea2ff8b89"
/dev/nvme0n1p3: UUID="94c61991-db56-4ddf-8057-50819aa67265" BLOCK_SIZE="1024" TYPE="ext4" PARTLABEL="BOTTLEROCKET-BOOT-A" PARTUUID="e07310d9-43b0-4b25-a952-66923626a822"
/dev/nvme0n1p4: UUID="5d667680-3724-4e5b-93ae-cda44de314fc" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-ROOT-A" PARTUUID="d5d8c9bd-4c1a-4c5e-97b3-27430955dd4d"
/dev/nvme0n1p5: UUID="575019b8-e62e-4d74-a184-1445ccf9d10c" TYPE="DM_verity_hash" PARTLABEL="BOTTLEROCKET-HASH-A" PARTUUID="d9694ab9-1cd8-4b09-8cac-25187709881c"
/dev/nvme0n1p6: PARTLABEL="BOTTLEROCKET-RESERVED-A" PARTUUID="f0339459-57d7-4f7f-9d5b-ab02810c46ce"
/dev/nvme0n1p7: PARTLABEL="EFI-BACKUP" PARTUUID="71ffac70-d957-475c-8b73-c5e01fcdff31"
/dev/nvme0n1p8: PARTLABEL="BOTTLEROCKET-BOOT-B" PARTUUID="330e3c82-75d6-4fed-a18b-8d010077d731"
/dev/nvme0n1p9: PARTLABEL="BOTTLEROCKET-ROOT-B" PARTUUID="c1ff364e-ff0a-415f-b05b-bbcf4ff719ca"

lsblk looks normal

bash-5.1# lsblk                                                                                                                           
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0          7:0    0 11.8M  1 loop /var/lib/kernel-devel/.overlay/lower
loop1          7:1    0  304K  1 loop /aarch64-bottlerocket-linux-gnu/sys-root/usr/share/licenses
nvme0n1      259:0    0   22G  0 disk 
|-nvme0n1p1  259:1    0    4M  0 part 
|-nvme0n1p2  259:2    0    5M  0 part 
|-nvme0n1p3  259:3    0   40M  0 part /boot
|-nvme0n1p4  259:4    0  920M  0 part 
|-nvme0n1p5  259:5    0   10M  0 part 
|-nvme0n1p6  259:6    0   25M  0 part 
|-nvme0n1p7  259:7    0    5M  0 part 
|-nvme0n1p8  259:8    0   40M  0 part 
|-nvme0n1p9  259:9    0  920M  0 part 
|-nvme0n1p10 259:10   0   10M  0 part 
|-nvme0n1p11 259:11   0   25M  0 part 
|-nvme0n1p12 259:12   0   42M  0 part /var/lib/bottlerocket
`-nvme0n1p13 259:13   0   20G  0 part /var
                                      /opt
                                      /mnt
                                      /local

Single EBS volume with default 2 GB size and no additional space

The host fails boot as expected during label-data-alt since there is not enough space to label and grow the alternative data partition.

[  OK  ] Finished Apply Kernel Variables.
[  OK  ] Found device Amazon Elastic Block Store 13.
[  OK  ] Found device Amazon Elastic Block Store BOTTLEROCKET-PRIVATE.
         Starting Label alternative data partition...
[  OK  ] Finished Label alternative data partition.
[*     ] (1 of 2) A start job is running for…/BOTTLEROCKET-DATA (3s / 1min 30s)
^M[**    ] (1 of 2) A start job is running for…/BOTTLEROCKET-DATA (4s / 1min 30s)
^M[***   ] (1 of 2) A start job is running for…/BOTTLEROCKET-DATA (4s / 1min 30s)
...
^M[***   ] (1 of 2) A start job is running for…EROCKET-DATA (1min 29s / 1min 30s)
^M[ ***  ] (2 of 2) A start job is running for…362263b5944c (1min 30s / 1min 30s)
^M[ TIME ] Timed out waiting for device /dev/disk/by-partlabel/BOTTLEROCKET-DATA.
[DEPEND] Dependency failed for Local Directory (/local).
...
[DEPEND] Dependency failed for Resize Data Partition.
[ TIME ] Timed out waiting for device /dev/d…4e8df-28b8-485c-9d19-362263b5944c.

Testing at scale

Launched 1000 instances with "split" layout AMI with both EBS attached. All hosts come up and join the cluster

$ kubectl get nodes -o wide --no-headers | wc
   1000   13000  215000

Launched 1500 instance with split image AMI with a single 12 GB EBS volume. All hosts comes up and joins the cluster.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

packages/release/label-data-alt.service Outdated Show resolved Hide resolved
packages/release/release.spec Outdated Show resolved Hide resolved
packages/release/release-repart-local.conf Show resolved Hide resolved
packages/release/label-data-pref.service Outdated Show resolved Hide resolved
@etungsten etungsten changed the title release, rpm2img, partyplanner: label BOTTLEROCKET_DATA during firstboot release, rpm2img, partyplanner: label BOTTLEROCKET-DATA during firstboot Feb 15, 2023
packages/release/formalize-data-part.service Outdated Show resolved Hide resolved
packages/release/formalize-data-part.service Outdated Show resolved Hide resolved
packages/release/label-data-alt.service Outdated Show resolved Hide resolved
packages/release/label-data-pref.service Outdated Show resolved Hide resolved
tools/partyplanner Outdated Show resolved Hide resolved
tools/partyplanner Outdated Show resolved Hide resolved
tools/partyplanner Outdated Show resolved Hide resolved
tools/rpm2img Outdated Show resolved Hide resolved
tools/rpm2img Outdated Show resolved Hide resolved
tools/rpm2img Outdated Show resolved Hide resolved
@etungsten
Copy link
Contributor Author

Push above addresses @bcressey 's comments. Changes a approach a bit. We don't append the fallback data partition if the image layout is set to "unified" since it's redundant.

Update PR description with new testing.

@etungsten
Copy link
Contributor Author

etungsten commented Feb 15, 2023

Push removes StandardError= from the two label-data-* oneshots so udev job messages show up in the console:
e.g.

[*     ] (1 of 3) A start job is running for…ive data partition (2s / no limit)                                                                                                                                                                                                           
^M[**    ] (1 of 3) A start job is running for…ive data partition (3s / no limit)                                                                                                                                                                                                         
^M[***   ] (1 of 3) A start job is running for…ive data partition (3s / no limit)                                                            
^M[ ***  ] (2 of 3) A start job is running for…/BOTTLEROCKET-DATA (4s / 1min 30s)                                                            
^M[  *** ] (2 of 3) A start job is running for…/BOTTLEROCKET-DATA (4s / 1min 30s)                                                            
^M[   ***] (2 of 3) A start job is running for…/BOTTLEROCKET-DATA (5s / 1min 30s)                                                            
^M[    **] (3 of 3) A start job is running for…-9d19-362263b5944c (5s / 1min 30s)                                                            
^M[     *] (3 of 3) A start job is running for…-9d19-362263b5944c (6s / 1min 30s)                                                            
^M[    **] (3 of 3) A start job is running for…-9d19-362263b5944c (6s / 1min 30s)                                                            
^M[   ***] (1 of 3) A start job is running for…ive data partition (7s / no limit)                                                            
^M[  *** ] (1 of 3) A start job is running for…ive data partition (7s / no limit)                                                            
^M[ ***  ] (1 of 3) A start job is running for…ive data partition (8s / no limit)  
...

This way it doesn't look like the boot is hanging when the oneshots are waiting for their data partitions.

packages/release/label-data-alt.service Outdated Show resolved Hide resolved
tools/partyplanner Outdated Show resolved Hide resolved
tools/rpm2img Outdated Show resolved Hide resolved
packages/release/release.spec Outdated Show resolved Hide resolved
packages/release/formalize-data-part.service Outdated Show resolved Hide resolved
@etungsten etungsten changed the title release, rpm2img, partyplanner: label BOTTLEROCKET-DATA during firstboot Label BOTTLEROCKET-DATA and create /local fs at runtime Feb 16, 2023
@etungsten
Copy link
Contributor Author

etungsten commented Feb 16, 2023

Pushes above addresses @bcressey's comments. Also adds a commit with the changes described in #2807 (comment) that moves the filesystem creation for /local from image build time to host runtime.

Re-did the tests as described in the PR description and the results are still as expected with the only difference being the new prepare-local-fs unit creating the ext4 local fs at runtime.

...
[  OK  ] Finished Label preferred data partition.                                                                                                                                                                                                                                         
[  OK  ] Found device Amazon Elastic Block Store BOTTLEROCKET-DATA.
         Starting Finalize BOTTLEROCKET-DATA...                       
         Starting Prepare Local Filesystem (/local)...                                                                                       
[  OK  ] Stopped Label alternative data partition.                                                                                           
[  OK  ] Finished Prepare Local Filesystem (/local).
[  OK  ] Finished Finalize BOTTLEROCKET-DATA.
         Mounting Local Directory (/local)...
[  OK  ] Mounted Local Directory (/local).
...

@etungsten
Copy link
Contributor Author

Push above renames finalize-data-part to finalize-data-label.

@etungsten
Copy link
Contributor Author

Push above adds a comment to explain the wait in `label-data-alternative'.

Also adds a dependency constraint between finalize-data-label and prepare-local-fs to ensure finalize-data-label always finishes before prepare-local-fs starts. This adds resiliency by preventing repart/mount/makefs operations from going out of order or racing against each other.

@etungsten
Copy link
Contributor Author

Added boot performance impact information to the PR description.

@etungsten etungsten changed the title Label BOTTLEROCKET-DATA and create /local fs at runtime Label BOTTLEROCKET-DATA at runtime Feb 17, 2023
@etungsten
Copy link
Contributor Author

etungsten commented Mar 2, 2023

Push above rebases onto develop.

edit: Oops, I did push all my changes along with the rebase.

@etungsten
Copy link
Contributor Author

Pushes above (including the rebase push) addresses @bcressey 's comments.

  • Replaced all 'preferred'/'alternative' nomenclature with 'A'/'B'
  • Now always append DATA-A to the OS image and let label-data-a grow it as much as possible always. (fail and not label if can't grow the partition)
  • Only include DATA-B when it's split.
  • DATA-A and DATA-B now has the same partition type GUID
  • Removed the notice from variant/README.md I will add the notice to the github discussions after this is merged and released.

Testing:

Split partition/ normal setup:

bash-5.1# journalctl -u label-data-a                                                                                                                                                                                                                                                      
Mar 02 22:52:11 localhost systemd[1]: Starting Label data partition A...                                                                                                                                                                                                                  
Mar 02 22:52:12 localhost systemd-repart[882]: Assertion 'amount <= total' failed at src/partition/repart.c:533, function charge_size(). Aborting.                                                                                                                                        
Mar 02 22:52:12 localhost systemd[1]: Finished Label data partition A.             

DATA-A fails to grow as expected because there's not enough free space on the root volume.

DATA-B successfully labels and grows:

bash-5.1# journalctl -u label-data-b                                                                                                                                                                                                                                                      
Mar 02 22:52:11 localhost systemd[1]: Starting Label data partition B...                                                                                                                                                                                                                  
Mar 02 22:52:12 localhost systemd-repart[883]: Applying changes.                                                                                                                                                                                                                          
Mar 02 22:52:12 localhost systemd-repart[883]: Storage does not support discard, not discarding gap at beginning of disk.                                                                                                                                                                 
Mar 02 22:52:12 localhost systemd-repart[883]: Growing existing partition 0.                                                                 
Mar 02 22:52:12 localhost systemd-repart[883]: Setting partition label of existing partition 0.                                                                                                                                                                                           
Mar 02 22:52:12 localhost systemd-repart[883]: Writing new partition table.                                                                                                                                                                                                               
Mar 02 22:52:12 localhost systemd-repart[883]: Telling kernel to reread partition table.                                                                                                                                                                                                  
Mar 02 22:52:12 localhost systemd-repart[883]: All done.                                                                                     
Mar 02 22:52:12 localhost systemd[1]: Finished Label data partition B.          

repart-local grows /local fs fine:

bash-5.1# journalctl -u repart-local
Mar 02 22:52:12 localhost systemd[1]: Starting Resize Data Partition...
Mar 02 22:52:12 localhost systemd-repart[915]: No changes.
Mar 02 22:52:12 localhost systemd-growfs[931]: Successfully resized "/local" to 19.9G bytes.
Mar 02 22:52:12 localhost systemd[1]: Finished Resize Data Partition.

On reboot, the label-data-* services don't run as expected due to the signpost safeguard:

-- Boot 92d597842cf74b3fb11c828bc7ad9071 --                                                                                                  
Mar 02 22:56:28 localhost systemd[1]: Label data partition A was skipped because of a failed condition check (ConditionFileNotEmpty=!/etc/has-boot-ever-succeeded).                                                                                                                       
Mar 02 22:56:31 ip-192-168-27-226.us-west-2.compute.internal systemd[1]: Label data partition A was skipped because of a failed condition check (ConditionFileNotEmpty=!/etc/has-boot-ever-succeeded).
Mar 02 22:56:32 ip-192-168-27-226.us-west-2.compute.internal systemd[1]: Label data partition A was skipped because of a failed condition check (ConditionFileNotEmpty=!/etc/has-boot-ever-succeeded).

lsblk:

bash-5.1# lsblk                                                                                                                                                                                                                                                                           
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0          7:0    0  312K  1 loop /aarch64-bottlerocket-linux-gnu/sys-root/usr/share/licenses
loop1          7:1    0 11.8M  1 loop /var/lib/kernel-devel/.overlay/lower
nvme0n1      259:0    0    2G  0 disk 
|-nvme0n1p1  259:2    0    4M  0 part 
|-nvme0n1p2  259:3    0    5M  0 part 
|-nvme0n1p3  259:4    0   40M  0 part /boot
|-nvme0n1p4  259:5    0  920M  0 part 
|-nvme0n1p5  259:6    0   10M  0 part 
|-nvme0n1p6  259:7    0   25M  0 part 
|-nvme0n1p7  259:8    0    5M  0 part 
|-nvme0n1p8  259:9    0   40M  0 part 
|-nvme0n1p9  259:10   0  920M  0 part 
|-nvme0n1p10 259:11   0   10M  0 part 
|-nvme0n1p11 259:12   0   25M  0 part 
|-nvme0n1p12 259:13   0   41M  0 part /var/lib/bottlerocket
`-nvme0n1p13 259:14   0    1M  0 part 
nvme1n1      259:1    0   20G  0 disk 
`-nvme1n1p1  259:15   0   20G  0 part /var
                                      /opt
                                      /mnt
                                      /local

Unified:

label-data-a runs successfully to label and grow the data partition on the root volume:

bash-5.1# journalctl -u label-data-a                                                                                                                                                                                                                                                      
Mar 02 23:00:04 localhost systemd[1]: Starting Label data partition A...                                                                                                                                                                                                                  
Mar 02 23:00:04 localhost systemd-repart[864]: Applying changes.                                                                                                                                                                                                                          
Mar 02 23:00:04 localhost systemd-repart[864]: Storage does not support discard, not discarding gap at beginning of disk.                    
Mar 02 23:00:04 localhost systemd-repart[864]: Growing existing partition 12.                                                                
Mar 02 23:00:04 localhost systemd-repart[864]: Setting partition label of existing partition 12.                                             
Mar 02 23:00:04 localhost systemd-repart[864]: Writing new partition table.                                                                                                                                                                                                               
Mar 02 23:00:04 localhost systemd-repart[864]: Telling kernel to reread partition table.                                                                                                                                                                                                  
Mar 02 23:00:04 localhost systemd-repart[864]: All done.                                                                                     
Mar 02 23:00:04 localhost systemd[1]: Finished Label data partition A.                                                                                                                                                                                                                    

label-data-b doesn't run because DATA-A was labelled

bash-5.1# journalctl -u label-data-b                                                                                                                                                                                                                                                      
Mar 02 23:01:33 ip-192-168-25-91.us-west-2.compute.internal systemd[1]: Label data partition B was skipped because of a failed condition check (ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA).

repart-local grows /local fine:

bash-5.1# journalctl -u repart-local                                                                                                         
Mar 02 23:00:04 localhost systemd[1]: Starting Resize Data Partition...                                                                      
Mar 02 23:00:04 localhost systemd-repart[891]: No changes.                                                                                   
Mar 02 23:00:05 localhost systemd-growfs[919]: Successfully resized "/local" to 20.0G bytes.                                                 
Mar 02 23:00:05 localhost systemd[1]: Finished Resize Data Partition.    

lsblk:

bash-5.1# lsblk                                                                                                                                                                                                                                                                           
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS                                                                                                                                                                                                                                         
loop0          7:0    0  312K  1 loop /aarch64-bottlerocket-linux-gnu/sys-root/usr/share/licenses                                                                                                                                                                                         
loop1          7:1    0 11.8M  1 loop /var/lib/kernel-devel/.overlay/lower                                                                                                                                                                                                                
nvme0n1      259:0    0   22G  0 disk                                                                                                                                                                                                                                                     
|-nvme0n1p1  259:1    0    4M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p2  259:2    0    5M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p3  259:3    0   40M  0 part /boot                                                                                                                                                                                                                                               
|-nvme0n1p4  259:4    0  920M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p5  259:5    0   10M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p6  259:6    0   25M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p7  259:7    0    5M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p8  259:8    0   40M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p9  259:9    0  920M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p10 259:10   0   10M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p11 259:11   0   25M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p12 259:12   0   41M  0 part /var/lib/bottlerocket                                                                                                                                                                                                                               
`-nvme0n1p13 259:13   0   20G  0 part /var                                                                                                                                                                                                                                                
                                      /opt                                                                                                                                                                                                                                                
                                      /mnt                                                                                                                                                                                                                                                
                                      /local  

Split but with data volume missing, root volume increased to 12GiB:

label-data-a runs successfully to label and grow data part:

bash-5.1# journalctl -u label-data-a
Mar 02 23:08:42 localhost systemd[1]: Starting Label data partition A...
Mar 02 23:08:42 localhost systemd-repart[801]: Applying changes.
Mar 02 23:08:42 localhost systemd-repart[801]: Storage does not support discard, not discarding gap at beginning of disk.
Mar 02 23:08:42 localhost systemd-repart[801]: Growing existing partition 12.
Mar 02 23:08:42 localhost systemd-repart[801]: Setting partition label of existing partition 12.
Mar 02 23:08:42 localhost systemd-repart[801]: Writing new partition table.
Mar 02 23:08:42 localhost systemd-repart[801]: Telling kernel to reread partition table.
Mar 02 23:08:42 localhost systemd-repart[801]: All done.
Mar 02 23:08:42 localhost systemd[1]: Finished Label data partition A. 

label-data-b doesn't run because label already exists

bash-5.1# journalctl -u label-data-b
Mar 02 23:10:11 ip-192-168-22-29.us-west-2.compute.internal systemd[1]: Label data partition B was skipped because of a failed condition check (ConditionPathIsSymbolicLink=!/dev/disk/by-partlabel/BOTTLEROCKET-DATA).

repart-local runs fine:

bash-5.1# journalctl -u repart-local
Mar 02 23:08:42 localhost systemd[1]: Starting Resize Data Partition...
Mar 02 23:08:42 localhost systemd-repart[823]: No changes.
Mar 02 23:08:43 localhost systemd-growfs[839]: Successfully resized "/local" to 10.0G bytes.
Mar 02 23:08:43 localhost systemd[1]: Finished Resize Data Partition.

lsblk:

bash-5.1# lsblk                                                                                                                                                                                                                                                                           
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS                                                                                                                                                                                                                                         
loop0          7:0    0  312K  1 loop /aarch64-bottlerocket-linux-gnu/sys-root/usr/share/licenses                                                                                                                                                                                         
loop1          7:1    0 11.8M  1 loop /var/lib/kernel-devel/.overlay/lower                                                                                                                                                                                                                
nvme0n1      259:0    0   12G  0 disk                                                                                                                                                                                                                                                     
|-nvme0n1p1  259:1    0    4M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p2  259:2    0    5M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p3  259:3    0   40M  0 part /boot                                                                                                                                                                                                                                               
|-nvme0n1p4  259:4    0  920M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p5  259:5    0   10M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p6  259:6    0   25M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p7  259:7    0    5M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p8  259:8    0   40M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p9  259:9    0  920M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p10 259:10   0   10M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p11 259:11   0   25M  0 part                                                                                                                                                                                                                                                     
|-nvme0n1p12 259:12   0   41M  0 part /var/lib/bottlerocket                                                                                                                                                                                                                               
`-nvme0n1p13 259:13   0   10G  0 part /var                                                                                                                                                                                                                                                
                                      /opt                                                                                                                                                                                                                                                
                                      /mnt                                                                                                                                                                                                                                                
                                      /local  

blkid:

bash-5.1# blkid                                                                                                                              
/dev/loop1: TYPE="squashfs"                                                                                                                  
/dev/nvme0n1p9: PARTLABEL="BOTTLEROCKET-ROOT-B" PARTUUID="dc9edc02-7af6-4cc4-87ec-33d63f278a59"                                              
/dev/nvme0n1p11: PARTLABEL="BOTTLEROCKET-RESERVED-B" PARTUUID="b0887f5b-6217-42fc-bbb0-ae15ac757504"                                         
/dev/nvme0n1p7: PARTLABEL="EFI-BACKUP" PARTUUID="ed23b81f-25d7-4d34-af1a-5f811078d447"
/dev/nvme0n1p5: UUID="cbda2e08-22b9-4706-bbed-7b7ba35af4f5" TYPE="DM_verity_hash" PARTLABEL="BOTTLEROCKET-HASH-A" PARTUUID="8fd5e47c-4ab3-4d1b-8cea-90dcbb8685c6"
/dev/nvme0n1p3: UUID="8612c5a4-8c83-48ea-8491-fc23e33f28de" BLOCK_SIZE="1024" TYPE="ext4" PARTLABEL="BOTTLEROCKET-BOOT-A" PARTUUID="3a4db7c9-34ee-44f5-90fd-97421d8b99c5"
/dev/nvme0n1p1: PARTLABEL="BIOS-BOOT" PARTUUID="55a64c77-b372-46c4-a92f-edca27d20ee5"
/dev/nvme0n1p12: UUID="5c1a5891-8afe-4e0f-bd29-762e9cbc5952" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-PRIVATE" PARTUUID="4bdb3d29-a321-44c4-8352-286d50c42e18"
/dev/nvme0n1p8: PARTLABEL="BOTTLEROCKET-BOOT-B" PARTUUID="502fa194-f311-419c-b8f0-6fdafb3f4b6e"                                              
/dev/nvme0n1p10: PARTLABEL="BOTTLEROCKET-HASH-B" PARTUUID="f7e305a5-e0d1-4f80-b288-4001719d3e97"
/dev/nvme0n1p6: PARTLABEL="BOTTLEROCKET-RESERVED-A" PARTUUID="34b46d2b-6f12-4766-b932-8f7cbd9adbed"                                          
/dev/nvme0n1p4: UUID="6709a107-8120-4348-a9c2-6860f8e50f3d" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="BOTTLEROCKET-ROOT-A" PARTUUID="71ac2af2-d965-4115-8162-8cd0382b0cda"
/dev/nvme0n1p2: SEC_TYPE="msdos" UUID="78B0-7865" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI-SYSTEM" PARTUUID="0f2ce9b4-fc96-4900-895d-1046fb9816e0"
/dev/nvme0n1p13: UUID="78e9e4dd-6fab-4400-ab0f-dcce8ea72809" BLOCK_SIZE="1024" TYPE="ext4" PARTLABEL="BOTTLEROCKET-DATA" PARTUUID="5b94e8df-28b8-485c-9d19-362263b5944c"
/dev/loop0: TYPE="squashfs"                                                                                                                  
/dev/dm-0: UUID="6709a107-8120-4348-a9c2-6860f8e50f3d" BLOCK_SIZE="4096" TYPE="ext4"

@etungsten
Copy link
Contributor Author

Push above fixes commit message

@etungsten
Copy link
Contributor Author

etungsten commented Mar 2, 2023

Push above fixes some inaccurate comments.

@etungsten
Copy link
Contributor Author

Push above is just a rebase to get github actions going again.

@etungsten
Copy link
Contributor Author

Push above rebases onto develop and resolves conflict.

Copy link
Contributor

@bcressey bcressey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just one last minor cleanup suggestion.

packages/release/release.spec Outdated Show resolved Hide resolved
Changes partitioning to always keep a data partition on the os image.
We grow and label data partition at runtime. We will still create a
separate data partiion on the second volume/disk for "split" partition
layouts.

We add two new services that run as part of 'local-fs.target' and
before 'local.mount' and 'repart-local.service':
  * 'label-data-a.service'
  * 'label-data-b.service'

'label-data-a' and 'label-data-b' will "compete" and both try to
label 'BOTTLEROCKET-DATA' first with the partition they're each waiting
for.

'label-data-a' waits for the data partition that resides on the OS disk
image. Once that device is ready, we call 'systemd-repart' to relabel it
as 'BOTTLEROCKET-DATA' and grow it as much as possible.

'label-data-b' calls 'systemd-repart' to label the data partition on
the data image as 'BOTTLEROCKET-DATA' and grow the partition to fill the
remainder of the disk.

All of this lets the host to boot if data partition on the data image
doesn't exist and the root filesystem disk has leftover extra space to
accommodate a reasonably-sized back-up data partition.
'mark-successful-boot' now also updates BOTTLEROCKET_PRIVATE's GPT table
attribute to indicate whether boot has ever succeeded before.

Add a new 'has-boot-ever-succeeded' subcommand for checking if boot has
ever succeeded before
This adds additional safeguards to prevent a different data partition
from being labeled and resized if the host has ever booted successfully
in the past with an original data partition.
@etungsten
Copy link
Contributor Author

etungsten commented Mar 8, 2023

Push above removes the redundant repart conf and now just keeps the single 80-local.conf.

Tested things and they still work as expected.

Copy link
Contributor

@yeazelm yeazelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@etungsten etungsten merged commit 5a4c65d into bottlerocket-os:develop Mar 8, 2023
@etungsten etungsten deleted the rerepart branch March 8, 2023 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an alternative/fallback data partition when the data volume is unavailable
7 participants