Restoring a lost Recovery Partition (Volume) in Lion
March 14, 2012 by Christopher Silvertooth
***** IMPORTANT ***** I have updated the script for Mountain Lion. Please follow this link.
Also I have a brand new version that at this time only works with 10.8. It is done in Applescript and can add a recovery partition to any drive.
I was on site working with a customer when we realized that we could not enable Filevault 2. A quick look at the output of “diskutil list” from the terminal told us the recovery partition had gone missing (required if you want Filevault disk encryption). Well, we had already spent a good deal of time deploying and configuring the Mac Image as well as the Boot Camp image so we didn’t want to “re-install lion” just to regain the Recovery Partition – which in turn allows us to encrypt the drive.
Sooo… We scoured the internet looking for the best way to recover this. I found a post from a Google employee, Clay Caviness, who figured out how to put the recovery partition back. I tested his commands and they worked as described.
I decided to go a step further and script those commands so I could save myself some typing and any human errors.
The script will, if you are connected to the internet, download the Recovery Image from Apple and then create the Recovery partition on the primary drive. If you already have the Recovery image file and it is named “RecoveryHDUpdate.dmg” then put that in the directory you run my script from. It will save you the step of downloading the 450MB file from Apple.
Here is the download for the script. The file has a filetype of .command which allows you to run it from the Finder more easily.
NOTE: Make sure you run Disk Utility and verify that your hard disk does not have any errors. If there is something wrong the process will not work correctly.
If you have a botched Recovery Volume then you need to remove it before running my script. To do this follow these directions.
1. Find the botched Recovery Volume by running “diskutil list” in the terminal app. You need the identifier e.g. disk0s3
2. Now erase the data on the bad Recovery HD
diskutil eraseVolume HFS+ ErasedRecoveryHD disk0s3
3. Now merge the erased disk with the “Macintosh HD”
diskutil mergePartitions HFS+ "Macintosh HD" disk0s2 disk0s3
4. Now you can run my script and it will create a brand new “Recovery HD”