Can I remove Recovery HD partition? We replaced the hard drive with a Patriot SSD in our iMac at work. I messed up while cloning the drive to the new SSD using a GPartEd CD. Everything works but there is about 40 GB unpartitioned that I want to recover. I cannot extend the main Macintosh HD partition using Disk Utility because the Recovery HD partition is "in the way", it is right after the Macintosh HD partition and all the free space is after the Recovery HD partition.

So, in short, is it safe to delete the Recovery HD partition? If not is there an easy way for me to remove it, resize my main partition, and then create a new Recovery HD partition?

Also, just out of curiosity, what does the Recovery HD partition do? Disk Utility seems to imply it has something to do with the bootloader but that doesn't make sense to me.

Edit: Partial duplicate of Can I repartition my primary hard drive without removing the Lion recovery partition?
Start by reading this document from Apple, which explains the recovery partition in Lion. From the article:


  OS X Lion includes a new feature called Lion Recovery that includes
  all of the tools you need to reinstall Lion, repair your disk, and
  even restore from a Time Machine backup without the need for optical
  discs.


In short, if you remove this partition you'll need a Lion USB drive, or physical media to perform the actions described by Apple above.

To reclaim the space of the recovery partition follow the steps below:


Open Terminal.app
Run the commands below (omit the # and everything after)




$ diskutil list                                   # list disk partitions
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Nymeria                 499.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3 &lt;---
$ diskutil eraseVolume HFS+ Blank /dev/disk0s3    # Erase Recovery HD
$ diskutil mergePartitions HFS+ "Nymeria" disk0s2 disk0s3  # Merge partitions / reclaim space


One thing to note here, you can only merge consecutive partitions. If you have disk0s2 and disk0s4 running diskutil mergePartitions HFS+ "Nymeria" disk0s2 disk0s4 will merge partitions disk02s2, disk02s3, disk02s4. Also, only the data on the first partition will be preserved when merging. As an example, if your Recovery HD is disk0s3 and your OS partition is disk0s4, merging using diskutil is not possible. Use extreme caution modifying your partition table, and I'd highly recommend taking a full backup before hand.