Master Boot Record and Recovery Partition fixes with Yosemite

Today, I’ve had to spend most of my day with getting my MacBook Pro (13″ Retina) back to operation. For still unknown reasons my machine couldn’t boot back into MacOS X after a normal reboot. Funny thing is that I did not do anything special, like installing or messing with the hard disk structure, at all.
In any case, as everyone would do, I restarted and tried to get into the Recovery Disk. However, instead of the normal boot screen I saw the “Internet Recovery” icon. This is where I slowly started to freak out, because it means that the Mac can’t see a local Recovery partition.
Fear not, I thought to myself and hooked up my Time Machine USB drive (I travel so it is good to have one of those things around) and started from it. Sure enough I was able to get into the Recovery Tools, well that is Disk Utility. A “repair disk” showed that my boot record can’t be found and I should “repair the disk”. Strange thing is that I actually just performed a repair disk.
From previous experiences, I knew that my data is still all there, but that the Master Boot Record and the Recovery partition somehow got hosed. Since my business had a Business Support program with Apple, I requested to be called and surely find a solution. After all, restructuring the Master Boot Record isn’t rocket science.
As it turned out, the “Apple Genius” on the other end told me that I needed to wipe my disk completely, re-install everything and that I hopefully have a Time Machine backup ready. This, according to them, is the only way to get the Mac back “in shape”. Asking if there was a script or workaround was meet with deaf ears. So much for paying Business support.
Everyone knows that re-installing everything, even re-installing from Time Machine, will take a long time. With that in mind, I was about to set out to write a script for getting my MBR back. However, and before I even had to start writing my own app, I found an Apple script called “Recovery Partition Creator”. As the name implies, this nifty little tool, will create the Recovery Partition, but, and this is the key, it also re-writes the Master Boot Record table during its process.
Sure enough, after running the script (be warned it will stall and the script itself will become unresponsive, simply don’t quite and wait!) I had everything back to normal. Here is my partition table before and after:
[code]
diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage 999.7 GB disk0s2
3: Apple_Boot Boot OS X 650.0 MB disk0s3
diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage 999.7 GB disk0s2
3: Apple_Boot Recovery HD 650.1 MB disk0s5
[/code]
Thanks to Christopher Silvertooth for making this script and saving me 🙂
I still have no idea why this happened in the first place. What annoys me more, is that Apple wasn’t able to help or shall I say tried to help with a complete destruction of all data and making me waste hours.
If you’ve had this experience and/or have another solution please let me know in the comments.