Repairing a broken boot disk after converting to APFS

Later versions of Mac OSX require you to be running APFS, amongst other benefits it improves performance.

The general guidance is to use boot into recovery mode and use the disk utility to convert the disk. This process will convert fine for non boot disks. But if converting your boot drive then it will not create a preboot volume which is required for a successful boot.

After converting your boot disk to AFPS, follow this guide to make it bootable.

First, boot into recovery using Command + R at startup.

Go to Utilities > Terminal.

Please note: all the commands below should run without an errors, check each command's output for error messages before continuing.

Run diskutil apfs list to check partitions and disk numbers, you will see the following output, but with different disk numbers and UUIDs.

APFS Container (1 found)
|
+-- Container disk1 B9426095-BD76-4E33-A1BB-717B053AB1C6
    ====================================================
    APFS Container Reference:     disk1
    Size (Capacity Ceiling):      250790436864 B (250.8 GB)
    Minimum Size:                 250790436864 B (250.8 GB)
    Capacity In Use By Volumes:   190566731776 B (190.6 GB) (76.0% used)
    Capacity Not Allocated:       60223705088 B (60.2 GB) (24.0% free)
    |
    +-< Physical Store disk0s2 0000749D-7A9D-0000-B943-0000BF490000
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk0s2
    |   Size:                       250790436864 B (250.8 GB)
    |
    +-> Volume disk1s1 5D784072-B7D6-3DBC-94C1-E8C8FB8ED111
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s1 (No specific role)
    |   Name:                      Macintosh HD (Case-insensitive)
    |   Mount Point:               /
    |   Capacity Consumed:         186672766976 B (186.7 GB)
    |   FileVault:                 No
    |

Notice the absence of a preboot volume above.

Next, we will create a preboot volume from the terminal using the following command:

diskutil apfs addVolume disk1 apfs Preboot -role B

Please use the correct disk number (disk1 in the example above), based on the output from the list command above.

A new volume will have been created on the disk and mounted.

Create a new directory ready for the preboot files:

mkdir -p /Volumes/Preboot/5D784072-B7D6-3DBC-94C1-E8C8FB8ED111/System/Library/CoreServices

Please use the correct UUID in the command above that matches your Mac boot volume (in our case Macintosh HD)

Now we copy the required files to the new partition:

cp -RP /Volumes/MACINTOSH HD/System/Library/CoreServices /Volumes/Preboot/5D784072-B7D6-3DBC-94C1-E8C8FB8ED111/System/Library/CoreServices

Please use the same UUID as in the previous command rather than the one from our example.

Next, we need to update the main mac volume with info about the new preboot volume:

Run this command to update the preboot. Replace disk2s1 with your mac os disk (not preboot):

diskutil apfs updatepreboot disk1s1

Make sure to use the correct disk number of your Mac boot volume (in our case Macintosh HD).

Then we can run the bless utility to set boot options:

bless --folder /Volumes/Macintosh HD/System/Library/CoreServices --bootefi --verbose

We can do is a final check of the volumes with diskutil apfs list again:

APFS Container (1 found)
|
+-- Container disk1 B9426095-BD76-4E33-A1BB-717B053AB1C6
    ====================================================
    APFS Container Reference:     disk1
    Size (Capacity Ceiling):      250790436864 B (250.8 GB)
    Minimum Size:                 250790436864 B (250.8 GB)
    Capacity In Use By Volumes:   190566731776 B (190.6 GB) (76.0% used)
    Capacity Not Allocated:       60223705088 B (60.2 GB) (24.0% free)
    |
    +-< Physical Store disk0s2 0000749D-7A9D-0000-B943-0000BF490000
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk0s2
    |   Size:                       250790436864 B (250.8 GB)
    |
    +-> Volume disk1s1 5D784072-B7D6-3DBC-94C1-E8C8FB8ED111
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s1 (No specific role)
    |   Name:                      Macintosh HD (Case-insensitive)
    |   Mount Point:               /
    |   Capacity Consumed:         186672766976 B (186.7 GB)
    |   FileVault:                 No
    |
    +-> Volume disk1s2 4BD14D43-3EBB-4499-9C71-1CFCD1260A06
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s2 (Preboot)
    |   Name:                      Preboot (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         19595264 B (19.6 MB)
    |   FileVault:                 No

You'll see the new preboot container listed.

The last thing to do is reboot, and if all went well your Mac should now boot correctly.

Last updated: 10/10/2020