Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

merged 2 commits into from Oct 30, 2020


Copy link

@grahamc grahamc commented Oct 30, 2020

Motivation for this change

With the MBR partition table, it is impossible extend the root disk beyond 2T. This became quite a literal nightmare for me, so let's swap it to GPT. Note: NixOps refers to the root partition with by-label/nixos which continues to work.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits
nixos/lib/make-disk-image.nix Outdated Show resolved Hide resolved
cole-h approved these changes Oct 30, 2020
Copy link

@cole-h cole-h left a comment

Diff LGTM.

Copy link

@samueldr samueldr left a comment

Minor nit, otherwise looks good.

@@ -28,6 +28,9 @@
# 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
# partition is created.
# For "legacy+gpt", the GPT partition table is used, a 1049K no-fs partition for
Copy link

@samueldr samueldr Oct 30, 2020

1049K? I see 1MiB later on.

I would also document that it's a BIOS Boot partition, the actual human-friendly name of the partition type that parted calls "bios_grub".

Copy link
Member Author

@grahamc grahamc Oct 30, 2020

Yes, I was surprised by this too.

Check out out what parted has to say:

Disk /build/nixos.raw: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  2097kB  1049kB               no-fs    bios_grub
 2      2097kB  2146MB  2144MB  ext4         primary

Copy link
Member Author

@grahamc grahamc Oct 30, 2020

from sfdisk, per @samueldr's suggestion:

Device     Start         End     Sectors  Size Type
/dev/xvda1  2048        4095        2048    1M BIOS boot
/dev/xvda2  4096 10485759966 10485755871  4.9T Linux filesystem

@grahamc grahamc force-pushed the ami-root-use-gpt branch from 601f3fd to d77ddf2 Oct 30, 2020
@grahamc grahamc merged commit 38a394b into NixOS:master Oct 30, 2020
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants