Discussion:
GPT: both EFI & BIOS-Boot partitions?
Add Reply
bad sector
2025-01-04 14:10:41 UTC
Reply
Permalink
To boot the same GPT disk in either an EFI or Legacy BIOS machine I'd
need both an EFI system partition which HAS to be the first one on the
disk, as well as a BIOS-Boot partition.

Q: Does the BIOS-Boot partition also have to be #1?

If it does, WHY? I then would have to swing the two partitions, one
replacing the other as needed; otherwise I can have both set up and the
disk will boot in either machine. My take is that when a Legacy BIOS
machine cannot find the boot code in the disk root (mbr) then it looks
for it in the BIOS-Boot partition, wherever that is, so long as it is
accessible.
--
Natural stupidity has brought us Artificial-Intelligence;
ergo, Artificial-Stupidity will never be competitive.
Marco Moock
2025-01-04 14:40:58 UTC
Reply
Permalink
Post by bad sector
To boot the same GPT disk in either an EFI or Legacy BIOS machine I'd
need both an EFI system partition which HAS to be the first one on
the disk, as well as a BIOS-Boot partition.
I haven't heard that the ESP needs to be the first partition. It can
simply be identified by the EF00 type code.

I vaguely remember that I had already systems where the EFI partition
was at the end because I migrated them from legacy BIOS boot.
--
kind regards
Marco

Send spam to ***@stinkedores.dorfdsl.de
Grant Taylor
2025-01-04 16:53:06 UTC
Reply
Permalink
Q:  Does the BIOS-Boot partition also have to be #1?
I don't think so.

Every BIOS system that I've ever used supported loading the boot loader
from two different places:

- the 1st block on the disk
- the 1st block of the /active/ partition

I've been told, but have never experienced that this scheme conceptually
includes logical partitions inside of an extended partition. I assume
that the extended partition needs to be active and the BIOS needs to
support searching for active logical partition inside of the extended
partition.

This is also talking about the actual boot loader that the system uses.
If that boot loader is something like GRUB, you can have the very first
part be in in the 1st block of the disk or the 1st block of the /active/
partition and then GRUB will figure out where to load the rest of it's
data from and boot just about any partition on the system.
--
Grant. . . .
Richard Kettlewell
2025-01-04 17:30:36 UTC
Reply
Permalink
Post by Grant Taylor
Q:  Does the BIOS-Boot partition also have to be #1?
I don't think so.
Every BIOS system that I've ever used supported loading the boot
- the 1st block on the disk
- the 1st block of the /active/ partition
I don’t think that is right. If something is loaded and run from a
partition then that is because the code in the MBR loaded and ran it.

See https://wiki.osdev.org/Boot_Sequence for a description of the BIOS
boot process and how it’s used by bootloaders.
--
https://www.greenend.org.uk/rjk/
Richard Kettlewell
2025-01-04 17:26:22 UTC
Reply
Permalink
Post by bad sector
To boot the same GPT disk in either an EFI or Legacy BIOS machine I'd
need both an EFI system partition which HAS to be the first one on the
disk, as well as a BIOS-Boot partition.
Q: Does the BIOS-Boot partition also have to be #1?
AFAIK, no.
Post by bad sector
If it does, WHY? I then would have to swing the two partitions, one
replacing the other as needed; otherwise I can have both set up and
the disk will boot in either machine. My take is that when a Legacy
BIOS machine cannot find the boot code in the disk root (mbr) then it
looks for it in the BIOS-Boot partition, wherever that is, so long as
it is accessible.
I don’t think that’s right. The BIOS runs the the bootstrap code in the
MBR and nothing else.
--
https://www.greenend.org.uk/rjk/
bad sector
2025-01-04 17:52:01 UTC
Reply
Permalink
Post by Richard Kettlewell
Post by bad sector
To boot the same GPT disk in either an EFI or Legacy BIOS machine I'd
need both an EFI system partition which HAS to be the first one on the
disk, as well as a BIOS-Boot partition.
Q: Does the BIOS-Boot partition also have to be #1?
AFAIK, no.
Post by bad sector
If it does, WHY? I then would have to swing the two partitions, one
replacing the other as needed; otherwise I can have both set up and
the disk will boot in either machine. My take is that when a Legacy
BIOS machine cannot find the boot code in the disk root (mbr) then it
looks for it in the BIOS-Boot partition, wherever that is, so long as
it is accessible.
I don’t think that’s right. The BIOS runs the the bootstrap code in the
MBR and nothing else.
I'm preparing to migrate to an EFI boot board (it may or may not have
CSM support). In order to cover eventualities on a GPT disk I thought it
was suggested to have both an EFI partition as #1 and a BIOS-Boot
partition as #2. I was planning to give each 1gb but maybe the BIOS-Boot
one needs to be smaller (I fail to see why). One of the distros offers
such a plan and creates a 3-way future for EFI/EFI-csm/Legacy during
installation so you don't later have to backtrack and slide all
partitions up. At this point I'm just partitioning the disk that will
launch the new board.
Richard Kettlewell
2025-01-04 20:30:16 UTC
Reply
Permalink
Post by bad sector
I'm preparing to migrate to an EFI boot board (it may or may not have
CSM support). In order to cover eventualities on a GPT disk I thought
it was suggested to have both an EFI partition as #1 and a BIOS-Boot
partition as #2.
Unless you actively want to migrate, maybe worth waiting to see if the
new board will do MBR booting?

