How can I create or recreate a Lion recovery partition? For whatever reason, one of our macs didn't make a recovery partition when it upgraded to Lion.

Is it possible to add a recovery partition after the fact? 



To be clear - on a normal mac, the recovery partition is hidden in both the Startup Disk system preference and the Disk Utility. You can only see it from the command line with a direct command, diskutil list or enabling the debug menu in Disk Utility. It also shows up if you boot with the option key held or if you successfully boot to recovery with Command-R a.k.a. ⌘+R during boot.

Warning - this question and answer ONLY APPLY to 10.7.x Lion - using the Lion installer to recreate recovery on newer OS can and will cause problems due to drivers not being present for newer OS and hardware.
First, open a Terminal.

Status before:

$ diskutil list
/dev/disk0
  #:                       TYPE NAME                    SIZE       IDENTIFIER
  0:      GUID_partition_scheme                        *128.0 GB   disk0
  1:                        EFI                         209.7 MB   disk0s1
  2:                  Apple_HFS Macintosh HD            127.8 GB   disk0s2


Get Lion Recovery Update v1.0 (431.91 MB)

Mount RecoveryHDUpdate.dmg

$ hdiutil attach ~/Downloads/RecoveryHDUpdate.dmg


Extract data from RecoveryHDUpdate.pkg

$ pkgutil --expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg ~/Desktop/RHD


Mount RecoveryHDMeta.dmg (in the RecoveryHDUpdate.pkg package)

$ hdiutil attach ~/Desktop/RHD/RecoveryHDUpdate.pkg/RecoveryHDMeta.dmg


Run tool that will finally resize current partition and create recovery

$ ~/Desktop/RHD/RecoveryHDUpdate.pkg/Scripts/Tools/dmtest ensureRecoveryPartition / /Volumes/Recovery\ HD\ Update/BaseSystem.dmg 0 0 /Volumes/Recovery\ HD\ Update/BaseSystem.chunklist
Creating recovery partition: finished


Status after:

$ diskutil list
/dev/disk0
  #:                       TYPE NAME                    SIZE       IDENTIFIER
  0:      GUID_partition_scheme                        *128.0 GB   disk0
  1:                        EFI                         209.7 MB   disk0s1
  2:                  Apple_HFS Macintosh HD            127.2 GB   disk0s2
  3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3