MacOS – Apple recovery partition possibly creating problems in Ubuntu

bootmacospartitionrecovery-hdunix

Before reading, it may help to know I have a 13" Macbook Pro (model 7,1. Mid-2010).

Recently, the HFS+ filesystem on my OSX became corrupt and after many trials and errors, it was clear I was going to need to backup, format, and reinstall OSX. After I got OSX reinstalled (10.6.8), I updated to 10.9.1 and everything seemed to be working properly. However, I booted into Ubuntu and found that the boot loader couldn't find my filesystem and I was getting a grub rescue screen. I followed the first half of this answer (up until normal), and my grub menu appeared, untouched.

Now, when I continue following the instructions, it says to reinstall grub. So beforehand, I did a little look into the partition setup to make sure that I was installing it in the right place (I want to install it on my boot loader, not in the root partition. That way I can use rEFInd or hold the alt/option key to select if I want to boot into Ubuntu or OSX, then upon choosing Ubuntu I'll see the grub menu. Obviously this case isn't ideal because I get to choose twice which operating system, but I don't want to mess up anything with the EFI startup… we all know how crabby it can get).

Upon looking into the partitions on Ubuntu, I found that GParted is seeing a Recovery HD partition and fdisk -l isn't. So, to GParted /dev/sda3 is the recovery partition, but to fdisk -l, I'm seeing /dev/sda3 as the boot partition… I figured that the offset between the two is creating weird behavior on startup. Even if that's not the case, I want to get this figured out before reinstalling grub so I know where I'm installing it.

Does anyone know why there are inconsistencies between the two records? Is OSX not hiding the recovery partition properly, or should it not be there at all? Generally, I want to know how I can get these records consistent, and if that requires removing the recovery partition (which I've never seen before!), that's fine with me.

For the record, the recovery partition isn't showing up in Disk Utility, but it does show up when I run diskutil list in OSX's terminal. Also, to set up my partitions, I followed my own answer here. As you can see by the screen shots, GParted was not detecting the recovery partition before formatting and reinstalling OSX.

Edit: Ubuntu users — I've linked to this question as part of an answer here if you're having an issue with grub rescue after reinstalling or making chances to OSX.

Best Answer

OS X creates the recovery partition as an alternate boot solution for ease of reinstallation and troubleshooting.

It is not needed for normal operation, and as someone that's familiar with boot technology and options, the simplest option would be to simply delete the partition entirely and patch the partition table if needed.

Here is a stock layout:

Mac:~ me$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            250.1 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

You could merge partitions disk0s3 into the partition that precedes it (in this case) to effectively erase and then delete the Apple_Boot partition listed as Recovery HD. In this case, you would need to be booted to some other drive than disk0 to have both disk0s2 and disk0s3 unmountable (which would make them disk1 or higher in all likelihood).

 diskutil mergePartitions JHFS+ "Macintosh HD" disk0s2 disk0s3

Should that not work, you might have to image Macintosh HD to another drive as an img file (or straight partition to partition) and then repartition hdisk0 to have just one partition and restore.


As to the deeper question, my guess is that the "hiding" of the partition isn't compatible with other non Apple tools and is confusing the issue - hence the advice to just remove it and count on alternate options to restore your system or boot externally in stead of the recovery HD.