using GPT / EFI booting on Lenovo BIOSes

Chris Torek torek at
Wed Mar 20 02:48:12 UTC 2013

(Not sure if this is the best mailing list to use, I only just now
subscribed here.)

As has been noted many places, if you install FreeBSD (or most
flavors of Linux for that matter -- only Red Hat Enterprise Linux
is specially favored) on a Lenovo box and use the new GPT style
install with a "protective MBR", the BIOS refuses to boot the

I spent quite a while poking at this and discovered that there is
a way to trick the BIOS, and still use GPT / EFI based booting.
(This was with a FreeBSD 10-current install DVD but it should work
with 9.x as well.)

After installing and then discovering that the system won't boot
off the SATA drive, boot the LiveCD image and log in as root.

At the root prompt, run:

    # disk=ada0                    # adjust if needed
    # fdisk -p $disk > /tmp/part

Open /tmp/part in your preferred editor.  You should see something
like this (this is the protective MBR, which fdisk handles like
any other MBR), although the numbers will vary:

    # /dev/ada0
    g c969021 h16 s63
    p 1 0xee 1 976773167
    a 1

The trick is to add an empty but "active" "partition 1", which must
have type 0x00, and move the partition of type 0xee (i.e., GPT) to
partition 2.

The fdisk command insists on putting the start of its four
partitions on a "track" boundary, so you'll need to change the
geometry (the "g" line).  I multiplied the cylinder count by the
sectors-per-track value of 63 (I doubt this is actually important
but I'm just reporting what I did, here).  In my case this gave
969021 * 63 = 61048323.  In any case be sure to change the number
after "s" to 1.  The first line would then read, for my case:

    g c61048323 h16 s1

Now duplicate the "p 1" line and change the first "1" to "2" (I
put the new line at the end although again I suspect it does not
matter).  Then edit the original "p 1" line to set the partition
type to 0x00.  The complete file, in my case, now reads:

    # /dev/ada0
    g c61048323 h16 s1
    p 1 0x00 1 976773167
    a 1
    p 2 0xee 1 976773167

Now have fdisk write a new MBR based on this file:

    # fdisk -f /tmp/part $disk

You should now be able to boot off the drive.

I don't know if this works on all Lenovo BIOSes but it's easy to
try, no hacking of boot blocks required, etc.


More information about the freebsd-i386 mailing list