Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

5 Answers 5

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.

share|improve this answer
    
Do you know what the diskutil commands would be to do that operation? –  Jess Bowers Nov 3 '12 at 16:52
    
I added some more info should work, but I don't have a set up I can actually test it on. The Fusion drive stuff is pretty undocumented at this point, and we're just working off what a few people have come up with by trial and error. Be sure to post any results you get here. –  robmathers Nov 3 '12 at 17:15
    
I think you're right about specifying the disk0s2 rather than disk0. I cannot verify this today, as the weekend was my 'tear my machine apart and rebuild' time. Now I have to work! I'll try to test this soon. –  Jess Bowers Nov 5 '12 at 14:34
    
I just installed 10.8.2 onto a brand new empty CS volumes (120GB SSD + 640GB HDD) to see if the ML installer would add a new Recovery partition - it didn't. So the instructions above should be correct, will try on next test deploy. –  da4 Nov 5 '12 at 20:01
    
SUCCESS! Late-2008 MacBook Pro, 2nd HD in optical drive slot: I replaced the main 320GB HD with a 256GB SSD. Following @robmather: I installed Mountain Lion on the SSD; booted the MBP from an external drive; studied the diskutil list output to get the disk IDENTIFIER for "Macintosh HD" on the SSD. Used that with diskutil's corestorage commands to create fusion volume. Booted from Recovery Volume, installed ML and migrated entire original disk to my new 560GB fusion volume. Everything works, even Ubuntu on VMWare. Ordered a slow/cheap 1TB HD; soon my 4-yr-old MBP powers on w 8GB, 1.25TB, SSD! –  Bruce Van Allen Nov 11 '12 at 18:31

Jess Bowers posted a really nice solution but it worked well for me only until this one:

diskutil coreStorage resizeDisk <pvUUID> <size> JHFS+ Recovery 784220160B

And the output was:

Error: -69720: There is not enough free space in the Core Storage Logical Volume Group for this operation

The solution is to resize Logical Volume first. For the following command, lvUUID is the UUID of the Logical Volume and size is equal to current size of the Logical Volume - size of the Recovery partition (or 1GB less than the current size if you follow Jess Bowers' solution word by word):

diskutil coreStorage resizeVolume <lvUUID> <size>

And right after that resizeDisk... and the rest of his solution worked just like a charm.

PS. Just signed up so I can't comment directly, sorry.

share|improve this answer

I find some good answers in this post. I have worked out a step-by-step guide on repartitioning the harddrive with a windows partition (for Windows 7/8 Bootcamp) within the first 2.2 TB space and rebuilding the fusion drive using three partitions.

You will find my guide usefull on http://jochem.ke-works.com/post/38498466700/bootcamp-on-3tb-fusion-drive-macosx

share|improve this answer
1  
Answers on Ask Different need to be more than just a link. It's okay to include a link, but please summarize or excerpt it in the answer. The idea is to make the answer stand alone. –  Daniel Lawson Dec 22 '12 at 7:17
up vote 5 down vote accepted

Ok so I have solved the problem without re-formatting or re-installing. Hopefully most people won't wind up in this situation. See @robmathers answer for tips on how to avoid deleting your Recovery HD in the first place.

WARNING the following commands are fairly low-level and may cause you to loose data. Take proper precautions (backup, clone, etc).

But for anyone in my situation after the RecoveryHD is already gone, here is what I did:

  1. Backup all data / clone your drive
  2. Create a bootable USB (or use an existing HD) with 10.8
  3. Boot into that alternate drive (so you're not modifying the HD you've currently mounted)
  4. Unmount the Fusion HD
  5. Open terminal, switch to superuser and follow these instructions:

List the current configuration, and make a note of which drives you'll be modifying. Your exact sizes and GUIDs will be different than mine. It is crucial to use your numbers instead of mine.

diskutil corestorage list

Take note of the UUID of the physical drive you're adding the Recovery to.

diskutil list

Take note of the exact size in bytes of the Recovery on the current startup disk (disk2s3 might be different for you).

diskutil info disk2s3

Resize the Physical Volume for the drive you want to add the Recovery partition to. To determine the size, look @ the existing Recovery partition on the USB. In my case it was just under 1GB. For the following command, pvUUID is the UUID of the drive you're adding the Recovery to, size is 1GB less than the current size.

diskutil coreStorage resizeDisk <pvUUID> <size> JHFS+ Recovery 784220160B

NOTE: you may need to unmount the volumes repeatedly in the following steps. OSX tends to aggressively re-mount the volumes.

Repartition the new "Recovery" partition from a jHFS+ to Apple_Boot. First, take note of the exact start/size of the partition.

gpt show disk0

     start       size  index  contents
        0          1         PMBR
        1          1         Pri GPT header
        2         32         Pri GPT table
       34          6
       40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
   409640  246725744      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
247135384     262144
**247397528    1269528       3  GPT part - 48465300-0000-11AA-AA11-00306543ECAC**
248667056    1402591
250069647         32         Sec GPT table
250069679          1         Sec GPT header 

Now remove the partition, and re-add it with a different UUID (the UUID is what determines the type of partition)

gpt remove -b 247397528 -s 1269528 -t 48465300-0000-11AA-AA11-00306543ECAC disk0
gpt add -b 247397528 -s 1269528 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0

Now copy the entire Recovery partition from the good one to this new one:

dd if=/dev/disk2s3 of=/dev/disk0s3

Many thanks to the following sites for reference. Read up on them before diving in, if you don't understand any of these steps.

http://blog.fosketts.net/2011/08/05/undocumented-corestorage-commands/

http://www.dmitry-dulepov.com/2011/09/how-to-create-mac-os-x-lion-recovery.html

share|improve this answer
    
update: this setup has been running flawlessly for me since 11/12. –  Jess Bowers Aug 1 '13 at 17:07

Here's a video outlining the process, plus some benchmarks : http://www.youtube.com/watch?v=I_odnNpv-FQ

Commands you'll need in order:

diskutil list

diskutil cs create Fusion diskx diskx

NOTE: You can replace Fusion with whatever you'd like to name your Logical Volume Group

diskutil cs list

diskutil coreStorage createVolume YOUR_DEVICE_ID_HERE jhfs+ "Macintosh Fusion" 100%

NOTE: You can replace "Macintosh Fusion" with whatver you want to name your drive. Remember to use ""'s if you want a space in your name like we did, otherwise you do not need them.

After installation is finished, open terminal and turn of indexing:

sudo mdutil -i off

If you would like to revert back to 2 separate drives, boot into the installer again, open Terminal and type:

diskutil cs delete YOUR_DEVICE_ID

You will then be able to format them however you'd like using Terminal or Disk Utility

share|improve this answer
    
It's not clear what you are doing here to make the recovery HD. Could you edit out the unrelated items to keep this thread lean and mean? –  bmike Nov 5 '12 at 18:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.