Skip to content

Commit

Permalink
create_disk: add reserved partition entries to aarch64,ppc64le
Browse files Browse the repository at this point in the history
We decided to try to keep the partition numbers in sync across our
x86_64, aarch64, and ppc64le platforms. Previously we skipped partition
numbers on some architectures (for example there was no sda1 by default
on aarch64) and this caused a few issues:

- user confusion
    - it is a common misconception that partition numbers need to start
      at one and increment
    - it can be surprising if the disk layout changes when you go from
      one architecture from the other and re-use the same ignition config
- tooling bugs
    - the butane templates for device boot mirroring didn't include
      partition numbers and ended up with inconsistent behavior on
      aarch64/ppc64le versus x86_64

Keeping the partition numbers in sync will help alleviate some of these
issues.

Fixes: coreos/fedora-coreos-tracker#855
  • Loading branch information
dustymabe committed Sep 6, 2021
1 parent 5ab3d70 commit 228383d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/create_disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ set -x
# Partition and create fs's. The 0...4...a...1 uuid is a sentinal used by coreos-gpt-setup
# in ignition-dracut. It signals that the disk needs to have it's uuid randomized and the
# backup header moved to the end of the disk.
# Pin /boot and / to the partition number 3 and 4 respectively
# Pin /boot and / to the partition number 3 and 4 respectively. Also insert reserved
# partitions on aarch64/ppc64le to keep the 1,2,3,4 partition numbers aligned across
# x86_64/aarch64/ppc64le. We decided not to try to achieve partition parity on s390x
# because a bare metal install onto an s390x DASD translates the GPT to DASD partitions
# and we only get three of those. https://github.com/coreos/fedora-coreos-tracker/issues/855
BOOTPN=3
ROOTPN=4
# Make the size relative
Expand All @@ -122,9 +126,11 @@ case "$arch" in
sgdisk -p "$disk"
;;
aarch64)
RESERVEDPN=1
EFIPN=2
sgdisk -Z $disk \
-U "${uninitialized_gpt_uuid}" \
-n ${RESERVEDPN}:0:+1M -c ${RESERVEDPN}:reserved -t ${RESERVEDPN}:8DA63339-0007-60C0-C436-083AC8230908 \
-n ${EFIPN}:0:+127M -c ${EFIPN}:EFI-SYSTEM -t ${EFIPN}:C12A7328-F81F-11D2-BA4B-00A0C93EC93B \
-n ${BOOTPN}:0:+384M -c ${BOOTPN}:boot \
-n ${ROOTPN}:0:${rootfs_size} -c ${ROOTPN}:root -t ${ROOTPN}:0FC63DAF-8483-4772-8E79-3D69D8477DE4
Expand All @@ -143,10 +149,12 @@ case "$arch" in
;;
ppc64le)
PREPPN=1
RESERVEDPN=2
# ppc64le doesn't use special uuid for root partition
sgdisk -Z $disk \
-U "${uninitialized_gpt_uuid}" \
-n ${PREPPN}:0:+4M -c ${PREPPN}:PowerPC-PReP-boot -t ${PREPPN}:9E1A2D38-C612-4316-AA26-8B49521E5A8B \
-n ${RESERVEDPN}:0:+1M -c ${RESERVEDPN}:reserved -t ${RESERVEDPN}:8DA63339-0007-60C0-C436-083AC8230908 \
-n ${BOOTPN}:0:+384M -c ${BOOTPN}:boot \
-n ${ROOTPN}:0:${rootfs_size} -c ${ROOTPN}:root -t ${ROOTPN}:0FC63DAF-8483-4772-8E79-3D69D8477DE4
sgdisk -p "$disk"
Expand Down

0 comments on commit 228383d

Please sign in to comment.