diff options
author | nl6720 <nl6720@gmail.com> | 2022-06-17 18:03:10 +0300 |
---|---|---|
committer | nl6720 <nl6720@gmail.com> | 2023-03-26 19:35:28 +0300 |
commit | 7330031441ffa681b2e2e1ad638fab74284cabc7 (patch) | |
tree | 26a60bce4343fe2689ef74872ea70f06c734d1d2 | |
parent | 19de70995a4f8996868596ac8cf2bca9c61b3952 (diff) |
Align the partition end sectors and add partition names
sgdisk by default only aligns the partition start. Use the --align-end option to align the partition end too.
Additionally:
* Add PARTLABEL values to all partitions.
* Do not hardcode the partition number and end sectors in sgdisk commands by using the special value "0".
* Follow the Discoverable Partitions Specification by using the "Linux x86-64 root" partition type.
-rwxr-xr-x | build-inside-vm.sh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/build-inside-vm.sh b/build-inside-vm.sh index ffbab01..2d45208 100755 --- a/build-inside-vm.sh +++ b/build-inside-vm.sh @@ -46,9 +46,10 @@ trap cleanup EXIT # Create the disk, partitions it, format the partition and mount the filesystem function setup_disk() { truncate -s "${DEFAULT_DISK_SIZE}" "${IMAGE}" - sgdisk --clear \ - --new 1::+1M --typecode=1:ef02 \ - --new 2::-0 --typecode=2:8300 \ + sgdisk --align-end \ + --clear \ + --new 0:0:+1M --typecode=0:ef02 --change-name=0:'BIOS boot partition' \ + --new 0:0:0 --typecode=0:8304 --change-name=0:'Arch Linux root' \ "${IMAGE}" LOOPDEV=$(losetup --find --partscan --show "${IMAGE}") @@ -147,9 +148,9 @@ function create_image() { cp -a "${IMAGE}" "${tmp_image}" if [ -n "${DISK_SIZE}" ]; then truncate -s "${DISK_SIZE}" "${tmp_image}" - sgdisk --delete 2 "${tmp_image}" - sgdisk --move-second-header \ - --new 2::-0 --typecode=2:8300 \ + sgdisk --align-end --delete 2 "${tmp_image}" + sgdisk --align-end --move-second-header \ + --new 0:0:0 --typecode=0:8304 --change-name=0:'Arch Linux root' \ "${tmp_image}" fi mount_image "${tmp_image}" |