Grub2 and 2 TB+ disks

I have through the years installed many Debian installations. I prefer an installation with a tree disk raid 5 setup. Here I at minimum add three raid partitions.

  • SWAP (size 2 x RAM size) RAID
  • BOOT (512 MB) RAID [boot flag]
  • ROOT (20 to 50 GB) LWM

The LWM volume is split into a ROOT (/) and a HOME (/home) partition. During the installation, we must add a boot flag to the BOOT partition, in order to make Debian able to boot from the partition. This is important as it is a raid partition, and therefore must be marked as bootable.

This approach has worked for many years. However as disk sizes have grown, I recently tried to install a server with 3 x 2 TB disks. But when I tried to mark the boot partition as bootable, I was not able to do this. Therefore I could not boot the server after the installation.
Even if I did not make the BOOT partition a raid partition, I could not mark it as bootable. After google around for a while I found the solution.
The reason why I could not add a boot flag was, that when a disk exceed 2TB it uses a different partition scheme (GPT) instead of the old (msdos). GPT however does not support a boot flag. In order to overcome the problem, we must add a small forth partition with the type BIOS-GRUB. This only needs to be 50 MB or so. The boot partition then does not need a boot flag, as this is contained in the BIOS-GRUB partition. Therefore the new layout looks like this.

  • SWAP (size 2 x RAM size) RAID
  • BIOS-GRUB (50 MB)
  • BOOT (512 MB) RAID
  • ROOT (20 to 50 GB) LWM

After the installation, we must run these commands

grub-install /dev/sdb
grub-install /dev/sdc

This installs grub to the rest of the partitions. Now we are able to remove one arbitrary disk, and the system is still able to boot.

As a bonus I added how to create a new disk, not using the installer. This example add a BIOS-GRUB partiton, and 2 raid partitions. One for SWAP and one for LWM, which contains the rest. /boot, /home, / etc.

parted /dev/sdb mklabel gpt
parted /dev/sdb mkpart bios_grub 34s 1987s
parted /dev/sdb mkpart part2 1988s 1001988s
parted /dev/sdb mkpart part3 1001989s 3907029118s
parted /dev/sdb toggle 1 bios_grub
parted /dev/sdb toggle 2 raid
parted /dev/sdb toggle 3 raid

Leave a Reply