如何在不丢失数据的情况下解决 efi 混乱问题

如何在不丢失数据的情况下解决 efi 混乱问题

正在安装 Ubuntu 和 MacOS Catalina。我需要 Windows 来进行项目工作,所以我决定创建一个分区并在其中刷新 Windows... 这样做我搞砸了,没有显示启动 MacOS 的选项。现在我可以毫无问题地登录 Ubuntu,那么有什么办法可以启动位于 disk0s2 的 MacOS 吗?Disk0s1 是 EFI 我可以从 Ubuntu 访问 /EFI/EFI 我可以在那里看到 4 个文件夹...Apple、Boot、Microsoft、Ubuntu。我该怎么办?附言:我有一个 50GB 的空白分区,在外部硬盘上我有一个 5.5GB 的旧版 MacOS ISO 文件。

答案1

下面是我打开 MacOSX 的详细过程。

步骤 1:sudo gdisk -l /dev/sda

derek@derek-MacBookPro:~$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 490234752 sectors, 233.8 GiB
Model: APPLE SSD SM0256
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): F3A656EC-6327-4E3B-B8D4-24D7C90F18DD
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 490234718
Partitions will be aligned on 8-sector boundaries
Total free space is 105470093 sectors (50.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       294970071   140.5 GiB   FFFF  MacOSX
   3       400439296       490233855   42.8 GiB    8300

步骤2:sudo efibootmgr -v

derek@derek-MacBookPro:~$ sudo efibootmgr -v
BootCurrent: 0000
Timeout: 5 seconds
BootOrder: 0002,0001,0000,0080
Boot0000* ubuntu    HD(1,GPT,ba591477-7a5b-4314-95e2-3ea359d0b28c,0x28,0x64000)/File(\EFI\ubuntu\shimx64.efi)
Boot0001* Linux HD(1,GPT,ba591477-7a5b-4314-95e2-3ea359d0b28c,0x28,0x64000)/File(\EFI\ubuntu\grub.efi)FFFF.0000.0080...............
Boot0002* Linux HD(1,GPT,ba591477-7a5b-4314-95e2-3ea359d0b28c,0x28,0x64000)/File(\EFI\ubuntu\grub.efi)4.1.2.3............
Boot0080*   PciRoot(0x0)/Pci(0x1c,0x4)/Pci(0x0,0x0)/Sata(0,0,0)/HD(1,GPT,ba591477-7a5b-4314-95e2-3ea359d0b28c,0x28,0x64000)/File(\EFI\BOOT\BOOTX64.efi)
BootFFFF*   PciRoot(0x0)/Pci(0x1c,0x4)/Pci(0x0,0x0)/Sata(0,0,0)/HD(1,GPT,ba591477-7a5b-4314-95e2-3ea359d0b28c,0x28,0x64000)/File(\EFI\BOOT\BOOTX64.efi)

步骤 3:sudo sgdisk -i 2 /dev/sda

derek@derek-MacBookPro:~$ sudo sgdisk -i 2 /dev/sda
Partition GUID code: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF (Unknown)
Partition unique GUID: 4D99D8DA-F7FF-451F-B9F2-074010EBF442
First sector: 409640 (at 200.0 MiB)
Last sector: 294970071 (at 140.7 GiB)
Partition size: 294560432 sectors (140.5 GiB)
Attribute flags: 0000000000000000
Partition name: 'MacOSX'

步骤 4:sudo sgdisk -t 2:7C3457EF-0000-11AA-AA11-00306543ECAC /dev/sda

derek@derek-MacBookPro:~$ sudo sgdisk -t 2:7C3457EF-0000-11AA-AA11-00306543ECAC /dev/sda
[sudo] password for derek: 
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.

此后,我重新启动了 MacBook,并且能够在启动菜单中看到 MacOS,因为格式已恢复为主动防御系统

相关内容