Booting GPT disk on BIOS systems
Do you need it?
- Why do you want to use a GPT-partitioned disk (= GPT disk for short)
in systems with BIOS firmware (as opposed to EFI/UEFI firmware, which
supports GPT natively)?
If your disk capacity is larger than 2 terabytes, GPT partition is the only way to access all of them. It doesn't matter whether you connect it through internal bus, through USB, or iSCSI.
- Why do you want to use GPT disk as your boot disk? If you only have one disk, that is, or if all of your disks are GPT disks.
- Your system BIOS must not be fussy about the MBR and partition format in MBR. It should be happy to execute IPL code in MBR as long as the MBR has the correct checksum.
- Syslinux (I'm using 4.0.6, earlier versions up to 3.7.6 should work as long as it has the gptmbr.bin file).
- Some GPT disk manipulation tools, such as gptfdisk (gdisk, sgdisk) or parted (or gparted).
Note 2: Some BIOSes are even fussier, and perform more checks and refuses to boot from what they think as "invalid" MBR. The thing is, what they consider as "invalid" may in fact be valid MBR partition. If you have this kind of BIOS, then good luck, because you need to manually craft your MBR to make your BIOS believe that it is a valid one.
Here I will use syslinux because it is the simplest to setup; but it is not the only bootloaders that can do so. Grub2 can definitely do it. Vanilla Grub Legacy (Grub 0.9.7) can't because development stopped long before GPT support was implemented, although there are distro patches (e.g. from Fedora) that make it capable. Grub4Dos - which is a long-running fork of Grub Legacy, doesn't support it yet at the time of writing.
For the following I will assume that your GPT disk is
/dev/sda and your
(soon-to-be) bootable partition is partition 3, that is,
Obviously change all references to
and the partition 3 to your own setup.
I will make the assumption that the partition you want to setup is Linux partition (ext2/ext3/ext4).
If you use sgdisk, type
sgdisk -A 3:set:2 /dev/sda
If you use the interactive gdisk tool instead of sgdisk above:
- Enter the
Extra functionality (experts only)menu by typing "x"
Set attributesby typing "a"
- You will be asked for which partition to update, choose "3"
- You will be asked which bit to enable, so choose
Legacy BIOS bootableby typing "2".
- Save your changes by typing "w".
mount /dev/sda3 /mnt/data
extlinux -i /mnt/data
extlinux -i /mnt/data/boot
Then please add the usual syslinux.conf configuration to boot your system - location of your kernel, initrd, rootfs, etc.
dd if=/usr/share/syslinux/gptmbr.bin of=/dev/sda bs=440 count=1
To this, you need to use "fdisk". Yes, plain old fdisk.
fdiskon the disk (
fdisk /dev/sda) and ignore the warnings.
- Type "a" to toggle the bootable flag, and choose "1" for the partition to enable. We choose partition "1", not "3", because now we are talking about the protective MBR (that fdisk sees); and there is only one partition there - the protective partition.
- Save your work by typing "w".
As mentioned above, doing this is actually discouraged, see for example: http://mjg59.dreamwidth.org/8035.html (Matt Garret is the expert on all things UEFI, he is the author of the 'shim' bootloader used by many Linux distros which enables Linux to boot directly on UEFI SecureBoot machines protected by Microsoft keys); but if this is what it takes for your system to boot, then so be it.
Installing a bootloader also means that ALL your previously installed operating system will not boot unless you configure the new bootloader to boot them. If you don't understand the consequences of the actions described in earlier, you'd better stay away from doing this altogether. You have been warned!
Some software (including gdisk) actually offers another type of protective MBR called "hybrid MBR", in this case, the GPT partition definitions are copied and mirrored into the MBR partition definitions - if you have 3 partitions in GPT you will have 4 partitions in MBR (3 GPT + original protective).
This is obviously not perfect since the reason why we want to have GPT in the first place is because MBR cannot record the entire disk capacity, in addition, this method is highly discouraged. The reason why is documented here: http://www.rodsbooks.com/gdisk/hybrid.html by the author of gptfdisk, no less.
Originally posted here: Booting GPT disk in BIOS systems using Syslinux.