System fails to recognize main macos boot partition after Ubuntu dual booting attempt
I recently attempted, and temporarily succeeded, in dual-booting Ubuntu and MacOS Mojave on my MacBook Air. After I installed and successfully tested Ubuntu, I tried to use Disk Utility to create a third partition in ExFat to be shared between the two operating systems. After running for a while, Disk Utility quit unexpectedly, but nothing else seemed out of the ordinary. I tested the new partition on MacOS, and it seemed to work fine. However, when I rebooted my Mac while holding Option, the only bootable disk that showed up was Ubuntu. The output of Disks on Ubuntu (attached image) shows me that the main partition (191 GB Unknown) is no longer recognized, the Shared partition I just created is inexplicably recognized as HFS+ instead of ExFAT as intended.
Is there any way for me to restore MacOS without formatting the damaged partition?
Solution 1:
From Ubuntu, you need to run the command gdisk
.
- Open a Terminal. Basically, press the control+alt/option key combination.
-
Enter the command given below to execute
gdisk
.sudo gdisk /dev/sda
-
If the version is not at least
1.0.4
, then enter theq
command to exitgdisk
. Next, enter the commands given below to updategdisk
, then return to step 2. Otherwise, proceed to step 4.sudo apt-get update sudo apt-get install gdisk
-
Enter the following when prompted by
gdisk
. This will change the type for the macOS partition toAPFS
.t 2 af0a w y
References
GPT fdisk Tutorial
Man page of gdisk