28.10.2017 11:49
28.10.2017 11:40

Booting with GRUB2 from GPT

As the drives are growing the Master Boot Record becomes a limitations to the disk partitioning as it can only address drives up to 2TB with 512B sector size (there are sometimes drives with 4kB sectors that could be larger). For that reason a new partitioning table was introduced - GUID Partition Table approximately at the same time also (U)EFI shown, but GPT could be used without the balast of UEFI. Anchor.com has a very good article explaining the difference between MBR and GPT together with GRUB.

Pay attention to the necessity of a BIOS Boot Partition. Without it GRUB will not install on a GPT partitioned disk. Do not forget that GPT prefers the partition alignment to 2048 sectors. This is also the reason the BBP is usually 1MB (2048*512B).

You may end up with something like using gdisk:

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            6143   2.0 MiB     EF02  BIOS boot partition
   2            6144         8394751   4.0 GiB     8200  Linux swap
   3         8394752        10491903   1024.0 MiB  FD00  Linux RAID
   4        10491904        94377983   40.0 GiB    FD00  Linux RAID
   5        94377984      5860533134   2.7 TiB     FD00  Linux RAID

grub-install

The problem may arise if you install grub from a MBR loaded system to a GPT partitioned disk.

In that case it could happen, that the stage 1.5 of the grub does not have a part_gpt module and you end up  at boot in with

error: no such disk
Entering rescue mode...
grub rescue>

This problem can not be solved from the grub rescue shell, because it won't recognize the GPT partitions and it is not able to get to the grub stage 2. You need to explicitely instruct GRUB to install with module part_gpt.

grub-install --modules=part_gpt /dev/sdd

The same applies if you are preparing a new GPT with e.g. RAID array - do not forget to explicitly load a raid and mdraid1x modules.

CZ article about what commands could be used in various GRUB stages.

Email comment