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/ ls 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'.
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,
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.
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.
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
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.