This is only one method to restore the missing recovery partition. Check out Recreating a deleted recovery partition on a Mac for another method.
The Missing Recovery Partition Problem
I don't actually know how a recovery partition gets deleted, but I've come across a few Macs with the partition deleted, and I've been looking for a way to restore them, because if you don't have the recovery partition and you want to boot into recovery mode (holding down Cmd-R at startup), you'll have to boot into Internet Recovery Mode (which will involve you connecting to a wireless network and downloading a temporary recovery).
Apparently, for Mac OS X Lion and Mountain Lion, Apple had this program called Recovery Disk Assistant that let you install a recovery partition (on an external drive, but presumably you could do it on an internal one, too). I also found an article from April, 2015 talking about Recovery Disk Assistant and OS X Lion. The one comment on the article says This may be a dumb question, but I have a slow internet. Can I do this with Yosemite? No reply there. It would be great to have solution that works for Yosemite.
I found an article called Pro tip: Restore the recovery partition in OS X 10.10 Yosemite that advises either reinstalling OS X (not ideal) or restoring using Carbon Copy Cloner. I tried to follow the instructions to restore using Carbon Copy Cloner, but I couldn't find a Recovery HD button to click.
The gist of it is you clone an existing recovery partition and then change it to an Apple Boot partition. Details to follow.
What you'll need:
- One Mac missing a recovery partition (of course—that's why you're here, right?). I'll refer to this Mac as Mac #1.
- At least one other Mac that already has a working recovery partition on it. I'll refer to this Mac as Mac #2.
- A Thunderbolt cable to connect the two Macs.
Boot into Mac #2, log in as an admin user, and then paste into Terminal.app the following command so you'll be able to see the debug menu in Disk Utility:
When you launch up Disk Utility afterwards, you should see a new menu called Debug. From that menu, select Show every partition. You should now be able to see hidden partitions (including one called Recovery HD).
Boot Mac #1 into target disk mode and then attach it to Mac #2 using a Thunderbolt cable. You should see Mac #1's partitions show up in Mac #2's Disk Utility.
Click on Mac #1's hard drive (not the partitions underneath), select the Partition tab, and click the plus sign (+) to add a new partition. You won't be able to drag the partition size to be very small (I think the smallest you can make the new partition by mouse-dragging is about 6 GB), but if you type in a value (e.g., .65—or anything less than 1), it'll automatically bump the value up to 1.07 GB. That should be fine, since the normal recovery partition is 650 MB, which isn't that far off from 1.07 GB. If you want to make the partition even smaller, you can explore disk management from the command line.
You'll be asked if you really want to repartition. You backed up your data on Mac #1 already, right? Or the data isn't that important to you? Either way, repartitioning is usually fine, but there is a small risk you could lose data. Act accordingly.
And the new Recovery HD's Format is Mac OS Extended (Journaled). If you leave it that way, holding down Cmd-R at startup will still go to Internet Recovery Mode instead of regular Recovery Mode (and manually selecting the new partition by holding down the Option key at startup will just lead you to a do-not-enter symbol).
Identify the partition to fix. It should be TYPE Apple_HFS and NAME Recovery HD. In this case, it's /dev/disk2s3, but be sure to look at how it's displayed in your setup (the numbers may be different from this example).
Unmount the partition (substitute your numbers for #, where appropriate):