Hands on with Lion Recovery
[Editor's note: This article is part of our series of articles on installing and upgrading to Lion (OS X 10.7). We also have a complete guide to installing and upgrading to Mountain Lion (OS X 10.8).]
One of the most significant new features of Lion is one I hope you’ll never need to use: recovery mode, officially called "Lion Recovery." It turns out that when you install Lion, the installer creates an invisible, bootable, 650MB partition—a portion of a drive the operating system treats as a separate volume—on your startup drive called Recovery HD that includes a few essential utilities for fixing problems, restoring files, browsing the Web, and even reinstalling Lion.
(At least Recovery HD should be created. In our testing, it appears this special partition is created only when you install Lion onto an internal drive formatted with a GUID partition scheme. In addition, that internal drive must initially have only a single partition; or be a multi-partition drive that was partitioned by Boot Camp Assistant and not further modified afterwards. So not everyone will get this useful feature. Apple has confirmed some of these restrictions.)
The idea behind recovery mode is that if you ever have problems with your Mac’s startup volume, you can boot from Recovery HD and perform some basic troubleshooting procedures without the need for an OS X installation DVD (or, in the case of early MacBook Air models, the installation thumb drive) or a separate bootable hard drive. Unfortunately, because the Recovery HD volume is read-only, you can’t, say, copy your favorite third-party disk utility onto it to make that utility available in recovery mode. However, because Recovery HD is a separate partition—and one that’s invisible even to Disk Utility—even if you were to erase your Mac’s hard drive, recovery mode would still be available at startup.
Of course, because the Recovery HD partition is actually part of your Mac’s internal hard drive or SSD, if that drive is having hardware problems, or partition-map problems, the recovery partition itself may be inaccessible. In other words, recovery mode won’t save you from every problem, and it’s no substitute for having a reliable, regularly updated backup.
(Mac models released in mid-2011 or later, along with some older Macs that have received special firmware updates, include a new feature called Lion Internet Recovery that lets you reinstall Lion over the Internet even if you don't have a Recovery HD partition, or if that partition isn't working properly. We'll be covering this new feature in an separate article.)
Accessing recovery mode
You can access recovery mode only when your Mac starts up, although there are two ways to do so:
The easier way On newer Macs, you can access recovery mode by simply restarting or starting up the Mac and immediately holding down Command+R. Keep holding these keys until you see the Apple logo on the screen. After a few seconds, you’ll see a window with Mac OS X Utilities in large text across the top. If this procedure doesn’t work for you, try the second method.
The alternate way On any Mac, you can access recovery mode using OS X’s Startup Manager:
Restart or start up your Mac and immediately hold down the Option key; keep holding Option until the Startup Manager—a gray screen showing all connected, bootable volumes—appears. One of the volumes will be called Recovery HD.
If you’ll want to connect to your local network (for example, to access backups on a Time Capsule) or the Internet in recovery mode (see “Using recovery mode,” below), you can use the pop-up menu at the bottom of the screen to choose a local Wi-Fi network; provide the network’s password when prompted. (If you prefer, you can wait until you’re booted into recovery mode to choose a network.)
Select Recovery HD and then click the upward-pointing arrow below it to boot from Recovery HD. After a brief delay, you’ll see the new Mac OS X Utilities screen.
(Note that this Mac OS X Utilities screen is the same one you’ll see if you create a bootable Lion install drive or disc and boot your Mac from it.)
Regardless of which method you used to access recovery mode, the menu bar displays OS X’s Input, Wi-Fi, and (on laptops) battery menus. If you want to connect to your network or the Internet, and you haven’t already chosen a Wi-Fi network, you can do so using the Wi-Fi menu. Alternatively, if you’ve got a wired connection, be sure the Ethernet cable or USB-to-Ethernet adapter is connected to your Mac.
Using recovery mode
When booted into recovery mode, the tasks you can perform are limited. The four main options are listed in the Mac OS X Utilities window; select one and click Continue to use it.
Restore From Time Machine Backup: You have a backup of your system that you want to restore. If the problems your Mac is having are serious enough that you need to erase your startup drive (perhaps using Disk Utility in recovery mode, below), or if you’ve installed a new hard drive in your Mac, this option lets you restore, from a Time Machine backup, your entire system, including the OS and all accounts, user data, and settings.
Note that to use this feature, your Time Machine backup must be a complete backup that includes all system files. So if you previously added the System folder, or any other OS-related files and folders, to Time Machine’s exclusion list (in the Time Machine pane of System Preferences), you won’t be able to restore your system from that backup. Instead, you’ll need to reinstall Lion (see the next item) and then use Lion’s Setup Assistant to transfer your data from your Time Machine backup.
Before proceeding, read the important information on the Restore Your System screen that appears when you choose this option. Specifically, note that the Restore From Time Machine Backup feature erases the destination drive—it’s only for restoring an entire volume from a Time Machine backup to its original source (or to a replacement drive). To transfer files from a backup to a new Mac, you should use Migration Assistant or Setup Assistant; to resture individual files and folders, use Time Machine while booted into OS X.
If you’re sure you want to use the Restore From Time Machine Backup feature, click Continue. On the next screen, you select your Time Machine drive, then the particular backup snapshot you want to restore from, then the destination drive. You’ll see a final warning that this procedure will erase the destination drive; click Continue, and the drive is erased and the utility begins restoring your files from your Time Machine backup.
Once this process is finished—on a MacBook Air, it took about an hour and a half for approximately 63 GB of data—your Mac will restart from the newly restored drive and you’ll be able to log in normally.
Reinstall Mac OS X: Set up and install a new copy of Lion. Select this option and click Return, and the Lion installer launches, letting you install Lion on any supported drive or volume, including the current Mac’s internal drive. However, this version of the installer doesn’t actually include all of the necessary files and data, so installing Lion from within recovery mode requires an Internet connection to download the actual OS.
When you click Continue on the initial installer screen, you’ll get a dialog stating, “To download and restore Mac OS X, your computer’s eligibility will be verified with Apple.” Clicking Continue sends the necessary information to Apple and then the installer proceeds just as if you were running the Lion installer normally, with one key exception: Once you select the drive onto which you want to install Lion, you're prompted to enter your Mac App Store Apple ID and password; then the actual data used by the installer—nearly 4GB of it—is downloaded over the Internet. (When I tested the feature, the estimated download time was nearly five and a half hours, although the actual download time was closer to 40 minutes over my cable-modem connection.)
While it’s nice to have the option to install Lion from within recovery mode, because of this download-the-whole-OS drawback, I recommend doing so only if you don’t have a bootable Lion-installer drive.
Get Help Online: Browse the Apple Support website to find help for your Mac. Choosing this item and clicking Continue launches Safari (with default settings and bookmarks) to let you browse Apple’s Support site, or any other website, to find answers to troubleshooting problems. You can also check and send email if your email account provides Web access. When Safari first launches in recovery mode, you’ll see a page called Recovery Information that provides (brief) instructions on how to perform various tasks in recovery mode. Unfortunately, you won’t be able to print these instructions from within recovery mode, although you can access them when booted from your standard startup drive—see “Recovery HD under the hood,” below.
To get back to the main Mac OS X Utilities window, just quit Safari. (You can actually see the Mac OS X Utilities window by moving Safari’s window out of the way, but you won’t be able to access any of the other functions until you quit Safari.)
Disk Utility: Repair or erase a disk using Disk Utility. Selecting this option and clicking Continue launches Disk Utility, which you can use to check, repair, erase, or partition connected drives. You’ll even be able to repair your Mac’s normal startup volume, although you won’t be able to repartition your Mac’s internal drive, since you’re actually booted from it. If you decide to erase your Mac’s startup drive and reinstall Lion (after making sure you’ve backed up, of course), you’d start here, erase the drive, quit Disk Utility, and then use the Reinstall Mac OS X option (above) to install a new copy of Lion. You can get back to the Mac OS X Utilities window at any time by quitting Disk Utility.
In addition to the four options in the Mac OS X Utilities window, recovery mode also offers a few options in its Utilities menu (displayed when viewing the main Mac OS X Utilities screen): Firmware Password Utility, Network Utility, and Terminal. These are the same utilities you can use when your Mac is booted normally into OS X; they let you configure a firmware password, monitor network connections and traffic, and use OS X’s Unix shell, respectively.
Recovery HD under the hood
If you try to find the Recovery HD partition in the Finder, or even using Disk Utility, you’ll come up empty. Apple’s hidden this partition well, presumably to keep it safe from accidental (or intentional) modifications—after all, what good is an emergency disk if someone has accidentally deleted some of its vital contents?
However, if your curiosity won’t be sated until you’ve been able to browse Recovery HD, here’s how. Just remember: Look, but don’t touch.
1) Open Terminal, type
diskutil list, and press Return.
2) You’ll get output similar to this:
DanBookAir:~ frakes$ diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *121.3 GB disk0 1: EFI 209.7 MB disk0s1 2: Apple_HFS DanBookAir 120.5 GB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3
3) Locate the Recovery HD partition (under Name) and note its identifier—in my case,
diskutil mount [identifier], where [identifier] is, of course, that identifier. This mounts the Recovery HD partition in the Finder. Inside should be a single folder, named com.apple.recovery.boot.
5) Open the com.apple.recovery.boot folder in the Finder, and you'll see several items. However, you aren't seeing everything—some of the folder's contents are invisible. If you want to see everything that's there, switch back to Terminal and type (or copy from here and paste into Terminal)
ls -al /Volumes/Recovery\ HD/com.apple.recovery.boot/ and press Return. This will display the full list of the folder's contents:
DanBookAir:~ frakes$ ls -al /Volumes/Recovery\ HD/com.apple.recovery.boot/ total 930048 drwxr-xr-x 10 root wheel 340 Jul 20 07:54 . drwxrwxr-x 8 root wheel 340 Jul 20 07:54 .. -rw-r--r--@ 1 root wheel 749 Jul 20 07:54 .disk_label -rw-r--r--@ 1 root admin 1876 Jun 29 23:55 BaseSystem.chunklist -rw-r--r--@ 1 root admin 451307798 Jun 29 23:47 BaseSystem.dmg -rw-r--r-- 1 root wheel 2245 Jun 15 18:06 PlatformSupport.plist -r--r--r-- 1 root wheel 475 Jun 29 20:42 SystemVersion.plist -rw-r--r-- 1 root wheel 858800 Jun 29 23:04 boot.efi -rw-r--r-- 1 root wheel 361 Jul 20 07:54 com.apple.Boot.plist -rw-r--r-- 1 root wheel 23992189 Jun 29 22:41 kernelcache
Of particular interest is BaseSystem.dmg, a disk image that contains the recovery partition’s bootable copy of OS X and all the recovery-mode utilities. You can mount this disk image in the Finder by typing
open /Volumes/Recovery\ HD/com.apple.recovery.boot/BaseSystem.dmg and pressing Return. Once you’ve done that, you can view the Recovery Information page you see when you launch Safari from within recovery mode; just type
open /Volumes/Mac\ OS\ X\ Base\ System/System/Installation/CDIS/Mac\ OS\ X\ Utilities.app/Contents/Resources/English.lproj/ (all one line) and press Return. You’ll see the contents of the English.lproj folder; find the file RecoveryInformation.html and double-click it to open it in your default Web browser.
When you're done browsing, you can eject Mac OS X Base System as you would any removable volume. You can then unmount the Recovery HD volume by typing
diskutil unmount [identifier], where [identifier] is the same identifier you used above.
Updated 7/20/2011, 11am to include the actual time it took to download the Lion-installer data in recovery mode, to update the instructions for viewing the contents of Recovery HD, and to include instructions for unmounting Recovery HD.
Updated 2/10/2012 with new information about Lion Internet Recovery compatibility.
Product mentioned in this article