Deleting and merging a partition with diskutil from the command line OSX

Deleting and merging a partition with diskutil from the command line
This is the most precise method I know of to remove the partition since it targets the recovery disk directly and merges it with the full Lion partition – if you’re not comfortable with the command line this is not for you.
Launch the Terminal and type the following into the command line:

 diskutil list

dynamic2-192-159:~ username$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *120.0 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Lion                    119.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

Look for “Recovery HD” and see which identifier it is using, it this screenshot it’s disk0s4
To remove that partition we use the following command (you can also use the volume name):

 diskutil eraseVolume HFS+ Blank /dev/disk0s4

The partition will be erased, you might want to do this with your standard Lion partition as well since you’ll be wiping the entire thing anyway. Regardless, you’ll now have a blank partition sitting around, so you’ll want to merge that with your other Lion partition:

 diskutil mergePartitions HFS+ Lion disk0s3 disk0s4

This will merge the two partitions, with disk0s3 absorbing the space from disk0s4 and expanding, it causes data loss so don’t expect this to preserve anything