Remove Linux partition on Mac. CoreStorage problems

I have a Macbook pro 2015 with a 256 GB SSD and a Linux partition. I would like to remove the partition. Following the steps written in here, I got stuck in the Modify step. Once I execute the command gpt add -b 409649 ... and than I do the diskutil list command, it does not appear any disk with the size 60 GB.

output of terminal 1:

gpt -r show disk0:

Does any one know how to solve my problem?


Solution 1:

By accident the OP took one command in the answer Remove Ubuntu and grow Mac partition literally and entered:

gpt add -b 409640 -i 2 -s 118430560 -t 53746F72-6167-11AA-AA11-00306543ECAC /dev/disk0

to add a partition table entry, though his original macOS volume was much larger. The command above creates a ~60 GB CoreStorage partition right after the EFI partition. No output of the previous partition table was available (sudo) gpt -r show diskX.

To recreate the partition table an external volume with a full macOS install, wxHexEditor and some knowledge about the typical sizes and internal structures of macOS recovery volumes is necessary.

  • Install macOS to a thumb drive and configure it.
  • Download and install wxHexEditor
  • Search for the typical start blocks of the Recovery HD like in this answer.
  • Recreate the Recovery HD with gpt add -i 3 ...
  • Recreate the main macOS volume between EFI and Recovery HD partition gpt add -i 2 ...
  • Verify the disk and the volumes with diskutil verify[Disk|Volume] diskYsX
  • Expand the recovered main volume