Recovery – Adding DIY Fusion Drive Recovery HD to CoreStorage Volume Group

backupcore-storagefusion-driverecovery

After creating a "DIY Fusion Drive" using the methods below in 10.8, I'm now wondering how to add a RecoveryHD partition to the internal drive.

Here's what I did to create a Logical Volume Group across two physical volumes (128G SSD/750GHD)

(make a clone / backup of all your data first)
diskutil list (take note of the disk## of the two drives. In my case: disk0/disk1)
diskutil corestorage create fusion_volume_group disk0 disk1
diskutil corestorage list (take note of the Logical Volume Group UUID)
diskutil corestorage createVolume <UUID> jhfs+ FusionHD 749g
restore the clone onto the FusionHD

This worked great, but now my RecoveryHD is gone. I'd like to add it back (it's on the external drive I cloned from my original HD)

Here's what the partition layout looks like right now:

$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *120.0 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:          Apple_CoreStorage                         119.7 GB   disk0s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *750.2 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:          Apple_CoreStorage                         749.3 GB   disk1s2
   3:                 Apple_Boot Boot OS X               650.0 MB   disk1s3
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS FusionHD               *744.5 GB   disk2

Does anyone know the diskUtil commands to add the recovery HD? Ideally after the fact, which is where I'm at now?

Best Answer

You'll need to partition the drives first, putting the Recovery partition on one of your physical drives. It can't be part of the Fusion drive as its unlikely you can boot directly into a Core Storage logical volume (you need a boot loader separately).

Take note of the partition structure in this Ars Technica article about the Fusion drive.

The best way to do this is probably to start fresh by reinstalling Mountain Lion on either the SSD or HDD, then repeat the Fusion process with just the proper partition.

Once you've done a standard install, check your partitions by running diskutil list, which should give output similar to this:

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *120.0 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            119.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

Make note of the identifier of the Macintosh HD partition (disk0s2 in this case).

Then do the same steps you performed before, but change the diskutil corestorage create fusion_volume_group command so to specify the disk0s2 (or whatever the equivalent in your case is), and the identifier of the drive you didn't install OS X on. The resulting command should be similar to diskutil corestorage create fusion_volume_group disk0s2 disk1 but make sure you've got the identifiers correct. The key is that we want to make a volume group out of just the Macintosh HD partition, not the whole drive (so that the EFI and Recovery partitions don't get wiped out). Then follow the rest of the procedure as you did before.