2

I recently installed Linux Mint on my Macbook Air, and saved my old OS to a couple disk images (The EFI and the OS). I created two partitions the exact size of the EFI and OS images on an external hard drive, and then used the "Restore Partition Image" tool in Disks. However, when I hold Alt to open the alternate boot menu while booting, there is only one option, which just boots to Linux.

Output of sudo gdisk /dev/sdb:

[me]@[me]:~$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.

Command (? for help): p
Disk /dev/sdb: 3907029168 sectors, 1.8 TiB
Model: 0011         99Y
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 12C82EC5-8211-41B4-A49A-A615DC07A3BC
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 1240698989 sectors (591.6 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1      2666362880      2934798335   128.0 GiB   0700  
   2            2048          411647   200.0 MiB   0700  
   3          411648       250413055   119.2 GiB   8300  
   5       518879232      2666362879   1024.0 GiB  0700  

Command (? for help): r

Recovery/transformation command (? for help): o

Disk size is 3907029168 sectors (1.8 TiB)
MBR disk identifier: 0xFDB98627
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1         2047   primary     0xEE
   2            2666362880   2934798335   primary     0x07
   3      *           2048       411647   primary     0x0B
   4                411648    250413055   primary     0xAF

Recovery/transformation command (? for help):
4
  • Your MBA firmware needs correct partition type codes to find macOS boot.efi in the OS partition. Please edit question with results of sudo gdisk /dev/sdb (or whatever your external dive is) and option p to print partition table like this : https://community.linuxmint.com/software/view/gdisk.
    – lx07
    Commented Dec 29, 2019 at 17:24
  • Ok, I have edited my question.
    – LostXOR
    Commented Dec 29, 2019 at 17:27
  • You have a hybrid mbr. Please post results of r (recovery menu) then o (print mbr data). In any case your partition types are wrong. For GPT partition table the EFI should be type EF00 and macOS should be AF00 (if it HFS) or AF0A (APFS). You have only types 0700 (Microsoft filesystems like NTFS) and 8300 (Linux filesystems like ext4). You can non-destructively change partition type codes from gdisk main menu using option t but you may need to sync the mbr partition table too.
    – lx07
    Commented Dec 29, 2019 at 17:35
  • I added that too.
    – LostXOR
    Commented Dec 29, 2019 at 21:42

1 Answer 1

2

You need to fix the partition type codes and either remove or recreate the hybrid MBR.

Fixing GPT partition table

Using gdisk first sort the partition by running sudo gdisk /dev/sdb (or whatever your external dive is) and take option s. Note that in your Linux Mint if you have defined these partitions in /etc/fstab using old style /dev/sdb3 etc notation rather than UUID or labels you will need to update these to match.

If you then display the partition table with option p it should look like this (note the unallocated space between partition 2 and 3):

Number  Start (sector)    End (sector)  Size       Code  Name  
   1            2048          411647   200.0 MiB   0700  
   2          411648       250413055   119.2 GiB   8300  
   3       518879232      2666362879   1024.0 GiB  0700
   4      2666362880      2934798335   128.0 GiB   0700 

Next correct the partition types using option t. You can see partition type codes with option l and the three you are probably interested in are type EF00 (EFI system) and either AF00 (Apple HFS/HFS+) or AF0A (Apple APFS). For example to change partition 1 to EF00 (EFI System partition)

Command (? for help): t
Partition number (1-7): 1
Current type is 'Microsoft basic data'
Hex code or GUID (L to show codes, Enter = 8300): EF00
Changed type of partition to 'EFI System'

Assuming partition 2 is your old macOS you should change type code to AF00 if the original was HFS (now known as macOS extended) or AF0A if is was an APFS container. This will depend on your macOS version. According to Wikipedia

Since macOS High Sierra, all devices with flash storage are automatically converted to APFS.[24] FileVault volumes are also converted. As of macOS Mojave, Fusion Drives and hard disk drives are also upgraded on installation.[25]

Assuming there is no issue with the 3rd and 4th partitions you can leave these as they are. The GPT partition table should now look like this:

Number  Start (sector)    End (sector)  Size       Code  Name  
   1            2048          411647   200.0 MiB   EF00  
   2          411648       250413055   119.2 GiB   AF00  
   3       518879232      2666362879   1024.0 GiB  0700
   4      2666362880      2934798335   128.0 GiB   0700 

Fixing hybrid MBR

macOS doesn't require hybrid MBR and always boots using GPT partition layout. Only if you want to boot Windows or Linux in legacy BIOS mode do you need a hybrid MBR.

Option 1

If you have only macOS and data partitions on this disk you only need a protective MBR which covers the whole disk. Take option x to enter the Recovery/transformation menu and then option n to create new protective MBR. You can check it with option 'o`

For you it should look something like this:

Command (? for help): x

Expert command (? for help): n

Expert command (? for help): o

Disk size is 3907029168 sectors (1.8 TiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1   3907029167   primary     0xEE

Option 2

If you are booting Windows or Linux in Legacy/BIOS/CSM mode from this disk then create a hybrid MBR to match the updated GPT partition table. Take option r to enter the Recovery/transformation menu and then option h to create new hybrid MBR.

MBR partition type codes are listed here. You can use AF for any macOS, and 07 for NTFS or exFAT, 0B for FAT32 etc. If one of the partitions should be bootable (except for macOS which ignores hybrid MBR) set the bootable flag to Y.

Setting up hybrid MBR is explained here but you probably want something like this (assuming partition 3 set bootable):

Recovery/transformation command (? for help): h

WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
just hit the Enter key at the below prompt and your MBR partition table will
be untouched.

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 2 3 4
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): Y

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default AF): AF
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #3 (MBR partition #3)
Enter an MBR hex code (default 07): 07
Set the bootable flag? (Y/N): y

Creating entry for GPT partition #4 (MBR partition #4)
Enter an MBR hex code (default 07): 07
Set the bootable flag? (Y/N): n

You can check it with option o - it should look like this with partition partition 1 running from sector 1 to the end of the EFI partition and the other start/end positions matching your GPT partition table.

Recovery/transformation command (? for help): o

Disk size is 3907029168 sectors (1.8 TiB)
MBR disk identifier: 0xFDB98627
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1       411647   primary     0xEE
   2                411648    250413055   primary     0xAF
   3      *      518879232   2666362879   primary     0x07
   4            2666362880   2934798335   primary     0x07

Once you are happy with the new layout you can take option w to write changes to disk (or q to quit at any time without saving). Finally reboot or eject/reconnect drive so the OS sees the new table.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .