I was able to fidget with the Core Storage volumes and get past the recovery disk error.
Not sure if it's actually doing anything though. About two hours of silence and an uninformative progress bar where I would have expected to hear the backup disk going clackety clack.
Recovering Mac Mini from Time Machine Backup
I have a Mac Mini 2012 with a ~120GB + 1TB fusion drive.
I borked it up a little while trying to install an Ubuntu dual boot and was unable to restore it from my Time Machine backup due to "There was an error creating recovery disk".
To fix that I removed all volumes of all types from the disk and started over, leaving 5gb of space for the recovery partition to be created.
Since I now know what the table ended up looking like (which I'll post back... tomorrow after the backup is restored), I'm confident that I could have done this by resizing as well.
All of these commands are very dangerous if you have data on your disk(s).
I'm using the actual commands that I would use, which are the actual commands that someone else with a factory-installed fusion drive would need to use.
Unless the reason that you're trying to add a recovery drive happens to be that your drive is already utterly messed up, I would NOT recommend following these steps.
HOWEVER, they may come in as a handy references in addition to other instructions in these posts.
Look to see what's there and make proper judgements first:
# See all physical partitions
# See all core storage volumes
diskutil cs list
Removing all volumes
Then delete whatever needs to be deleted:
# Delete a Logical Volume
diskutil cs deleteVolume <lvUUID>
# Delete a Physical Volume
diskutil cs deleteDisk <pvUUID>
# Delete a Logical Volume Group (everything)
diskutil cs delete <lvgUUID>
Recreate the partition table from scratch, if needed:
# Re-partition and format the HDD
# `R` means Remainder
# `5G` means ~4.7GiB
diskutil partitionDisk disk0 2 GPT \
JHFS+ Macintosh\ HD R \
JHFS+ Recovery\ HD 5G
# Re-partition and format the SSD
# the remainder, `R`, is 100% of the usable disk space
diskutil partitionDisk disk1 1 GPT \
JHFS+ Macintosh\ HD R
Create Core Storage
This will be "Macintosh HD" as you know and love
# Create a logical volume group named "Macintosh HD"
diskutil cs create Macintosh\ HD disk0s2 disk1
# Create a volume (of the same name) using 100% of the group
diskutil cs createVolume <lvgUUID> jhfs+ Macintosh\ HD 100%
Note: you may want to reboot at this stage to ensure that the volumes are in the right order.
diskutil unmount "Macintosh HD"
diskutil unmount "Recovery HD"
diskutil unmountDisk /dev/disk0
diskutil unmountDisk /dev/disk1
Free up space
The purpose of creating "Recovery HD" previously - assuming the scenario where you want to restore from a Time Machine backup - is just to reserve extra space at the end of one of the disks so that it doesn't get absorbed into any other volume.
Now it's time to free it back up so that the restore process can create it again.
First check again to see what partitions exist. The numbers should match the output of
diskutil, but if not either reboot or trust
sizes are not listed in bytes but sectors, which are probably 4KiB. It may be better to tell which is which by ratio than by exact size.
gpt -r show /dev/disk0
Now remove the partition corresponding to "Recovery HD". After a reboot that had changed from
disk0s4 for me.
gpt remove -i 4
After that I stopped getting the error about not being able to create a recovery partition. I'll find out tomorrow if the TM recovery actually worked. I'm not sure it will as I don't hear much in the way of disk activity on the backup drive. :-/
Note: resizing core storage
Many of the things I looked at only showed how to resize AND create a new volume, but you can resize without creating a new volume.
# First resize the logical volume
diskutil coreStorage resizeVolume <lvUUID> 1T
# Next resize the physical volume
diskutil coreStorage resizeDisk <pvUUID> 997G
# Tada! You have free space!
Note: Set Recovery HD`s type
I was not able to get success by creating a blank recovery volume. However, if you have the BaseSystem.dmg and are able to restore it, you may want to set the volume type to be a hidden recovery partition.
# Unmount to be able to make changes
diskutil unmount /dev/disk0s3
# Change the type from Apple_HFS to Apple_Boot
asr adjust -target /dev/disk0s3 -settype Apple_Boot