I have an issue with my MacBook mid 2012. After deleting my Ubuntu partition, I lost my principal partition of macOS x. When I restart the MacBook and pressed option, nothing appeared. I tried to fix with Disk Utility on cmd+r, but it did not work. Next, I installed macOS on the Ubuntu partition and I am trying to repair the lost partition from the terminal. I read some posts, but when I try to run the function:
sudo gpt remove -i 2 /dev/disk0
It said
gpt remove: unable to open device '/dev/disk0': Resource busy
then I read about the force unmount to solve it but appear this message:
Unmount of disk0 failed: at least one volume could not be unmounted
Unmount was dissented by PID 1 (/sbin/launchd)
Dissenter parent PPID 0 (kernel_task)
When I run Diskutil, the following information appeared
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *240.1 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF 191.5 GB disk0s2
3: Microsoft Basic Data Sin título 8.0 GB disk0s3
4: Apple_APFS Container disk1 40.3 GB disk0s4
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +40.3 GB disk1
Physical Store disk0s4
1: APFS Volume Mac2 - Datos 7.9 GB disk1s1
2: APFS Volume Preboot 25.3 MB disk1s2
3: APFS Volume Recovery 525.0 MB disk1s3
4: APFS Volume VM 1.1 GB disk1s4
5: APFS Volume Mac2 11.0 GB disk1s5
/dev/disk2 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +20.5 MB disk2
1: Apple_APFS Container disk3 20.4 MB disk2s1
/dev/disk3 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +20.4 MB disk3
Physical Store disk2s1
1: APFS Volume wxHexEditor for Mac 8.9 MB disk3s1
/dev/disk4 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: DownloadCache +41.9 MB disk4
/dev/disk5 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +61.4 MB disk5
1: Apple_HFS iBoysoft Data Recovery 61.4 MB disk5s1
If someone can help me, I will be grateful!
sudo gpt remove -i 2 /dev/disk0
It said
gpt remove: unable to open device '/dev/disk0': Resource busy
then I read about the force unmount to solve it but appear this message:
Unmount of disk0 failed: at least one volume could not be unmounted
Unmount was dissented by PID 1 (/sbin/launchd)
Dissenter parent PPID 0 (kernel_task)
When I run Diskutil, the following information appeared
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *240.1 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF 191.5 GB disk0s2
3: Microsoft Basic Data Sin título 8.0 GB disk0s3
4: Apple_APFS Container disk1 40.3 GB disk0s4
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +40.3 GB disk1
Physical Store disk0s4
1: APFS Volume Mac2 - Datos 7.9 GB disk1s1
2: APFS Volume Preboot 25.3 MB disk1s2
3: APFS Volume Recovery 525.0 MB disk1s3
4: APFS Volume VM 1.1 GB disk1s4
5: APFS Volume Mac2 11.0 GB disk1s5
/dev/disk2 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +20.5 MB disk2
1: Apple_APFS Container disk3 20.4 MB disk2s1
/dev/disk3 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +20.4 MB disk3
Physical Store disk2s1
1: APFS Volume wxHexEditor for Mac 8.9 MB disk3s1
/dev/disk4 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: DownloadCache +41.9 MB disk4
/dev/disk5 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +61.4 MB disk5
1: Apple_HFS iBoysoft Data Recovery 61.4 MB disk5s1
If someone can help me, I will be grateful!