How do I re-fuse an unfused Fusion Drive, ideally without formatting?

I have a 5k iMac with a Fusion Drive. I had trouble with macOS, so I reinstalled it, and restored from a Time Machine backup using Migration Assistant.

After that, the system has been very slow, and beachballs all the time. Looking in Disk Utility, I find that the Fusion Drive was destroyed:

enter image description here

Notice that Macintosh HD is within the HDD, and the SSD is unformatted.

Here's the output of diskutil cs list. It seems that there's already a Core Storage logical volume group, but it's too small (121GB rather than 2.1TB):

CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group 7090C28E-A2D2-49C3-BDA4-0B4C96F499B4
    =========================================================
    Name:         Macintosh HD
    Status:       Offline
    Size:         120988852224 B (121.0 GB)
    Free Space:   -none-
    |
    +-< Physical Volume E8FF728C-B2AD-44F5-B9B9-EE0BE22D1782
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk0s2
    |   Status:   Checking
    |   Size:     120988852224 B (121.0 GB)
    |
    +-< Physical Volume FCB9BDAF-B3E1-403D-B078-CD967BEDECB3
        ----------------------------------------------------
        (No properties)

And here's the partition map. Strangely, I have Macintosh HD and EFI partitions on both disks:

$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            121.0 GB   disk0s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk0s3

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS Macintosh HD            2.0 TB     disk1s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk1s3

And here's more detailed info about the HDD:

$ diskutil info /dev/disk0s2
   Device Identifier:        disk0s2
   Device Node:              /dev/disk0s2
   Whole:                    No
   Part of Whole:            disk0

   Volume Name:              Macintosh HD
   Mounted:                  Yes
   Mount Point:              /

   Partition Type:           Apple_HFS
   File System Personality:  Journaled HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended (Journaled)
   Journal:                  Journal size 155648 KB at offset 0x3a38000
   Owners:                   Enabled

   OS Can Be Installed:      Yes
   Recovery Disk:            disk0s3
   Media Type:               Generic
   Protocol:                 SATA
   SMART Status:             Verified
   Volume UUID:              388929F6-08C6-31FF-9AB1-3AB0E5FF1383
   Disk / Partition UUID:    D3F0C33F-6052-46F9-A4BE-90D4435B183A

   Disk Size:                2.0 TB (1999404957696 Bytes) (exactly 3905087808 512-Byte-Units)
   Device Block Size:        512 Bytes

   Volume Total Space:       2.0 TB (1999404957696 Bytes) (exactly 3905087808 512-Byte-Units)
   Volume Used Space:        1.3 TB (1325673127936 Bytes) (exactly 2589205328 512-Byte-Units) (66.3%)
   Volume Available Space:   673.7 GB (673731829760 Bytes) (exactly 1315882480 512-Byte-Units) (33.7%)
   Allocation Block Size:    4096 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No

   Device Location:          Internal
   Removable Media:          Fixed

   Solid State:              No

And the SSD:

$ diskutil info /dev/disk1s2
   Device Identifier:        disk1s2
   Device Node:              /dev/disk1s2
   Whole:                    No
   Part of Whole:            disk1

   Volume Name:              Not applicable (no file system)
   Mounted:                  Not applicable (no file system)
   File System:              None

   Partition Type:           Apple_CoreStorage
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 PCI
   SMART Status:             Verified
   Disk / Partition UUID:    0993633C-EC5D-473D-AC5A-8CB967E9D532

   Disk Size:                121.0 GB (120988852224 Bytes) (exactly 236306352 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         Not applicable (no file system)

   Device Location:          Internal
   Removable Media:          Fixed

   Solid State:              Yes
   Device Location:          "SSD"

   This disk is a Core Storage Physical Volume (PV).  Core Storage Information:
   PV UUID:                  E8FF728C-B2AD-44F5-B9B9-EE0BE22D1782
   LVG UUID:                 7090C28E-A2D2-49C3-BDA4-0B4C96F499B4

diskutil repairDisk works for the HDD (disk0), and doesn't seem to find much to repair. But it flags an error on the SSD (disk1):

$ sudo diskutil repairDisk /dev/disk1
[...]
Logical Volume Group 7090C28E-A2D2-49C3-BDA4-0B4C96F499B4 spans 2 devices
Incomplete or inconsistent CoreStorage Physical Volume set
Storage system check exit code is 1
Problems were encountered during repair of the partition map
Error: -69716: Storage system verify or repair failed
Underlying error: 1: Operation not permitted

When I run fsck_cs /dev/disk0, it says that it's not a CoreStorage volume, and likewise for disk1.

Has the Fusion Drive become unfused? How do I re-fuse it?

Ideally without formatting or reinstalling macOS? I'll backup just in case, but I hope not to use it.

I looked at diskutil mergePartitions ..., but it seems to work only for partitions on the same physical disk. Is there another way?

Ideally using free software, but I'm willing to pay if needed.

This is on Sierra, 10.12.1.


If your disks or volumes don't have a second problem the following steps should work:

  • Backup your main system volume
  • Boot to Recovery Mode
  • Open in the menubar Utilities > Terminal
  • Get an overview with diskutil list and diskutil cs list
    Below I assume the SSD is disk0 and the HDD disk1 (compare the sizes)
  • Check all important volumes and drives with diskutil verifyDisk diskX and diskutil verifyVolume diskXsY. If necessary repair the disks and volumes.
  • Revert the CoreStorage LVG (SSD) to a normal partition setup:

    diskutil cs revert lvUUID
    

    This may fail because an lvUUID doesn't exit - then you have to try to delete the Logical Volume Group.

    diskutil cs delete lvgUUID
    

    This may fail also - then you have to "hard-reset" the SSD's partition table by repartitioning it. Finally check with diskutil cs list that no Logical Volume Group exists.

  • Convert your main system volume (disk1s2) to a CS Logical Volume Group:

    diskutil cs convert disk1s2
    

    Your data will be preserved. This will assign new UUIDs to the (new) LVG, PV, LVF and the LV.

  • Add disk0s2 as a Physical Volume to the LVG:

    diskutil cs addDisk lvgUUID disk0s2
    
  • Resize the Logical Volume with:

    diskutil cs resizeVolume lvUUID 0g
    
  • Reboot

with lvUUID = UUID of a Logical Volume; lvgUUID = UUID of a Logical Volume Group. The command diskutil cs addDisk ... is undocumented but works in Sierra.


The approach may fail because other (unknown) obstacles exist. In my VM it worked.