First of all I know this problem and similar problems have been solved before, but I had tried the solutions from the other posts and I didn’t have luck.

I know klanomath has a lot of experience and have helped people with this problem before, but I don’t know how to contact him, so hopefully klanomath or someone can help me I have really important information in this drive.

So I have a Macbook air 2013 running Macos Mojave and my problem started because I made a partition to my main ssd which is in apple APFS.

I made a MS-DOS FAT 25 gb partition and created a kali Linux bootable file, I successfully installed kali Linux and everything worked correctly, but then I figure out that it was better for me to run Kali Linux inside a virtual machine. So I tried to delete the partition and this is where problems began.

Disk utility wont let me erase this partition, so I found this Youtube tutorial to erase this partition with terminal https://youtube.com/watch?v=3EXogZWQTyU&app=desktop. I followed this tutorial and I typed in terminal the following commands:

ls mnt   

mkdir mnt  

sudo mount –t msdos /dev/disk0s1 mnt  

*then I typed my password”  

ls mnt/  

ls mnt/EFI/  

*Then it appeared APPLE and KALI which was the name of my linux partition*  

cd mnt/EFI/  


sudo rm  -rf KALI  

sudo reboot  

This is where everything went wrong, my Mac rebooted and the missing folder icon appeared, I clicked on Internet recovery and found out in disk utility that my main mac partition was called disk0s2 it was not mounted and the partition type was FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFF.

So this is how I get to this forums and solutions, I followed Klanomath solution with terminal commands in this thread: OS volume shows as type 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF'.

ssd partitions

ssd partitions view

disk0s2 mac partition

disk0s2 showed FFFFF..

First I used this commands

gpt -r show disk0  

dd if=/dev/disk0s2 count=3 | vis –c  

and I found out that I had an APFS partition,

APFS partition code

Then I continued with this tutorial and entered the following commands to unmount disk0, remove and re add second partition but with the proper size:

diskutil umountDisk disk0  

gpt remove -i 2 disk0  

gpt add -i 2 -b 409640 -s 431203056 -t 7C3457EF-0000-11AA-AA11-00306543ECAC  disk0  

diskutil verifyDisk disk0

diskutil verifyVolume disk0s2  

When I entered the last command to verify volume disk0s2 I would get an error telling me that it is in a wrong format and cannot be read.

I did manage to change the partition type to 7C3457EF-0000-11AA-AA11-00306543ECAC. But still it won’t mount the disk or boot.

changed partition type

I thought maybe the problem was because I was following a guide with APFS format for High Sierra, so I founded this other thread for Mojave: https://superuser.com/questions/1368272/dual-boot-mac-linux-macbook-broken-after-creating-a-new-partition

I followed this solution and again I unmounted disk0 and remove and read disk0s2 with the following commands,

diskutil umountDisk disk0  

gpt remove -i 2 disk0  

diskutil umountDisk disk0  

gpt add -i 2 -b 409640 -s 911218016 -t 7C3457EF-0000-11AA-AA11-00306543ECAC disk0

this time I got an error that it said that I don’t have available space

gpt add: disk0: error: no space available on device  

the tutorial said that if you had this problem, just type the following commands and so I did:

gpt -r show /dev/disk0  

diskutil umountDisk disk0  

gpt destroy disk0  

gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0  

gpt add -i 2 -b 409640 -s 911218016 -t 7C3457EF-0000-11AA-AA11-00306543ECAC disk0  

diskutil umountDisk disk0  

gpt add -i 4 -b 927225856 -s 7616512 -t 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F disk0  

diskutil umountDisk disk0  

gpt add -i 5 -b 934842368 -s 42262528 -t 0FC63DAF-8483-4772-8E79-3D69D8477DE4 disk0  

after the command “gpt destroy disk0” I started getting this error gpt add: disk0: error: no primary GPT header; run create or recover

and both my disk0s2 and disk0s3 disappeared.

both partitions disapeared

I started to panic out and I finally did this last solution to fix this problem, I entered in terminal:

gpr create –fp /dev/disk0  

gpt recover /dev/disk0  

gdisk /dev/disk0  

no primary GPT header

And this last command it gave me an error telling me the command is unknown.

So this is where I stand now, im in internet recovery and disk utility just shows my ssd without my partitions disk0s2 and disk0s3.

If anyone can help me I would really appreciate it, and hopefully it will help someone else in the future.


1 Answer 1


You put in your answer that you entered the command gpt -r show disk0, but the screen shots you posted do not reflect this. The funny thing is that the output from this command would have provided the information needed to fix your Mac. Unfortunately, entering this command now would be pointless, since you have destroyed the needed values when you incorrectly entered subsequent commands. Basically, you blindly entered the commands posted in the referenced questions/answers without modifying the integer parameters to match your configuration. However, there is good news. One of your images contains the string NXSB\0\^P\0\0LJI\^C\0\0\0\0. From this string, I can determine the size of the disk0s2 partition is 441078368 sectors. The rest of the integers shown in the commands below are guesses based on my experience.


diskutil unmountDisk /dev/disk0  
gpt destroy /dev/disk0
gpt create /dev/disk0
gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0
gpt add -i 2 -b 409640 -s 441078368 -t 7C3457EF-0000-11AA-AA11-00306543ECAC /dev/disk0

If this works, then consider yourself very lucky.

If you do boot back to macOS Mojave, then you can enter the command given below to reclaim the space formally occupied by Linux.

diskutil apfs resizeContainer disk0s2 0


If you are curious, the command below converts the string back to hexadecimal and printable ASCII character values.

Note: It is important that the string be enclosed by single quotes ('). Do not use double quotes (").

echo -n 'NXSB\0\^P\0\0LJI\^C\0\0\0\0' | unvis | hexdump -Cv

The output is shown below.

00000000  4e 58 53 42 00 10 00 00  4c 4a 49 03 00 00 00 00  |NXSB....LJI.....|

These values can be interpreted the same way as shown in the accepted answer to the question Tried to fix filesystem type: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF and probably made it worse.

  • Thanks so much David! you are a genius. I did as you told me and I got my computer back as I had it before including all my files. I will update this post to let people know when they have this problem that each solution has different parameters so they don´t follow just any other tutorial or guide as I badly did at first.
    – Dantegzz97
    May 9, 2019 at 7:42

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