Anders Bergh

Computers and programming stuff

Restoring the Recovery HD in Mac OS X Lion perfectly



I have an iMac. It originally came with Snow Leopard installed. I upgraded to Lion but later realized I wanted a clean install, so I installed Lion to an external drive and then restore it onto the iMac HDD. I used Carbon Copy Cloner (CCC) to do that, but it turned out that CCC won’t copy the hidden Recovery HD partition…

The procedure:

  1. Install Lion in VMware Fusion 4. This is quite easy, you just choose the Lion installer app instead of a disk image when setting up a new VM.

  2. Copy the disk0s3 (recovery partition) to a file in the VM, then copy it to the host. This is accomplished using dd.

  3. Restore the recovery clone to the host disk0s3 (note: the GPT layout must match). The following GPT is for my 1 TB drive.

  4. Set the “Media Name” of the recovery partition to “Recovery HD” to make it fully compatible with OS X. This can either be done using the gpt tool or parted from a Linux live CD. I used the latter.

To change it using gpt (note, you have to do it from an OS X installer/recovery environment that runs off a different drive than the drive you’re modifying):

Using gpt: gpt label -i 3 -l "Recovery HD" disk0.

Using parted: name 2 'Recovery HD' (not sure if it’s 2 or 3, verify using print before running it)

If you’re interested in doing this yourself, I recommend you read these two blog posts that helped me along the way:

His instructions don’t take the media name into account, which makes certain tools like the Apple Recovery Disk Assistant fail. That’s what I solved today, hope it helps someone out there! :)