2

I tried to uninstall linux on my MBP 2014, accidentally corrupting my MacOS. Tried to fix it using this guide : Data Not Backed Up, Partition Type: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF, did not work. Here's what I had done:

-bash-3.2# diskutil info disk0s2
   Device Identifier:        disk0s2
   Device Node:              /dev/disk0s2
   Part of Whole:            disk0
   Device / Media Name:      Customer

   Volume Name:              Not applicable (no file system)

   Mounted:                  Not applicable (no file system)

   File System:              None

   Partition Type:           FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 PCI
   SMART Status:             Verified
   Disk / Partition UUID:    AFF19235-7921-417B-8A73-EE26292C7C99

   Total Size:               218.8 GB (218774044672 Bytes) (exactly 427293056 512-Byte-Units)
   Volume Free Space:        Not applicable (no file system)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         Not applicable (no file system)
   Ejectable:                No

   Whole:                    No
   Internal:                 Yes
   Solid State:              Yes

-bash-3.2# diskutil list
/dev/disk0
   #:                       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               218.8 GB   disk0s2
   3: 0FC63DAF-8483-4772-8E79-3D69D8477DE4               28.0 GB    disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *1.3 GB     disk1
   1:        Apple_partition_map                         30.7 KB    disk1s1
   2:                  Apple_HFS OS X Base System        1.3 GB     disk1s2
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *5.2 MB     disk2
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk3
/dev/disk4
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk4
/dev/disk5
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk5
/dev/disk6
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk6
/dev/disk7
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk7
/dev/disk8
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *6.3 MB     disk8
/dev/disk9
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *2.1 MB     disk9
/dev/disk10
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *1.0 MB     disk10
/dev/disk11
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk11
/dev/disk12
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk12
/dev/disk13
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *1.0 MB     disk13
/dev/disk14
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *6.3 MB     disk14
-bash-3.2# gpt -r show disk0
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  427293056      2  GPT part - FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
  427702696    7870040         
  435572736   54661120      3  GPT part - 0FC63DAF-8483-4772-8E79-3D69D8477DE4
  490233856        863         
  490234719         32         Sec GPT table
  490234751          1         Sec GPT header
-bash-3.2# diskutil umountDisk disk0
Unmount of all volumes on disk0 was successful
-bash-3.2# dd if=/dev/disk0s2 count=3 | vis -c
3+0 records in
3+0 records out
1536 bytes transferred in 0.013231 secs (116091 bytes/sec)
\^W\M-?C\M-@b\^\\M^I\^]\^A\0\0\0\0\0\0\0\M-j\M-9*\0\0\0\0\0\^A\0\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\-bash-3.2# diskutil umountDisk disk0
Unmount of all volumes on disk0 was successful
-bash-3.2# gpt remove -i 3 disk0
gpt remove: disk0: Suspicious MBR at sector 0
disk0s3 removed
-bash-3.2# diskutil umountDisk disk0
Unmount of all volumes on disk0 was successful
-bash-3.2# gpt remove -i 2 disk0
gpt remove: disk0: Suspicious MBR at sector 0
disk0s2 removed
-bash-3.2# gpt add -i 3 -b 227212504 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0
gpt add: disk0: Suspicious MBR at sector 0
gpt add: disk0: error: no space available on device
-bash-3.2# gpt add -i 3 -b 435572736 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0
gpt add: disk0: Suspicious MBR at sector 0
gpt add: disk0: error: no space available on device
-bash-3.2# gpt -r show /dev/disk0
gpt show: /dev/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  427293056      2  MBR part 218
  427702696    7870040         
  435572736   54661120      3  MBR part 131
  490233856        863         
  490234719         32         Sec GPT table
  490234751          1         Sec GPT header
