如何在不丟失資料的情況下解決混亂的 efi

如何在不丟失資料的情況下解決混亂的 efi

Ubuntu 與 MacOS Catalina 一起安裝。我需要 Windows 來進行專案工作,所以我決定建立一個分割區並在其中刷新 Windows...這樣做我搞砸了,並且沒有顯示啟動進入 MacOS 的選項。現在我可以毫無問題地登入 Ubuntu,那麼有什麼方法可以引導我進入位於 disk0s2 的 MacOS 嗎? Disk0s1 是 EFI 我可以從 Ubuntu 存取 /EFI/EFI 我可以看到那裡有 4 個資料夾... Apple、Boot、Microsoft、Ubuntu。我該怎麼辦? PS:我有一個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,因為格式已恢復為AFPS

相關內容