Moving Recovery HD partition to end of disk
Answer to Posted Question

When you enter the diskutil command to resize your boot partition disk0s2, the recovery partition disk0s3 will automatically be moved. You do not want to move this recovery partition to the end of the disk using a separate command. In other words, you are trying to do the wrong thing.

See Merge partitions with Macintosh HD for the correct procedure.

Response to Comment:  What if I want to leave some free space in the middle, e.g. for another partition later, but have the recovery partition at the end?

The recovery partition should always follow after the boot partition. For example I have Yosemite installed in partition disk0s5 and El Capitan in partition disk0s7. Both partitions are followed by their respective recovery partitions. Below is my current partitioning.

Sector size is 512 bytes.
Drive contains 1,953,525,168 sectors.
Drive contains 1,000,204,886,016 bytes (1.00 TB).

       start        size  index  contents
           0           1         MBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34           6
          40      409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      409640        2008
      411648   394530816      2  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
   394942464   394530816      3  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
   789473280    97654784      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
   887128064      262144
   887390208   478769528      5  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  1366159736     1269536      6  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  1367429272   195995208
  1563424480   388568960      7  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  1951993440     1269544      8  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  1953262984      262144      9  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
  1953525128           7
  1953525135          32         Sec GPT table
  1953525167           1         Sec GPT header


I have 100 GB of free space between partitions disk0s6 and disk0s7. I could, for example, install Linux in this free space. (For the curious, partition disk0s9 is a second EFI partition which contains the rEFInd boot manager.)

To determine the limits for resizing your partition, use the following command.

diskutil  resizevolume  /dev/disk0s2  limits



  When a partition is followed by a recovery partition, the previous command will display the correct minimum size and display the maximum size to be to the current size. The actual maximum size may be larger than this value. You will need to use the gpt command or some equivalent method to determine the free space the follows the recovery partition.


For example, to change your partition size to 110 GB, you would enter the following command.

diskutil  resizevolume  /dev/disk0s2  110G


To change your partition size to the maximum size of approximately 120 GB, enter the command

diskutil  resizevolume  /dev/disk0s2  R


You can enter the command man disktuil, for more information.