From 24009f677de553bb2e6b61ae06c81a3d4ad1c647 Mon Sep 17 00:00:00 2001
From: nl6720 <nl6720@gmail.com>
Date: Tue, 21 May 2024 13:17:12 +0300
Subject: [PATCH] install_arch: align partition end

sgdisk does not align the partition size/end by default. The
`-I`/`--align-end` option needs to be used to enable alignment. See
https://wiki.archlinux.org/title/Advanced_Format#Partition_alignment

Additionally use the partition names (PARTLABELs) that gdisk and cgdisk
set (but sgdisk doesn't) and follow the Discoverable Partitions
Specification by useing the appropriate partition for the root partition.
See https://wiki.archlinux.org/title/Partitioning#Single_root_partition
---
 roles/install_arch/tasks/main.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/roles/install_arch/tasks/main.yml b/roles/install_arch/tasks/main.yml
index cb39bce41..e86ec1635 100644
--- a/roles/install_arch/tasks/main.yml
+++ b/roles/install_arch/tasks/main.yml
@@ -30,21 +30,21 @@
       lineinfile: name=/root/.gnupg/dirmngr.conf create=yes line=no-use-tor owner=root group=root mode=0644
 
 - name: Create GRUB embed partitions
-  command: sgdisk -g --clear -n 1:0:+1M {{ item }} -c 1:boot -t 1:ef02
+  command: sgdisk -g -I --clear -n 1:0:+1M {{ item }} -c 1:'BIOS boot partition' -t 1:ef02
   with_items:
     - "{{ system_disks }}"
   register: sgdisk
   changed_when: "sgdisk.rc == 0"
 
-- name: Create EFI partitions
-  command: sgdisk -g -n 2:0:+512M {{ item }} -c 2:efi -t 2:ef00
+- name: Create EFI system partitions
+  command: sgdisk -g -I -n 2:0:+512M {{ item }} -c 2:'EFI system partition' -t 2:ef00
   with_items:
     - "{{ system_disks }}"
   register: sgdisk
   changed_when: "sgdisk.rc == 0"
 
 - name: Create root partitions
-  command: sgdisk -n 3:0:0 {{ item }} -c 3:root
+  command: sgdisk -I -n 3:0:0 {{ item }} -c 3:root -t 3:8304
   with_items:
     - "{{ system_disks }}"
   register: sgdisk
-- 
GitLab