How can I resize my Lion partition to fill up the unused space on the drive? My MacBook (Late 2007) has an 80GB hard drive. I used to have a 15GB Boot Camp partition, and deleted it at some point -- but I forgot to resize my Snow Leopard partition to fill the 15GB of free space at the end of the drive.

Since then I installed Lion. When I start from the recovery partition and try to resize it, Disk Utility fails with the error: Couldn't unmount disk.

I'm guessing this is happening because the 500mb recovery partition (which I booted from) is in the way. Here's what I get when I run diskutil list:

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *80.0 GB    disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            65.3 GB    disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3


How can I move the Recovery HD partition to the end of the drive so I can resize my main system partition and get that 15GB of space back?
My suggestion

Don't try to resize from the Recovery partition. Boot into the normal partition and resize from there.

Background

diskutil list is misleading you. It is not the position of the recovery partition which is your problem. 

I had a very similar setup, and here is the output of diskutil list for me:

  #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            423.6 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:                  Apple_HFS Temp Partition Test ... 74.8 GB    disk0s4
   5:                 Apple_Boot Recovery HD             792.2 MB   disk0s5


Partitions 4 and 5 had a dev version of Lion on them. I have just used Disk utility to delete partitions 4 and 5 and resize partition 2 to fill the space.

This worked - Disk Utility resized the main drive with no problem. So what have I done which is different to you? Well, I resized the main partition from booting into the main partition not the Recovery Partiion. You can resize a partition that you have booted from in Disk Utility.

It makes sense that the recovery partition would "get in the way" if you have booted from it, so I suspect that above suggestion might work for you.