GRUB on a BIOS System
GRUB on a BIOS system can use either a Master Boot Record (MBR) disk or a GUID Partition Table (GPT) disk.
GRUB consists of several image files, the most important of which are:
This image is the first part of GRUB to start. Due to size limit, it doesn’t understand filesystems. Its sole function is to load the core image from a local disk.
For BIOS to read it, this image is written to a master boot record (MBR) or to the boot sector of a partition.
The size of this image is exactly 512 bytes.
This is the core image. Usually, it contains enough modules to access
/boot/grub, and loads everything else (including menu handling, the ability to load target operating systems, and so on) from the file system at run-time.
This image can be installed at different areas on a disk, depending on whether MBR or GPT is used.
The size of this image is usually less than 32KiB.
There are two places the core image can be installed on an MBR disk:
This is the area between the MBR and the first partition. Since the MBR is 512 bytes, and the first partition is usually aligned at 1MiB (2048 sectors) offset, this leaves enough space for the core image.
In this case, a list of the blocks containing the core image can be stored in the first sector of that partition.
The caveat is that these blocks may be moved around by the filesystem. Thus putting core image here is not recommended.
It is possible to reserve a whole partition for GRUB, called the BIOS Boot Partition, on a GPT disk. GRUB can then be embedded into that partition without the risk of being overwritten by other software and without being contained in a filesystem which might move its blocks around.
The BIOS Boot Partition should be at least 31KiB in size. On a GPT disk with 512-byte sector size, the first usable sector is usually 34:
LBA 0: Protective MBR.
LBA 1: GPT header.
LBA 2-33: Partition Entry Array.
And again the first partition is usually aligned at 1MiB (2048 sectors) offset. This leaves a gap similar to the one on an MBR disk, which can be used by the BIOS Boot Partition. It’s also possible to create the BIOS Boot Partition at a different offset on the disk, though.
The BIOS Boot Partition must also have the correct type, which is
bios_grub in parted.
Install GRUB on disk
After partitioning is done, we can install GRUB on disk with:
# grub-install --target=i386-pc /dev/sdx # grub-mkconfig -o /boot/grub/grub.cfg
And we are all set.