-bash-3.2# gpt add -b diskutil umountDisk /dev/disk0
usage: gpt add [-b lba] [-i index] [-s lba] [-t uuid] device ...
-bash-3.2# diskutil umountDisk /dev/disk0
Unmount of all volumes on disk0 was successful
-bash-3.2# gpt add -b 409640 -s 427293056 -i 2 -t 53746F72-6167-11AA-AA11-00306543ECAC
usage: gpt add [-b lba] [-i index] [-s lba] [-t uuid] device ...
-bash-3.2# gpt add -b 409640 -s 427293056 -i 2 -t 53746F72-6167-11AA-AA11-00306543ECAC /dev/disk0
gpt add: /dev/disk0: Suspicious MBR at sector 0
gpt add: /dev/disk0: error: no space available on device
-bash-3.2# gpt -r show /dev/disk0
gpt show: /dev/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  427293056      2  MBR part 218
  427702696    7870040         
  435572736   54661120      3  MBR part 131
  490233856        863         
  490234719         32         Sec GPT table
  490234751          1         Sec GPT header
-bash-3.2# diskutil umountDisk /dev/disk0
Unmount of all volumes on disk0 was successful
-bash-3.2# gpt destroy /dev/disk0
gpt destroy: /dev/disk0: Suspicious MBR at sector 0
-bash-3.2# gpt create -f /dev/disk0
gpt create: /dev/disk0: Suspicious MBR at sector 0
-bash-3.2# fdisk -i -a hfs /dev/disk0
fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory

    -----------------------------------------------------
    ------ ATTENTION - UPDATING MASTER BOOT RECORD ------
    -----------------------------------------------------

Do you wish to write new MBR and partition table? [n] n
MBR is unchanged
-bash-3.2# fdisk -i -a hfs /dev/disk0
fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory

    -----------------------------------------------------
    ------ ATTENTION - UPDATING MASTER BOOT RECORD ------
    -----------------------------------------------------

Do you wish to write new MBR and partition table? [n] y
-bash-3.2# gpt -r show /dev/disk0
gpt show: error: bogus map
gpt show: unable to open device '/dev/disk0': Undefined error: 0
-bash-3.2# gpt create -f /dev/disk0
gpt create: error: bogus map
gpt create: unable to open device '/dev/disk0': Undefined error: 0
-bash-3.2# diskutil umountDisk /dev/disk0
Unmount of all volumes on disk0 was successful
-bash-3.2# info disk0
-bash: info: command not found
-bash-3.2# diskutil info disk0
   Device Identifier:        disk0
   Device Node:              /dev/disk0
   Part of Whole:            disk0
   Device / Media Name:      APPLE SSD SM0256F Media

   Volume Name:              Not applicable (no file system)

   Mounted:                  Not applicable (no file system)

   File System:              None

   Content (IOContent):      FDisk_partition_scheme
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 PCI
   SMART Status:             Verified

   Total Size:               251.0 GB (251000193024 Bytes) (exactly 490234752 512-Byte-Units)
   Volume Free Space:        Not applicable (no file system)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         Not applicable (no file system)
   Ejectable:                No

   Whole:                    Yes
   Internal:                 Yes
   Solid State:              Yes
   OS 9 Drivers:             No
   Low Level Format:         Not supported

-bash-3.2# diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *251.0 GB   disk0
   1:                  Apple_HFS                         251.0 GB   disk0s1
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *1.3 GB     disk1
   1:        Apple_partition_map                         30.7 KB    disk1s1
   2:                  Apple_HFS OS X Base System        1.3 GB     disk1s2
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *5.2 MB     disk2
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk3
/dev/disk4
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk4
/dev/disk5
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk5
/dev/disk6
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk6
/dev/disk7
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk7
/dev/disk8
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *6.3 MB     disk8
/dev/disk9
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *2.1 MB     disk9
/dev/disk10
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *1.0 MB     disk10
/dev/disk11
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk11
/dev/disk12
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk12
/dev/disk13
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *1.0 MB     disk13
/dev/disk14
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *6.3 MB     disk14
-bash-3.2# gpt -r show disk0
gpt show: error: bogus map
gpt show: unable to open device 'disk0': No such file or directory
-bash-3.2# gpt -r show /dev/disk0
gpt show: error: bogus map
gpt show: unable to open device '/dev/disk0': Undefined error: 0
-bash-3.2# 

