I am on an early 2015 MacBook Pro with macOS Sierra, dual boot with Ubuntu 16.04.

In macOS, I did dd if=/dev/disk1s3 of=disk2s2(if i remember correctly). It succeeded and I proceeded to shrink the macOS partition using Disk Utility. That succeeded too. I proceeded to reboot and found myself unable to boot into any systems. Going into recovery mode, I am unable to restore from a backup or reinstall a new macOS.

I see the partitions as they are supposed to be, though their health would be suspect. I have

210mb EFI partition as /dev/sda1 FAT
182GB macOS parition as /dev/sda2 ffffffff-ffff-ffff-ffff-ffffffffffff
30GB free space partition as /dev/sda
30GB Ubuntu PArtition as /dev/sda4 Ext4
4GB Linux Swap as /dev/sda5 Swap

Would anyone know how I could restore things as they are? I am looking to install rEFInd so my MacBook would provide the option without me having to hold the Option key everytime.

diskutil list returns:

   #:                   TYPE NAME                SIZE        IDENTIFIER
   0:  GUID_partition_scheme                     *251.0 GB   disk0
   1:                    EFI EFI                 209.7 MB    disk0s1
   2: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF       181.8 GB    disk0s2
   3: 0FC63DAF-8483-4772-8E79-3D69D8477DE4       30.0 GB     disk0s4
   4:                  LINUX SWAP                4.0 GB      disk0s5
   #:                   TYPE NAME                SIZE        IDENTIFIER
   0: Apple_partition_scheme                     *1.3 GB     disk0
   1:    Apple_partition_map                     30.7 KB     disk0s1
   2:              Apple_HFS OSX X Base System   1.3 GB      disk0s2
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *524.3 KB   disk2
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *524.3 KB   disk3
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *524.3 KB   disk4 
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *524.3 KB   disk5
   #:                  TYPE NAME                 SIZE        IDENTIFIER 
   0:                   untitled                 *524.3 KB   disk6
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *6.3 MB     disk7
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *2.1 MB     disk8
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *1.0 MB     disk9
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *524.3 KB   disk10
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *524.3 KB   disk11
   #:                  TYPE NAME                 SIZE        IDENTIFIER
   0:                       untitled             *1.0 MB     disk12

Update: removed/destroyed disk0 via gpt. just before I gpt add partitions back.

   #:                   TYPE NAME                SIZE        IDENTIFIER
   0:  FDisk_partition_scheme                    *251.0 GB   disk0
   1:                    0xEE                    209.7 MB    disk0s1
   2:                    0xDA                    181.8 GB    disk0s2
   3:                   Linux                    30.0 GB     disk0s4

Update 2: Adding back the partitions. (I neglected adding back -i 3 and -i 2 respectively)

    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.....
   409640   226802864            3        GPT part - 5374GF72.....
227212504     1269536            2        GPT part - 426F6F74.....
228482040   261752679              
490234719          32                     SEC GPT table
490234751           1                     SEC GPT header
  • Look at this answer it may lead you in the right direction. Cheers! – bjbk Nov 28 '17 at 14:24
  • @bjbk Thanks for that link! It's really insightful. I'd need more help before I can customise that solution for my problem. So all my partitions except the macOS partition are intact and healthy. The macOS partition is corrupted somehow? That dosent explain why I wouldnt be able to boot into Ubuntu since my EFI partition is outside the macOS one. – EraserPencil Nov 28 '17 at 14:51
  • @David would you be able to give more detailed steps? I don’t see where in gdisk I can change UUID, only GUID. I’m still learning my LPIC-101 exams hence still rough around the edges. Alternatively, an apple-centric solution would be great too. – EraserPencil Nov 29 '17 at 1:11
  • This is the better answer: Data Not Backed Up, Partition Type: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF than the one linked in bjbk's comment. Compared to my answer there, you have to remove disk0s2 only and re-add it properly. – klanomath Nov 29 '17 at 4:13
  • @klanomath Hahaha. Looks like I have messed up something between posting the two outputs. How would I go about backing up my machine before removing any partitions (If possible at all) – EraserPencil Nov 29 '17 at 4:48

Since you can execute a live version of Ubuntu, you have access to the gdisk command. Once booted to Ubuntu, you will need to open a Terminal window. From the Ubuntu desktop, press the control+option+T keys. A Terminal window should appear, as shown below.


You can confirm partition /dev/sda2 is a possible "Mac OS Extended" (Journaled)" volume by entering the command given below.

sudo  dd  if=/dev/disk1s2  count=3  |  hexdump  -Cv

The output at offset 00000400 should appear similar to what is shown below. What is important find is the characters HFSJ.

00000400  48 2b 00 04 80 00 21 00  48 46 53 4a 00 00 05 4b  |H+....!.HFSJ...K|

The interactive command gdisk can be used to change the type id of a partition. The example below assumes the partition where macOS resides is a single Mac OS Extended (Journaled) volume. The example will change type id for partition 2 to 48465300-0000-11AA-AA11-00306543ECAC. The command to enter is shown below.

sudo  gdisk  /dev/sda

The interactive input/output is shown below.

GPT fdisk (gdisk) version 1.0.0

Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): t
Partition number (1-5): 2
Current type is 'Unknown'
Hex code or GUID (L to show codes, Enter = AF00): af00
Changed type of partition to 'Apple HFS/HFS+'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk1.
Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.

Note: You can set the default boot volume by holding down the control key before selecting the icon shown in the Mac Startup Manager.

  • Hey! Thanks a lot for that solution. However, my live linux can't detect wifi for some reason, but I don't wanna troubleshoot that now. Is there something we could do from the Internet Recovery Mode? I really hate popping by an Apple store cause I know I will lose my laptop for sure. – EraserPencil Nov 29 '17 at 4:09

You must log in to answer this question.

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