From ee6843f01f382ac81a6ea48f7c3c074e56b5a996 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 2 Jul 2020 02:00:06 +0200 Subject: another attempt to tackle root_lvm_size issue --- .../debian/preseed/templates/partman_config.j2 | 48 ++++++++++++++++------ .../preseed/templates/partman_early-command.sh.j2 | 6 +++ 2 files changed, 41 insertions(+), 13 deletions(-) (limited to 'roles/installer/debian/preseed/templates') diff --git a/roles/installer/debian/preseed/templates/partman_config.j2 b/roles/installer/debian/preseed/templates/partman_config.j2 index 2d125b50..88b6a088 100644 --- a/roles/installer/debian/preseed/templates/partman_config.j2 +++ b/roles/installer/debian/preseed/templates/partman_config.j2 @@ -19,9 +19,17 @@ d-i partman-auto-lvm/no_boot boolean true d-i partman-efi/non_efi_system boolean true d-i partman/choose_label string gpt d-i partman/default_label string gpt +d-i partman-partitioning/choose_label string gpt +d-i partman-partitioning/default_label string gpt +d-i partman-basicfilesystems/choose_label string gpt +d-i partman-basicfilesystems/default_label string gpt {% else %} -d-i partman/choose_label string dos -d-i partman/default_label string dos +d-i partman/choose_label string msdos +d-i partman/default_label string msdos +d-i partman-partitioning/choose_label string msdos +d-i partman-partitioning/default_label string msdos +d-i partman-basicfilesystems/choose_label string msdos +d-i partman-basicfilesystems/default_label string msdos {% endif %} @@ -31,44 +39,56 @@ d-i partman-auto/method string raid d-i partman-auto/method string lvm {% endif %} -d-i partman-auto/choose_recipe select ansible d-i partman-auto/expert_recipe string \ ansible :: \ {% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ + 128 128 128 fat16 \ $primary{ } $bootable{ } \ method{ efi } format{ } \ . \ {% endif %} {% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} - 256 10000 256 raid \ + 256 256 256 raid \ $lvmignore{ } $primary{ } $bootable{ } \ method{ raid } \ . \ - 1000 10000 -1 raid \ + 10240 10340 -1 raid \ $lvmignore{ } $primary{ } \ method{ raid } \ . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ +{% else %} +{% if 'root_lvm_size' in hostvars[install_hostname].install_cooked.disks and hostvars[install_hostname].install_cooked.disks.root_lvm_size != 'all' %} +{% set root_lvm_size = ((hostvars[install_hostname].install_cooked.disks.root_lvm_size | human_to_bytes) / (1024*1024)) | int %} + {{ root_lvm_size }} {{ root_lvm_size }} {{ root_lvm_size }} lvm \ + $defaultignore{ } $primary{ } \ method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ . \ - 2048 10000 2560 ext4 \ + 8 108 -1 ext4 \ + $defaultignore{ } $primary{ } \ + method{ unused } \ + . \ +{% else %} + 5120 5120 5120 lvm \ + $defaultignore{ } $primary{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ +{% endif %} +{% endif %} + 2560 2560 2560 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ . \ - 1024 10000 1280 ext4 \ + 1280 1280 1280 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ /var } \ . \ - 768 10000 768 ext4 \ + 768 768 768 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ @@ -78,13 +98,15 @@ d-i partman-auto/expert_recipe string options/noatime{ noatime } \ options/noexec{ noexec } \ . \ - 16 20000 -1 ext4 \ + 8 108 -1 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ lv_name{ dummy } \ + method{ unused } \ . + d-i partman-basicfilesystems/no_swap true d-i partman-partitioning/confirm_write_new_label boolean true d-i partman/choose_partition select finish diff --git a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 index 9c720e92..6187fbea 100644 --- a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 +++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 @@ -31,3 +31,9 @@ debconf-set grub-installer/bootdev "$disks" ## https://unix.stackexchange.com/questions/510445/install-grub-bootloader-dynamically-to-multiple-disks . /usr/share/debconf/confmodule db_fset grub-installer/bootdev seen true + + +## wipe existing partition tables, 1M should be enough to get rid of them +for disk in $disks; do + dd if=/dev/zero "of=$disk" bs=32768 count=32 +done -- cgit v1.2.3