I use a Macbook Pro that has High Sierra and Fedora in dual-boot. I wasn't using Fedora so I wanted to try Ubuntu 17.10 and I ran a live USB (booting in EFI mode).
Given that all my work-related files, projects, and other "important stuff" (on the Mac side) are already backed up via either Dropbox or remote Git repositories, I decided to delete Fedora and install Ubuntu without doing a full bitstream image of the drive.
At first I deleted the Fedora related partitions using Gnome Disks (this is OK). I started the Ubuntu installer and I did these steps:
- Selected a language > Continue
- Checked "Download updates while installing Ubuntu" > Continue
- Chose "Something else" for the partitions > Continue
- Mistakenly set the type of
/dev/sda2as "Physical volume for encryption" and added my password
Please note that I did not chose to "Overwrite empty disk space". I also did not continue with the installation (I didn't reach the point when it asks you to confirm the new partition table). Rather, I clicked "Back" and then closed the installer immediately.
This should not have written anything to disk. However, the Ubuntu installer decided to write something anyway, it seems.
After rebooting quickly, it was clear that something wrong has been written on disk despite never reaching the confirmation step. The type of the partition has been changed and neither rEFInd (which loads correctly) nor the Apple boot screen can find macOS.
This is the output of
NAME FSTYPE LABEL UUID MOUNTPOINT loop0 squash /rofs sda ├─sda1 vfat EFI 67E3-17ED ├─sda2 crypto 9b2ca99d-cf43-4d35-936d-be37db7b950d └─sda3
sda2 was APFS. In macOS Filevault was enabled, however I can't tell if it was using CoreStorage or native APFS encryption (I suspect the latter as it was migrated from an older version with HFS+).
diskutil list from the Apple Internet recovery yields this:
/dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *500.3 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: 7C3457EF-0000-11AA-AA11-00306543ECAC 349.7 GB disk0s2 3: 5361644D-6163-11AA-AA11-00306543ECAC 1.3 GB disk0s3 /dev/disk1 #: TYPE NAME SIZE IDENTIFIER 0: Apple_partition_scheme *1.3 GB disk1 1: Apple_partition_map 30.7 KB disk1s1 2: Apple_HFS OS X Base System 1.3 GB disk1s2
The second device is the Internet recovery.
disk0s3 is not recognized, despite never being touched in any way. So the Mac now doesn't even boot the local recovery but it relies on the Internet based one.
Back on Ubuntu,
parted complains about a corrupted GPT, but
gdisk thinks it is fine. Here's the output of
Model: ATA APPLE SSD SM0512 (scsi) Disk /dev/sda: 500GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 20.5kB 210MB 210MB fat32 EFI System Partition boot, esp 2 210MB 350GB 350GB 3 350GB 351GB 1306MB Error: Both the primary and backup GPT tables are corrupt. Try making a fresh table, and using Parted's rescue feature to recover partitions.
Most importantly, how can I use Ubuntu to fix the GPT table and set the correct file system type for
Secondly, does the Ubuntu installer write stuff on the partition table even before confirming the changes? Is this intended behavior?
Are there chances to recover the system without reinstalling? As I said, I have backups of the valuable data. What worries me is that I will lose a lot of time for reinstalling applications and things like that.