2011 MBP , installed Ubuntu, erased partition, boot failures [duplicate]
Solution 1:
The output you posted indicates disk0s2
is using Core Storage. Below is the part of the image you posted showing this. This image also shows the size of the partition should be 0x68be84f000 bytes, which is 878,658,168 sectors at 512 bytes per sector.
In your question, you stated you entered the commands shown below. This was the wrong solution. The results, from entering these commands, caused you to incorrectly believe disk0s2
was APFS formatted.
gpt remove -i 2 disk0
gpt add -i 2 -b 409640 -s 878658168 -t 7C3457EF-0000-11AA-AA11-00306543ECAC disk0
According to klanomath's answer, you should have entered the commands given below.
gpt remove -i 2 disk0
gpt add -i 2 -b 409640 -s 878658168 -t 53746F72-6167-11AA-AA11-00306543ECAC disk0
According to Wikipedia, Core Storage was introduced by Apple to Mac OS X Lion. So there is a chance making the correction will allow the volume you desire to mount. I do not think making the correction will allow you to boot High Sierra. I state this because disk0s3
appears to have the wrong partition type stored in the GPT.
Note: You will not be able to use the
gpt
command to make the correction while booted to Lion. You could use either boot the Mac as you did when entering the incorrect correction or the macOS Recovery that Tetsujin requested.
Update 1
Evidentially, when the OP entered the incorrect correction, there were no volumes that automatically mounted on the drive with the identifier disk0
. However, since then the OP has installed Lion, which created a new volume that automatically mounts on the partition with the identifier disk0s4
. Therefore, the commands to enter would be the following.
diskutil unmountdisk disk0
gpt remove -i 2 disk0
diskutil unmountdisk disk0
gpt add -i 2 -b 409640 -s 878658168 -t 53746F72-6167-11AA-AA11-00306543ECAC disk0
Note: The
diskutil unmountdisk disk0
command has be repeated becausedisk0s4
will be automatically mounted after thegpt remove -i 2 disk0
command completes.