I have attempted to install Linux on my MacBook Pro 15" alongside macOS (Catalina) for a team project.
Since I needed the space reserved for the Linux partition back, I have decided to remove it through the standard disk utility.App
procedure.
As you can see from the sidebar view, the two partitions reserved for Linux were respectively:
disk0s3
: for swap memory (16 GB), formatted as MS-DOS FATdisk0s4
: (350 GB) Volume for the OS
There's also an SD card, but it is used as an external support
Firstly, I foolishly removed (with -
) the SWAP partition (disk0s3 volume); Then I noticed that disk0s4
was not a Container disk1 "child" anymore.
To better understand what was going on, I ran diskutil list
, whose output was
/dev/disk0 (internal, physical)
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +1 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF 635.5 GB disk0s2
3: Microsoft Basic Data Untitled 350.4 GB disk0s4
/dev/disk1 (synthesized)
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +633.5 GB disk1
Physical Store disk disk0s2
1: APFS Volume macOS - Dati 380.9 GB disk1s1
2: APFS Volume Preboot 81.4 MB disk1s2
3: APFS Volume Recovery 530.0 MB disk1s3
4: APFS Volume macOS 11.3 GB disk1s4
5: APFS Volume VM 1.1 GB disk1s5
/dev/disk0 (internal, physical)
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme +256.1 GB disk2
0: Windows_NFTS +256.1 GB disk2s1
Then the laptop suddenly died (I guess the battery was low).
Currently, As I turn it on, it just displays the grub2 menu.
Also, By restarting it and by keeping pressed Alt, I can only choose "EFI boot" and by pressing Enter, it returns to the initial stage (grub2 menu).
Therefore, I made the laptop go into recovery mode through Alt+Cmd+R.
At first, by simply running the terminal command diskutil list
no volumes were listed under disk0
, nor under disk1
(Differently from what happened in this case) as it seemed it did not recognise the SSD anymore (which, btw is a Samsung SSD 970 Evo Plus, size 1 TB).
-bash-3.2# diskutil list
/dev/disk0 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +1 TB disk0
1: Apple_HFS OS X Base System 2.0 GB disk0s1
/dev/disk1 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +5.2 MB disk1
/dev/disk2 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk2
/dev/disk3 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk3
/dev/disk4 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk4
/dev/disk5 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk5
/dev/disk6 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk6
/dev/disk7 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk7
/dev/disk8 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk8
/dev/disk9 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk9
/dev/disk10 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk10
/dev/disk11 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk11
/dev/disk12 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk12
/dev/disk13 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Untitled +524.3 KB disk13
/dev/disk14 (internal, physical)
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme +256.1 GB disk14
0: Windows_NFTS Pippo +256.1 GB disk14s1
also, by running gpt -r show disk0
the output was
-bash-3.2# gpt -r show disk0
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 3927784 1 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
4189935 32 Sec GPT table
4189967 1 Sec GPT header
At a later time, after restarting the computer, entering recovery mode, I noticed a change in the interface, almost as if it had been updated. In fact, running the same commands, I got respectively
-bash-3.2# diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF 633.5 GB disk0s2
(free space) 16.1 GB -
3: Microsoft Basic Data UNTITLED 350.4 GB disk0s3
/dev/disk1 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +3.2 GB disk1
1: EFI EFI 209.7 MB disk1s1
2: Apple_HFS macOS Base System 2.9 GB disk1s2
/dev/disk2 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +10.5 MB disk2
/dev/disk3 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +10.5 MB disk3
/dev/disk4 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk4
/dev/disk5 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk5
/dev/disk6 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk6
/dev/disk7 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk7
/dev/disk8 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +10.5 MB disk8
/dev/disk9 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +2.1 MB disk9
/dev/disk10 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +4.2 MB disk10
/dev/disk11 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +1.0 MB disk11
/dev/disk12 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *256.1 GB disk12
1: Windows_NTFS Pippo 256.1 GB disk12s1
/dev/disk13 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +2.1 MB disk13
/dev/disk14 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk14
/dev/disk15 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +2.1 MB disk15
/dev/disk16 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk16
/dev/disk17 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +1.0 MB disk17
/dev/disk18 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk18
/dev/disk19 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk19
/dev/disk20 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +2.1 MB disk20
/dev/disk21 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +2.1 MB disk21
whereas, by running again gpt -r show disk0
-bash-3.2# gpt -r show disk0
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 1237327656 2 GPT part - FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
1237737296 31357104
1269094400 684429312 3 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
1953523712 1423
1953525135 32 Sec GPT table
1953525167 1 Sec GPT header
Lastly, in the start screen, 'Install an OS' no longer appears, but rather 'Install Monterey'.
Is there any way to solve this trouble and start back macOS?
Best Answer
Note: This answer works with macOS. In other words, Sierra (macOS 10.12) through Sonoma (macOS 14).
Many of the past answers, posted here at Ask Different to this type of question, used the
gpt
command to fix the GUID Partition Table (GPT). However, since this is no longer possible with the newer releases of macOS, this answer will use the third partygdisk
command instead. This command will be downloaded from the SourceForge project GPT fdisk and will be automatically removed when the Mac is restarted.Boot to Recovery. Use the command below to confirm the (product) version of macOS is 10.12 or newer.
Get the
gdisk
command. Enter the commands given below. The first command downloads a script which be used to getgdisk
. The second command executes this script. If you do not wish to trust this script, then you can substitute the commands given in the section below titled "Gettinggdisk
Without Using a Script".Fix the GPT. Enter the command below to get the identifier for the drive with the GPT that needs repair.
Enter the command below. If your identifier is not
disk0
, then make the appropriate substitution.The
gdisk
command is interactive. The input can be taken from the first column of the table given below.p
s
d
3
t
2
af0a
p
w
y
Restart the Mac to macOS.
Recover the free space. Enter the command below to get the identifier for the
Apple_APFS
container.Enter the command below. If your identifier is not
disk0s2
, then make the appropriate substitution.You are finished.
Getting
gdisk
Without Using a Script