Do I need an separate EFI partition for each OS sharing a common disk?

1

I was installing FreeBSD on my MacBook Air. When partitioning the disk, the installer told me

This partition scheme requires a boot partition for the disk to be bootable. Would you like to make one now? <Yes/No>

The problem is, I already have an EFI partition on my internal SSD, which presumably serves macOS. Do I need to create a different one for FreeBSD?

I've done some painful experiments on this issue:

  • When I chose No, FreeBSD becomes unbootable, i.e. "FreeBSD" is simply not shown in rEFInd's menu.
  • When I chose Yes, "the FreeBSD installer appears to have created a very bad hybrid MBR on your disk, and this is confusing OS X", and thus my disk got corrupted. Fortunately, after I follow @Rod Smith's instruction (created a new protective MBR to replace the bad hybrid MBR), this problem is solved now, but now my disk have 2 EFI partitions.

    Now my internal SSD looks like this:

    sunqingyaos-MacBook-Air:~ sunqingyao$ diskutil list
    /dev/disk0 (internal, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *121.3 GB   disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:                  Apple_HFS Macintosh HD            60.6 GB    disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
       4:                        EFI EFI                     209.7 MB   disk0s4
       5:                FreeBSD UFS                         53.5 GB    disk0s5
       6:               FreeBSD Swap                         6.2 GB     disk0s6
       7: 83BD6B9D-7F41-11DC-BE0B-001560B84F0F               101.4 KB   disk0s7
    

    Also,

    sunqingyaos-MacBook-Air:~ sunqingyao$ sudo gpt -r show disk0
    Password:
          start       size  index  contents
              0          1         PMBR
              1          1         Pri GPT header
              2         32         Pri GPT table
             34          6
             40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
         409640  118284248      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
      118693888    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
      119963424     409600      4  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      120373024  104447992      5  GPT part - 516E7CB6-6ECF-11D6-8FF8-00022D09712B
      224821016   12156928      6  GPT part - 516E7CB5-6ECF-11D6-8FF8-00022D09712B
      236977944        198      7  GPT part - 83BD6B9D-7F41-11DC-BE0B-001560B84F0F
      236978142          1
      236978143         32         Sec GPT table
      236978175          1         Sec GPT header
    

nalzok

Posted 2017-05-31T06:23:19.217

Reputation: 157

Answers

3

ESPs are usually shared across OSes, so no, you don't need a second one; but it also should not cause problems. That said, some tools or OSes may become confused by the presence of two ESPs. The Windows installer is the only example of which I'm aware. (This affects Windows 7, but I don't know about later versions.) If you run into such a problem, you can always change the type code on the ESP you don't want the Windows installer to use -- even just temporarily. (A temporary change can be useful if you want to install two Windows versions, each with its own ESP.)

The location of the ESPs relative to your other partitions makes deleting either one awkward -- to recover the space, you'd need to move the start point of at least one partition, which is time-consuming and dangerous. This may not be worthwhile to recover only about 200 MB of space -- but then again, your disk is only 120 GB. You'll have to judge just how precious your space is, vs. the time and risk involved.

Rod Smith

Posted 2017-05-31T06:23:19.217

Reputation: 18 427

0

Delete partition 4 as it has same signature (C12A7328-F81F-11D2-BA4B-00A0C93EC93B) as 1st partition!

UEFI boot sequence needs only one EFI System partition(ESP).

UEFI boot manager checks devices and loads file(OS loader) addressed by first boot candidate stored in NVRAM (if its device is present) else tries next boot candidate and so on.

All UEFI loaders are stored on ESP:

\EFI\company.....

\EFI\boot... is fallback boot loader.

MBR shouldn't play with UEFI boot process. MBR is needed only for older BIOS booting. Maybe the loaded OS (OSX) is checking MBR for some unknown reason as GPT style disks have a GPT partition table and do not use info stored in MBR.

There is also a hybrid boot process on GPT style disks:

MBR code loads boot code from a special "BIOS boot partition" which in turn "knows" what to load next. This scheme is created by some Linux distributions when you load the installation media using BIOS booting then make the installation - assumed is BIOS booting on GPT disk.

With UEFI firmware and GPT disk always boot any (installation)media using UEFI boot!!!

snayob

Posted 2017-05-31T06:23:19.217

Reputation: 4 044

1The GUID C12A7328-F81F-11D2-BA4B-00A0C93EC93B is the partition type code for an ESP. Having two ESPs is not a violation of the EFI specification, and in fact is helpful in some cases (say, if you want to dual-boot two versions of Windows and have some non-Windows boot manager pick between them). That said, having two ESPs is usually unnecessary, even if you're multi-booting a dozen OSes. What you call a "hybrid boot process" is just ordinary BIOS-mode booting from GPT disks, and with most boot loaders it doesn't need a BIOS Boot Partition; that's GRUB 2's way of doing it. – Rod Smith – 2017-06-01T12:37:15.577

Windows does not like many ESP's - try to upgrade and you will end up with error ... and lost time. I know what ESP is, what signature it has, my second sentence says it. Windows OS is special, real special, if you understand what I mean, MS wants to rule the PC market and does until now. This example with two installed Windows versions and a foreign boot manager/loader to pick between them is really funny ;) You surely mean some exercise in booting and not a production or everyday system. – snayob – 2017-06-03T18:44:56.500