Storage space "disappeared" on internal SSD of MacBook Air

0

After letting the FreeBSD installer to "automatically create an EFI partition" on my MacBook Air, there seems to be some problem with my internal SSD:

192:~ sunqingyao$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *121.3 GB   disk0
   1:                       0xEE                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            60.6 GB    disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:                       0xEE                         209.7 MB   disk0s4

Obviously, 209.7 MB + 60.6 GB + 650.0 MB + 209.7 MB < 121.3 GB. Nearly 60GB of my disk space just disappears!

Also, in case it's relevant:

192:~ sunqingyao$ sudo gpt -r show disk0
Password:
gpt show: disk0: Suspicious MBR at sector 0
      start       size  index  contents
          0          1         MBR
          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  104857600      5  GPT part - 516E7CB6-6ECF-11D6-8FF8-00022D09712B
  225230624   11747328      6  GPT part - 516E7CB5-6ECF-11D6-8FF8-00022D09712B
  236977952        190      7  GPT part - 83BD6B9D-7F41-11DC-BE0B-001560B84F0F
  236978142          1
  236978143         32         Sec GPT table
  236978175          1         Sec GPT header

First Aid of Disk Utility doesn't help:

enter image description here

enter image description here

nalzok

Posted 2017-05-28T02:56:44.343

Reputation: 157

Answers

2

The FreeBSD installer appears to have created a very bad hybrid MBR on your disk, and this is confusing OS X. The diskutil list output is showing the MBR side of the hybrid MBR, and this output includes two type-0xEE (protective) partitions, which tends to confuse OS X. The gpt -r show disk0 output, OTOH, shows seven GPT partitions and a "suspicious MBR," to use its term.

This can be fixed with my GPT fdisk (gdisk) tool:

  1. Obtain gdisk. You can use the OS X version or boot a Linux emergency disk that includes gdisk. (An Ubuntu installer should work well.)
  2. Launch gdisk on the disk, as in sudo gdisk /dev/disk0 under OS X or (probably) sudo gdisk /dev/sda under Ubuntu.
  3. Type p to view the partition table and be sure you're working on the correct disk.
  4. Type x to enter the experts' menu.
  5. Type n to create a new protective MBR to replace the bad hybrid MBR. Note that gdisk will simply display a new prompt; it won't verify that a new protective MBR has been created.
  6. Type p to view the partition table again to be sure you haven't accidentally done something bad.
  7. Type w to save your changes and exit. You'll be asked to verify this change.

At this point, the problem should be fixed; however, you may need to reboot before the OS will fully recognize the changes.

Note, however, that this procedure will render your Mac unable to boot BIOS/CSM/legacy-mode OSes. Depending on how you installed FreeBSD, you might need to install its EFI-mode boot loader. This is called loader.efi, but I'm not sure exactly where you'd find it or how you'd configure it, if it's not already installed. Perhaps this FreeBSD wiki entry would help, although it's scarce on practical end-user details. You might also want or need an EFI-mode boot manager, such as my rEFInd, to select between the OSes.

Alternatively, instead of replacing the hybrid MBR with a protective MBR, you could use gdisk to create a saner protective MBR. You might then need to re-install FreeBSD's BIOS-mode boot loader, and perhaps install rEFInd to simplify booting between the OSes. Assuming FreeBSD can boot in EFI mode on your Mac, though, I recommend booting in this way rather than in BIOS mode, because hybrid MBRs are ugly and dangerous hacks. Far too many people have completely trashed their OSes and lost important data because of hybrid MBRs.

Rod Smith

Posted 2017-05-28T02:56:44.343

Reputation: 18 427

Thanks sir, you're a life saver! Currently my disk is fixed and FreeBSD is installed & bootable! Strangely however, there are two EFI partitions on the disk now, but this is a tinyyyyyyy problem compared with the one you just fixed with your expertise and your magical gdisk!

– nalzok – 2017-05-31T06:26:39.890

1Having two ESPs isn't a problem, aside from the lost space. – Rod Smith – 2017-06-01T12:43:34.343