lol

Merge pull request #102174 from grahamc/ami-root-use-gpt

AMI root partition table: use GPT to support >2T partitions

authored by

Graham Christensen and committed by
GitHub
38a394bd 860a3a23

+16 -2
+15 -1
nixos/lib/make-disk-image.nix
··· 28 28 # partition of reasonable size is created in addition to the root partition. 29 29 # For "legacy", the msdos partition table is used and a single large root 30 30 # partition is created. 31 + # For "legacy+gpt", the GPT partition table is used, a 1MiB no-fs partition for 32 + # use by the bootloader is created, and a single large root partition is 33 + # created. 31 34 # For "hybrid", the GPT partition table is used and a mandatory ESP 32 35 # partition of reasonable size is created in addition to the root partition. 33 36 # Also a legacy MBR will be present. ··· 54 57 format ? "raw" 55 58 }: 56 59 57 - assert partitionTableType == "legacy" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none"; 60 + assert partitionTableType == "legacy" || partitionTableType == "legacy+gpt" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none"; 58 61 # We use -E offset=X below, which is only supported by e2fsprogs 59 62 assert partitionTableType != "none" -> fsType == "ext4"; 60 63 ··· 75 78 76 79 rootPartition = { # switch-case 77 80 legacy = "1"; 81 + "legacy+gpt" = "2"; 78 82 efi = "2"; 79 83 hybrid = "3"; 80 84 }.${partitionTableType}; ··· 84 88 parted --script $diskImage -- \ 85 89 mklabel msdos \ 86 90 mkpart primary ext4 1MiB -1 91 + ''; 92 + "legacy+gpt" = '' 93 + parted --script $diskImage -- \ 94 + mklabel gpt \ 95 + mkpart no-fs 1MB 2MB \ 96 + set 1 bios_grub on \ 97 + align-check optimal 1 \ 98 + mkpart primary ext4 2MB -1 \ 99 + align-check optimal 2 \ 100 + print 87 101 ''; 88 102 efi = '' 89 103 parted --script $diskImage -- \
+1 -1
nixos/maintainers/scripts/ec2/amazon-image.nix
··· 57 57 inherit (cfg) contents format name; 58 58 pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package 59 59 partitionTableType = if config.ec2.efi then "efi" 60 - else if config.ec2.hvm then "legacy" 60 + else if config.ec2.hvm then "legacy+gpt" 61 61 else "none"; 62 62 diskSize = cfg.sizeMB; 63 63 fsType = "ext4";