Have a Lion Mac without a recovery partition?

Here's a method to create one, programatically. It won't be too hard to package this up, or script it.

Some background:
We've been looking for a way to create a recovery partition on systems that don't have one, e.g. using a custom image.

Initially, I spent time tearing apart OSInstall.mpkg from the 10.7.0 base install. I noticed the Distribution file for it had, along with the usual pkg-ref entries, a system-image entry. The source for this was BaseSystem.dmg, and I suspect 10.7's installer can do something with this.

Before I had success with that, though, I downloaded and expanded the RecoveryHDUpdate package.

Inside of that, there was ./RecoveryHDUpdate.pkg/Scripts/replaceRecovery, which called out ./RecoveryHDUpdate.pkg/Scripts/Tools/dmtest and references BaseSystem.dmg from inside the RecoveryHDMeta.dmg.

This is all you need to add a recovery partition. I've only tested this on a few machines at this point.

How to do it:
All commands are single lines.
Download RecoveryHDUpdate.dmg from http://support.apple.com/kb/DL1464

$ 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

[... magic happens ...]

$ hdiutil eject /Volumes/Recovery\ HD\ Update
$ hdiutil eject /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD Update

Less important:
$ sudo touch /Library/Preferences/SystemConfiguration/com.apple.Boot.plist
$ sudo kextcache -f -u /

No warranty expressed or implied.
Shared publiclyView activity