From 59670e876abd757b5f5b34898a209dc13c3c185b Mon Sep 17 00:00:00 2001 From: Sandwich Date: Sun, 22 Feb 2026 02:39:36 +0100 Subject: [PATCH] fix(partitioning): add partition separator for NVMe/mmcblk device paths --- roles/partitioning/defaults/main.yml | 7 +++++-- roles/partitioning/tasks/_create_filesystems.yml | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/roles/partitioning/defaults/main.yml b/roles/partitioning/defaults/main.yml index 45cfb7a..d6d0bc0 100644 --- a/roles/partitioning/defaults/main.yml +++ b/roles/partitioning/defaults/main.yml @@ -1,5 +1,8 @@ --- partitioning_btrfs_compress_opt: "{{ 'compress=zstd:15' if system_cfg.features.zstd.enabled | bool else '' }}" +# Partition separator: 'p' for NVMe/mmcblk (device path ends in digit), empty for SCSI/virtio. +# Examples: /dev/sda → /dev/sda1, /dev/nvme0n1 → /dev/nvme0n1p1 +partitioning_part_sep: "{{ 'p' if (install_drive | default('') | regex_search('\\d$')) else '' }}" partitioning_boot_partition_suffix: 1 partitioning_main_partition_suffix: 2 partitioning_efi_size_mib: 512 @@ -113,12 +116,12 @@ partitioning_grub_enable_cryptodisk: >- and not (partitioning_separate_boot | bool) and (partitioning_efi_mountpoint == '/boot/efi') }} -partitioning_luks_device: "{{ install_drive ~ (partitioning_root_partition_suffix | string) }}" +partitioning_luks_device: "{{ install_drive ~ partitioning_part_sep ~ (partitioning_root_partition_suffix | string) }}" partitioning_root_device: >- {{ '/dev/mapper/' + system_cfg.luks.mapper if (system_cfg.luks.enabled | bool) - else install_drive ~ (partitioning_root_partition_suffix | string) + else install_drive ~ partitioning_part_sep ~ (partitioning_root_partition_suffix | string) }} partitioning_disk_size_gb: >- {{ diff --git a/roles/partitioning/tasks/_create_filesystems.yml b/roles/partitioning/tasks/_create_filesystems.yml index 840c39b..ae724dd 100644 --- a/roles/partitioning/tasks/_create_filesystems.yml +++ b/roles/partitioning/tasks/_create_filesystems.yml @@ -3,7 +3,7 @@ block: - name: Create FAT32 filesystem in boot partition community.general.filesystem: - dev: "{{ install_drive }}{{ partitioning_boot_partition_suffix }}" + dev: "{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_partition_suffix }}" fstype: vfat opts: -F32 -n BOOT force: true @@ -11,7 +11,7 @@ - name: Create filesystem for /boot partition when: partitioning_separate_boot | bool community.general.filesystem: - dev: "{{ install_drive }}{{ partitioning_boot_fs_partition_suffix }}" + dev: "{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_fs_partition_suffix }}" fstype: "{{ partitioning_boot_fs_fstype }}" opts: "{{ '-m bigtime=0 -i nrext64=0,exchange=0 -n parent=0' if (is_rhel | bool and partitioning_boot_fs_fstype == 'xfs') else omit }}" force: true @@ -23,7 +23,7 @@ - os in ['almalinux', 'rocky', 'rhel'] or (os == 'debian' and (os_version | string) == '11') ansible.builtin.command: >- tune2fs -O "^orphan_file,^metadata_csum_seed" - "{{ install_drive }}{{ partitioning_boot_fs_partition_suffix }}" + "{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_fs_partition_suffix }}" register: partitioning_boot_ext4_tune_result changed_when: false @@ -39,7 +39,7 @@ ansible.builtin.include_tasks: "{{ system_cfg.filesystem }}.yml" - name: Get UUID for boot filesystem - ansible.builtin.command: blkid -s UUID -o value '{{ install_drive }}{{ partitioning_boot_partition_suffix }}' + ansible.builtin.command: blkid -s UUID -o value '{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_partition_suffix }}' register: partitioning_boot_uuid changed_when: false failed_when: partitioning_boot_uuid.rc != 0 or (partitioning_boot_uuid.stdout | trim | length) == 0 @@ -47,7 +47,7 @@ - name: Get UUID for /boot filesystem when: partitioning_separate_boot | bool ansible.builtin.command: >- - blkid -s UUID -o value '{{ install_drive }}{{ partitioning_boot_fs_partition_suffix }}' + blkid -s UUID -o value '{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_fs_partition_suffix }}' register: partitioning_boot_fs_uuid changed_when: false failed_when: partitioning_boot_fs_uuid.rc != 0 or (partitioning_boot_fs_uuid.stdout | trim | length) == 0