I haven't backed up my files, but I read that this process should not erase any data from the original disk. Is there anything that can fix this?

Update

I have managed to boot into macOS, but the last step was not working for me. 32 GB was also missing. Here are the output of diskutil list and gpt -r show /dev/disk0.

-bash-3.2# diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk2         218.8 GB   disk0s2

/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +2.1 GB     disk1
   1:                  Apple_HFS macOS Base System       2.0 GB     disk1s1

/dev/disk2 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +218.8 GB   disk2
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD - Data     188.8 GB   disk2s1
   2:                APFS Volume Preboot                 81.7 MB    disk2s2
   3:                APFS Volume Recovery                528.7 MB   disk2s3
   4:                APFS Volume VM                      1.1 GB     disk2s4
   5:                APFS Volume Macintosh HD            11.1 GB    disk2s5

/dev/disk3 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +10.5 MB    disk3

/dev/disk4 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +10.5 MB    disk4

/dev/disk5 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +524.3 KB   disk5

/dev/disk6 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +524.3 KB   disk6

/dev/disk7 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +524.3 KB   disk7

/dev/disk8 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +2.1 MB     disk8

/dev/disk9 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +524.3 KB   disk9

/dev/disk10 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +524.3 KB   disk10

/dev/disk11 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +12.6 MB    disk11

/dev/disk12 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +4.2 MB     disk12

/dev/disk13 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +1.0 MB     disk13

/dev/disk14 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +2.1 MB     disk14

/dev/disk15 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +524.3 KB   disk15

/dev/disk16 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +2.1 MB     disk16

/dev/disk17 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +524.3 KB   disk17

/dev/disk18 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +1.0 MB     disk18

/dev/disk19 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +524.3 KB   disk19

/dev/disk20 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +6.3 MB     disk20

/dev/disk21 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +6.3 MB     disk21

/dev/disk22 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +524.3 KB   disk22

/dev/disk23 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               +2.1 MB     disk23

/dev/disk24 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *30.8 GB    disk24
   1:             Windows_FAT_32 NO NAME                 30.8 GB    disk24s1

-bash-3.2# gpt -r show /dev/disk0
      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  427293056      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  427702696   62532023         
  490234719         32         Sec GPT table
  490234751          1         Sec GPT header
-bash-3.2# 
2
  • The warning message Suspicious MBR at sector 0 usually means the disk is hybrid partitioned. In the example you have linked, you can see that this message does not appear. You needed to employ additional steps which were not needed in the linked answer. Nov 21, 2019 at 5:47
  • Can you provide me with the additional steps required? Nov 21, 2019 at 5:55

1 Answer 1

0

You almost got it right. After you used gpt create, you should have gone back to gpt add. Try the sequence below.

Note: I omitted any diskutil unmountdisk /dev/disk0 commands you may need to enter.

dd if=/dev/zero of=/dev/disk0 bs=512 count=1 
gpt destroy /dev/disk0
gpt create -f /dev/disk0
gpt add -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0
gpt add -b 409640 -s 427293056 -t 7C3457EF-0000-11AA-AA11-00306543ECAC /dev/disk0

If successful, you can then enter the command given below to add the free space back to macOS. (You may need to reboot to macOS before entering the command.)

sudo diskutil apfs resizeContainer disk0s2 0
4
  • An error appeared : gpt destroy: error: bogus map gpt destroy: unable to open device 'disk0': No such file or directory. How to fix the bogus? Nov 21, 2019 at 6:25
  • OK. You can try again. Nov 21, 2019 at 6:41
  • Thanks mate! I can finally boot to macOS. However, the last step doesn't seem to work and somehow 32 GB is missing. Any idea where it goes? Nov 21, 2019 at 7:10
  • I am not sure. Sometimes you have to substitute disk1 for disk0s2. You can try reposting the output from diskutil list and gpt -r show /dev/disk0. You could also post the final output from sudo diskutil apfs resizeContainer disk0s2 0. Nov 21, 2019 at 7:31

You must log in to answer this question.

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