Reclaim hard drive space from deleted partition and reclaim Apple bootloader
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.
480002496 1269536 3 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
The start and size values of 480002496
and 1269536
, respectively, are OK, but the contents should be GPT 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.
gpt -r show /dev/disk0
diskutil unmountDisk /dev/disk0
gpt remove -i 3 /dev/disk0
diskutil unmountDisk /dev/disk0
gpt add -i 3 -b 480002496 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC /dev/disk0
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.)