I had my system dual-booted with Ubuntu 14.04. However, I found myself not using it enough to warrant the storage space. I deleted the ubuntu partition and the ubuntu swap partition.
However, am now facing two problems that I have struggled to solve.
-
I have been unable to reclaim the disk space from the deleted partitions. I've tried booting into recovery mode Command+R and repairing the disk. The disk repairs successfully, but still remains the same size, and will not let me increase the partition size.
-
The system is still trying to use the grub bootloader. In order to boot to OS X I have to hold down the Option key on startup. This issue is more of an annoyance, but I would love to figure out how to solve it.
Is any of this possible without a fresh install of the OS?
Edit: Screenshot of partition table below. Also, using OSX 10.10.3 Yosemite.
Edit: Could this have anything to do with the Recovery HD below by osx's hard drive on the partition list? Is it safe to remove the recovery hd given that CMD + R reboots are now an online process?
Edit: Output of requested commands below:
diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *320.1 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS Macintosh HD 245.4 GB disk0s2
3: Apple_HFS Recovery HD 650.0 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Apple_partition_scheme *137.4 MB disk1
1: Apple_partition_map 32.3 KB disk1s1
2: Apple_HFS VirtualBox 137.4 MB disk1s2
sudo gpt -r show /dev/disk0
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 479330712 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
479740352 262144
480002496 1269536 3 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
481272032 143870383
625142415 32 Sec GPT table
625142447 1 Sec GPT header
sudo fdisk /dev/disk0
Disk: /dev/disk0 geometry: 38913/255/63 [625142448 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 1023 254 63 - 1023 254 63 [ 1 - 625142447] <Unknown ID>
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Best Answer
The disk giving you problems uses the GUID partition table (GPT) to define the its layout. You provided me with the relevant contents of this table when you posted the output from the command
sudo gpt -r show /dev/disk0
. These values appear to be correct, except for the entry with an index of 3. This entry is shown below.The start and size values of
480002496
and1269536
, respectively, are OK, but the contents should beGPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
.To correct the problem you need to boot to OS X Internet Recovery and enter the following commands in a Terminal window.
Once completed, you can boot back to OS X and open the Disk Utility application. The "Recovery HD" partition should no longer appear. You will need to move the slider on the "Macintosh HD" partition as far down as it will go. Click the "Apply" button to recover the free space.
Note: The "Recovery HD" partition has not been deleted. Normally, it is hidden by the Disk Utility application. The partition will still appear when using the
diskutil list
command. When you move the slider down be aware the Disk Utility application will have to relocate the "Recovery HD" partition to the end of the disk. This can take a while, so be patient after clicking the "Apply" button.Example Using a Flash Drive
I tested the procedure using a flash drive. Before fixing, the flash drive appeared as such:
Using similar Terminal commands resulted in:
This allowed me to move the slider as such:
Clicking the "Apply" button produced:
In your case, the small free space shown above will not appear. (This is not free space, it is the space taken by the hidden partitions.)