mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
Merge pull request #102174 from grahamc/ami-root-use-gpt
AMI root partition table: use GPT to support >2T partitions
This commit is contained in:
commit
38a394bdee
2 changed files with 16 additions and 2 deletions
|
@ -28,6 +28,9 @@
|
||||||
# partition of reasonable size is created in addition to the root partition.
|
# partition of reasonable size is created in addition to the root partition.
|
||||||
# For "legacy", the msdos partition table is used and a single large root
|
# For "legacy", the msdos partition table is used and a single large root
|
||||||
# partition is created.
|
# partition is created.
|
||||||
|
# For "legacy+gpt", the GPT partition table is used, a 1MiB no-fs partition for
|
||||||
|
# use by the bootloader is created, and a single large root partition is
|
||||||
|
# created.
|
||||||
# For "hybrid", the GPT partition table is used and a mandatory ESP
|
# For "hybrid", the GPT partition table is used and a mandatory ESP
|
||||||
# partition of reasonable size is created in addition to the root partition.
|
# partition of reasonable size is created in addition to the root partition.
|
||||||
# Also a legacy MBR will be present.
|
# Also a legacy MBR will be present.
|
||||||
|
@ -54,7 +57,7 @@
|
||||||
format ? "raw"
|
format ? "raw"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert partitionTableType == "legacy" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none";
|
assert partitionTableType == "legacy" || partitionTableType == "legacy+gpt" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none";
|
||||||
# We use -E offset=X below, which is only supported by e2fsprogs
|
# We use -E offset=X below, which is only supported by e2fsprogs
|
||||||
assert partitionTableType != "none" -> fsType == "ext4";
|
assert partitionTableType != "none" -> fsType == "ext4";
|
||||||
|
|
||||||
|
@ -75,6 +78,7 @@ let format' = format; in let
|
||||||
|
|
||||||
rootPartition = { # switch-case
|
rootPartition = { # switch-case
|
||||||
legacy = "1";
|
legacy = "1";
|
||||||
|
"legacy+gpt" = "2";
|
||||||
efi = "2";
|
efi = "2";
|
||||||
hybrid = "3";
|
hybrid = "3";
|
||||||
}.${partitionTableType};
|
}.${partitionTableType};
|
||||||
|
@ -85,6 +89,16 @@ let format' = format; in let
|
||||||
mklabel msdos \
|
mklabel msdos \
|
||||||
mkpart primary ext4 1MiB -1
|
mkpart primary ext4 1MiB -1
|
||||||
'';
|
'';
|
||||||
|
"legacy+gpt" = ''
|
||||||
|
parted --script $diskImage -- \
|
||||||
|
mklabel gpt \
|
||||||
|
mkpart no-fs 1MB 2MB \
|
||||||
|
set 1 bios_grub on \
|
||||||
|
align-check optimal 1 \
|
||||||
|
mkpart primary ext4 2MB -1 \
|
||||||
|
align-check optimal 2 \
|
||||||
|
print
|
||||||
|
'';
|
||||||
efi = ''
|
efi = ''
|
||||||
parted --script $diskImage -- \
|
parted --script $diskImage -- \
|
||||||
mklabel gpt \
|
mklabel gpt \
|
||||||
|
|
|
@ -57,7 +57,7 @@ in {
|
||||||
inherit (cfg) contents format name;
|
inherit (cfg) contents format name;
|
||||||
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
|
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
|
||||||
partitionTableType = if config.ec2.efi then "efi"
|
partitionTableType = if config.ec2.efi then "efi"
|
||||||
else if config.ec2.hvm then "legacy"
|
else if config.ec2.hvm then "legacy+gpt"
|
||||||
else "none";
|
else "none";
|
||||||
diskSize = cfg.sizeMB;
|
diskSize = cfg.sizeMB;
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue