Recreating a Fusion Drive

Not the Apple Car

I recently decided to trade in my iMac. To prepare for trade, I needed to erase the fusion drive and re-install OS X. This proved harder than expected.

One apparent reason for the difficulty was that I had turned on FileVault for the whole volume. This may have been one reason why the El Cap Installer app would not let me install onto the fusion drive. (But I'm not sure: the new Disk Utility GUI sure is reluctant to inform users about why controls are disabled, and about the specifics of any errors it detects.)

A more significant problem was that I couldn't boot from the recovery partition. About a year ago I had replaced the old iMac's internal hard drive with a 2.5TB fusion drive. I'd used OWC's instructions to create the fusion drive's CoreStorage volume. Those instructions – at the time of the upgrade, at least – made the recovery partition a part of the Core Storage multi-disk volume that constitutes the fusion drive.

A recovery partition needs to be separate, not part of a logical volume family. Otherwise you can't boot from it.

(Apologies if I'm getting the terminology wrong. I don't understand CoreStorage very well at all.)

The upshot of all of this – a recovery partition buried within a logical volume family, and a password-protected logical volume [family] – was that, shortly after I started the erase/install process, I found myself with an unbootable logical volume.

Bootable External Drive FTW

To recover, I installed OS X on an external SSD and connected it via Firewire 800. I needed to run full-up OS X because it provided command-line access to diskutil. The bootable El Cap installer thumb drive with which I'd started did not include Terminal app, and the aforementioned Disk Utility GUI was not up to the task of recreating a fusion drive; it appeared unable even to split the fusion drive into separate SSD and hard drive volumes.

I recreated the fusion drive with the help of these websites:

Even with all of this help, I couldn't figure out how to create a recovery partition, which has a filesystem type of Apple_Boot. Fortunately, the examples in the diskutil man page provided the necessary incantation.

Once the fusion drive's volume and the separate recovery partition had been created, I needed to copy the El Cap installer app to the SSD drive and run it from there, from within a full OS X environment. Every time I tried to install OS X by booting from the thumb drive, I had to enter my iTunes Store credentials; then, after downloading the entire OS from iTunes, the installer would fail with a generic error message.

By contrast, when I launched the installer from the booted SSD, it immediately began installing with no iTunes login and no download. A few minutes later the system rebooted to the "Set Up Your Mac" (sic) UI. Ready to pack and ship...

Incantations

Here are the commands I used to recreate the fusion volume. Note that the sequence of disk names is a little odd:

  • disk0 was the internal SSD.
  • disk1 was the bootable installer on a thumb drive, which I hadn't yet copied to the external SSD.
  • disk2 was the external SSD drive.
  • disk3 was the internal spinning disk.

First, see what constitutes the existing CoreStorage logical volume groups.

$ diskutil cs list
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group ABCDEF01-2345-6789-ABCD-EF0123456789
    =========================================================
    Name:         FusionDrive
    Status:       Online
    Size:         2479299067904 B (2.5 TB)
    Free Space:   2471479828480 B (2.5 TB)
    |
    +-< Physical Volume 01234567-89AB-CDEF-0123-456789ABCDEF
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk0s2
    |   Status:   Online
    |   Size:     479760007168 B (479.8 GB)
    |
    +-< Physical Volume 89ABCDEF-0123-4567-89AB-CDEF01234567
        ----------------------------------------------------
        Index:    1
        Disk:     disk3s2
        Status:   Online
        Size:     1999539060736 B (2.0 TB)

Break the FusionDrive logical volume group back into its physical volumes.

$ sudo diskutil cs delete FusionDrive
The Core Storage Logical Volume Group UUID is ABCDEF01-2345-6789-ABCD-EF0123456789
Started CoreStorage operation
Destroying Logical Volume Group
Erasing disk0s2
Initialized /dev/rdisk0s2 as a 447 GB case-insensitive HFS Plus volume with a 40960k journal
Mounting disk
Erasing disk3s2
Initialized /dev/rdisk3s2 as a 2 TB case-insensitive HFS Plus volume with a 155648k journal
Mounting disk
Finished CoreStorage operation

Carve out the recovery partition, with filesystem type 'Apple_Boot', from the 2TB drive.

$ sudo diskutil splitPartition disk3s2 JHFS+ DataPart R %Apple_Boot% %noformat% %recovery%
Password:
Started partitioning on disk3s2 Internal2TB
Splitting
Unmounting disk
Waiting for the disks to reappear
Formatting disk3s2 as Mac OS Extended (Journaled) with name DataPart
Initialized /dev/rdisk3s2 as a 2 TB case-insensitive HFS Plus volume with a 155648k journal
Mounting disk
Finished partitioning on disk3s2 Internal2TB
/dev/disk3 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk3
   1:                        EFI EFI                     209.7 MB   disk3s1
   2:                  Apple_HFS DataPart                2.0 TB     disk3s2
   3:                 Apple_Boot                         650.0 MB   disk3s3

Create the CoreStorage logical volume group, giving it the name "Fusion".

$ sudo diskutil cs create Fusion disk0 disk3s2
Password:
Started CoreStorage operation
Unmounting disk0
Repartitioning disk0
Unmounting disk
Creating the partition map
Rediscovering disk0
Adding disk0s2 to Logical Volume Group
Unmounting disk3s2
Touching partition type on disk3s2
Adding disk3s2 to Logical Volume Group
Creating Core Storage Logical Volume Group
Switching disk0s2 to Core Storage
Switching disk3s2 to Core Storage
Waiting for Logical Volume Group to appear
Discovered new Logical Volume Group "FD2E200A-F7B4-4E10-BC9A-E3666F9653DF"
Core Storage LVG UUID: FD2E200A-F7B4-4E10-BC9A-E3666F9653DF
Finished CoreStorage operation

Finally, in the words of the diskutil man page, "Export a new logical volume family, with a new logical volume under it, out of a CoreStorage logical volume group." Make it a journaled HFS+ volume (jhfs+).

$ sudo diskutil cs createVolume FD2E200A-F7B4-4E10-BC9A-E3666F9653DF jhfs+ "fusion drive" 100%
Started CoreStorage operation
Waiting for Logical Volume to appear
Formatting file system for Logical Volume
Initialized /dev/rdisk4 as a 2 TB case-insensitive HFS Plus volume with a 196608k journal
Mounting disk
Core Storage LV UUID: 138E437B-867C-4DAF-A007-E0E8240652D8
Core Storage disk: disk4
Finished CoreStorage operation

Use the Desktop, Luke

The last steps, once I bumbled onto them, were to boot to OS X on the external SSD, copy the El Cap installer app to the desktop, and run it from there.