I don’t recall making any specific efforts to support both EFI and MBR
booting simultaneously in any of my migrations (of which I think I’ve
done three, and hope never to do another). My disaster recovery approach
has always been a separate rescue image on removable storage.
Post by bad sector
I was planning to give each 1gb but maybe the BIOS-Boot one needs to
be smaller (I fail to see why).
Some historical BIOS/boot loader combinations had limits on how far into
the disk they could read, with implications for where the boot partition
could be.
--
https://www.greenend.org.uk/rjk/
Carlos E.R.
2025-01-04 21:41:58 UTC
Reply
Permalink
Post by bad sector
To boot the same GPT disk in either an EFI or Legacy BIOS machine I'd
need both an EFI system partition which HAS to be the first one on the
disk, as well as a BIOS-Boot partition.
Q:  Does the BIOS-Boot partition also have to be #1?
No.
Post by bad sector
If it does, WHY? I then would have to swing the two partitions, one
replacing the other as needed; otherwise I can have both set up and the
disk will boot in either machine. My take is that when a Legacy BIOS
machine cannot find the boot code in the disk root (mbr) then it looks
for it in the BIOS-Boot partition, wherever that is, so long as it is
accessible.
No. There is no searching. The program stored in the MBR knows exactly
what sectors to load, which in a GPT disk are in the so called bios
partition. It is small, much smaller than 1 GB. I think it is 32 MB, but
I don't remember.

Alternatively, the MBR program may (instead) load the BR of the (first)
primary partition that is marked as bootable.

Whether to do one thing or the other means writing a different program
to the protective MBR. The program has to fit in somewhat less than 512
bytes (less because the protective partition table is also there). It is
a exact figure but I don't remember it. It is so small that it can not
do something smart like thinking about it.

All this is a Grub2 feature, IIRC.
--
Cheers, Carlos.
bad sector
2025-01-05 14:02:22 UTC
Reply
Permalink
Post by Carlos E.R.
Post by bad sector
To boot the same GPT disk in either an EFI or Legacy BIOS machine I'd
need both an EFI system partition which HAS to be the first one on the
disk, as well as a BIOS-Boot partition.
Q:  Does the BIOS-Boot partition also have to be #1?
No.
Post by bad sector
If it does, WHY? I then would have to swing the two partitions, one
replacing the other as needed; otherwise I can have both set up and
the disk will boot in either machine. My take is that when a Legacy
BIOS machine cannot find the boot code in the disk root (mbr) then it
looks for it in the BIOS-Boot partition, wherever that is, so long as
it is accessible.
No. There is no searching. The program stored in the MBR knows exactly
what sectors to load, which in a GPT disk are in the so called bios
partition. It is small, much smaller than 1 GB. I think it is 32 MB, but
I don't remember.
Alternatively, the MBR program may (instead) load the BR of the (first)
primary partition that is marked as bootable.
Whether to do one thing or the other means writing a different program
to the protective MBR. The program has to fit in somewhat less than 512
bytes (less because the protective partition table is also there). It is
a exact figure but I don't remember it. It is so small that it can not
do something smart like thinking about it.
All this is a Grub2 feature, IIRC.
Earlier you had suggested that I do a clean Tumbleweed install (I
'think' that might have been with respect to multi-distro booting). I
can run that with an unpartitioned disk and that will show me an example
of the desired EFI partition but I want to also have a pre-partitioned
disk and that (UFN) will start with an EFI as #1 and a BIOS-Boot as #2,
both 1G (once and for all) *unless they must be smaller*. That day is
still only approaching because I still haven't been able to acquire
appropriate ECC udimms yet which I might be able to order tomorrow but
will not expect until a week later.

Jasen Betts
2025-01-05 06:56:08 UTC
Reply
Permalink
Post by bad sector
To boot the same GPT disk in either an EFI or Legacy BIOS machine I'd
need both an EFI system partition which HAS to be the first one on the
disk, as well as a BIOS-Boot partition.
Q: Does the BIOS-Boot partition also have to be #1?
No. it also doesn't need to be first.
Post by bad sector
disk will boot in either machine. My take is that when a Legacy BIOS
machine cannot find the boot code in the disk root (mbr) then it looks
for it in the BIOS-Boot partition, wherever that is, so long as it is
accessible.
SFAIK BIOS only looks in the MBR. MBR code will then use BIOS calls to
read and interpret the contents of the primary DOS partition table,
pick a bootable partition and load its boot saector....

So the BIOS boot sector needs to be BIOS addressable, which means
somewhere in the first 2 gigabytes I think.
--
Jasen.
🇺🇦 Слава Україні
Loading...