Monthly Archives: April 2012

Removing and rebuilding a malfunctioning Recovery HD partition

When updating to 10.7.2, there’s a Lion Recovery Update that goes along with it. This is meant to update your Recover HD recovery partition to 10.7.2 along with your Mac. However, when I tried updating, I could see from the logs that for whatever reason, my Recovery HD was staying at 10.7.1 and was not being successfully updated. As the new Find My Mac functionality in iCloud relies on Recovery HD being updated to 10.7.2, I wanted to be able to fix this problem without having to reinstall or reimage my Mac. Fortunately, thanks to the work of Clay Caviness at Google, there’s a way to rebuild your recovery partition (at least for 10.7.2) on a Mac that doesn’t have one. I did have one, but I knew how to fix that. See below the jump for the procedure.


Note: All commands shown are single lines.

Step One: Make a full backup of your boot drive.

This is absolutely the most important step of this process. Any time you’re moving partitions around, stuff can go wrong. Making a backup beforehand can turn a later “Something went wrong” moment from a crisis into a less-bad inconvenience.

Step Two: Remove the existing Recovery HD recovery partition

1. Get the disk identifier of your recovery partition by running the following command:

diskutil list

2. Once you’ve identified the entry, then remove it by running the following command. (In this case, I’ll be using disk0s4 for the recovery partition and disk0s3 for the main boot partition.):

diskutil eraseVolume HFS+ ErasedDisk /dev/disk0s4

3. Next, merge the recovery and boot partitions together to create one partition (the MacHD identifier is to give the partition a new name; your existing boot drive name shouldn’t be changed by this process):

diskutil mergePartitions HFS+ MacHD disk0s3 disk0s4

Step Three: Rebuilding the recovery partition:

1. Download the Lion Recovery Update from

2. Run the following commands to attach the correct disk image and rebuild the recovery partition:

hdiutil attach RecoveryHDUpdate.dmg

pkgutil –expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg /tmp/RecoveryHDUpdate

hdiutil attach /tmp/RecoveryHDUpdate/RecoveryHDUpdate.pkg/RecoveryHDMeta.dmg

/tmp/RecoveryHDUpdate/RecoveryHDUpdate.pkg/Scripts/Tools/dmtest ensureRecoveryPartition / /Volumes/Recovery\ HD\ Update/BaseSystem.dmg 0 0 /Volumes/Recovery\ HD\ Update/BaseSystem.chunklist

At this point, you will see a large amount of code fly by as the recovery partition is rebuilt. It should end with Creating recovery partition: finished

The next set of commands is clean-up and making the system recognize the updated recovery partition.

hdiutil eject /Volumes/Recovery\ HD\ Update
hdiutil eject /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update
sudo touch /Library/Preferences/SystemConfiguration/
sudo kextcache -f -u /

Once finished, restart your Mac and verify that you can boot to Recovery HD. To verify that your Recovery HD is now on 10.7.2, open the Terminal (available from the Utilities menu when booted from the Recovery HD partition,) and run the following command:


The following information should be displayed:

ProductName: Mac OS X
ProductVersion: 10.7.2
BuildVersion: 11C74