Oct 17, '11 02:18:00AM • Contributed by: Ben Levy
The new MacBook Air and Mac mini use a build of 10.7 different from the regular installer from the App Store. If the hard drive is replaced or wiped it's necessary to download the installer from Apple's servers using Lion Recovery from either the Restore Partition or using Lion Internet Recovery.
Firewire or Thunderbolt Target Disk Mode (T key at boot) makes creating a copy of the contents of the drive using another machine an easy matter, but what about the Recovery Partition? For that, first enable the DeBug Menu in Disk Utility on your second machine. Once that has been enabled choose the 'Show every partition' option and the Recovery Partition is visible and the contents can be copied.
At this point it's possible to restore the image that originally came with the MB Air, but if it's a new or wiped drive the restore would lack the Recovery Partition. Adding the recovery partition needs to be done at the command line because Disk Utility at the GUI won't permit creating a partition as small as the Recovery Partition, nor will it hide the partition properly.
The process is fairly clear; reduce the size of the main partition, create the Recovery Partition, then because diskutil is a little confused, correct the size, copy the contents of the Recovery Partition and then designate the type of partition.
Detailed instructions (Use 10.7.x for all of this):
- Using Thunderbolt Target Disk Mode from MacBook Air to other machine, image Apple install from the MacBook Air drive to the destination.
- Enable the Disk Utility DeBug menu using this command:
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true - With the DeBug Menu now visible, enable the 'Show every partition' option, then use the Mount menu command to show the Recovery Partition on Desktop, and image it as well.
- Next, establish a 650MB partition on HD. It should be this size: 681574400. Use diskutil info to find the Total Size of main partition = X, then subtract 650MB from that size to get the new size of main partition; i.e., X - 681574400 = NewSize.
- This command will resize main partition and create the new Recovery Partition:
diskutil resizeVolume /dev/disk0s2 NewSizeB jhfs+ "Recovery HD" 650002432B
(Note that's a 'B' at the end of the number.) - Results likely will show that Disk Utility didn't quite make it 650MB so that can be fixed:
diskutil resizeVolume disk0s3 650002432B - Restore the data previously copied out of the original Recovery partition.
- This command will make the Recovery partition invisible and set it's type correctly:
asr adjust --target /dev/disk0s3 -settype "Apple_Boot"
[crarko adds: I haven't tested this one.]
