0

I am currently running a 2014 13'' rMBP. I recently tried to delete a Bootcamp partition in Disk Utility. When I tried to reboot my system, it did not boot OS X (Mojave) and instead could only boot to the (empty) Bootcamp partition. I followed klanomath's advice in this article, and articles like it. I found out using dd if=/dev/disk0s2 count=3 | vis -c that my original partition with the bootable OS X was an APFS partition.

I tried to create and add the volume back via gpt add:

diskutil umountDisk disk0
gpt -add -i 2 -b 409640 -s 2542739416 -t 7C3457EF-0000-11AA-AA11-00306543ECAC /dev/disk0

but the return was saying something like "not enough space".

When I run diskutil list now, I get the following readout, after removing volume 2, 3, and 4. 3 was a Linux Swap partition and 4 was Linux:

    /dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS                         967.3 MB   disk0s5
   3:                 Apple_APFS Container disk1         57.1 GB    disk0s6

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +57.1 GB    disk1
                                 Physical Store disk0s6
   1:                APFS Volume new mac                 30.4 GB    disk1s1
   2:                APFS Volume Preboot                 43.4 MB    disk1s2
   3:                APFS Volume Recovery                517.0 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *16.0 GB    disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS Install macOS High S... 15.7 GB    disk2s2

Then, sudo gpt -r show disk0 gives the following:

      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  863281248         
  863690888    1889311      5  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  865580199        857         
  865581056  111523968      6  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  977105024          3         
  977105027         32         Sec GPT table
  977105059          1         Sec GPT header

Now I'm just stuck. I created a volume on the old Bootcamp to at least write this post (you'll see it as 'new mac'). Any and all help is appreciated.

Update:

Posting the output of sudo dd if=/dev/disk0 count=1 skip=409640 | hexdump -Cv:

1+0 records in
1+0 records out
512 bytes transferred in 0.000418 secs (1225033 bytes/sec)
00000000  d6 31 b5 5e 2d cf 09 45  01 00 00 00 00 00 00 00  |.1.^-..E........|
00000010  22 5a 11 00 00 00 00 00  01 00 00 80 00 00 00 00  |"Z..............|
00000020  4e 58 53 42 00 10 00 00  b0 67 d5 05 00 00 00 00  |NXSB.....g......|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  02 00 00 00 00 00 00 00  e4 58 de be 33 c1 40 f1  |.........X..3.@.|
00000050  bb c7 0d b0 84 3d 7e 2c  90 4e 25 00 00 00 00 00  |.....=~,.N%.....|
00000060  23 5a 11 00 00 00 00 00  18 01 00 00 2c 6c 00 00  |#Z..........,l..|
00000070  47 9d 05 00 00 00 00 00  d2 0d 05 00 00 00 00 00  |G...............|
00000080  15 01 00 00 bb 5c 00 00  13 01 00 00 02 00 00 00  |.....\..........|
00000090  62 5c 00 00 59 00 00 00  04 b3 21 00 00 00 00 00  |b\..Y.....!.....|
000000a0  6a d5 0b 00 00 00 00 00  01 04 00 00 00 00 00 00  |j...............|
000000b0  00 00 00 00 64 00 00 00  03 04 00 00 00 00 00 00  |....d...........|
000000c0  fa 2b 05 00 00 00 00 00  fc 2b 05 00 00 00 00 00  |.+.......+......|
000000d0  86 d1 05 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000100  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000120  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000130  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000140  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000150  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000160  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000170  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000180  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000190  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000200
  • Can you include in your question the other options and parameters you used when you entered the gpt add command? – David Anderson Mar 24 at 15:54
  • Sure thing @DavidAnderson The edits are included above. – Kevin M. Mar 24 at 16:41
  • A suppose you should post the output from the command sudo dd if=/dev/disk0 count=1 skip=409640 | hexdump -Cv. You will need to disable System Integrity Protection (SIP) before executing the command. – David Anderson Mar 24 at 18:30
  • Got it! @DavidAnderson – Kevin M. Mar 24 at 19:11
0

You entered this:

diskutil umountDisk disk0
gpt add -i 2 -b 409640 -s 2542739416 -t 7C3457EF-0000-11AA-AA11-00306543ECAC /dev/disk0

You should have entered this:

diskutil umountDisk disk0
sudo gpt add -i 2 -b 409640 -s 782974336 -t apfs /dev/disk0

Note: The sudo may not be required. You may need to disable System Integrity Protection (SIP) before executing the commands. Older versions of gpt will require substituting 7C3457EF-0000-11AA-AA11-00306543ECAC for apfs.

For an explanation, see the accepted answer to Tried to fix filesystem type: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF and probably made it worse.

  • After putting in the new command, I get the output gpt: illegal option --a usage: gpt [-frv] [-p nparts] command [options] device ... – Kevin M. Mar 25 at 15:31
  • @Kevin M.: Sorry about that. I made a correction. – David Anderson Mar 25 at 15:53

You must log in to answer this question.

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