re expand a partitioned disk The internal disk of my Mac book pro is partitioned as follows: 

% diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS mainHD                  249.7 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:          Apple_CoreStorage                         249.1 GB   disk0s4
   5:                 Apple_Boot Recovery HD             650.0 MB   disk0s5
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS oldHD                  *248.7 GB   disk1


% diskutil cs list
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group C2BDDBCA-73CF-473C-B9DA-E5682EF29610
    =========================================================
    Name:         Macintosh HD 2
    Status:       Online
    Size:         249059012608 B (249.1 GB)
    Free Space:   35708928 B (35.7 MB)
    |
    +-&lt; Physical Volume CA1B7050-0A3D-4FFD-ADC2-AE42B45BEB9C
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk0s4
    |   Status:   Online
    |   Size:     249059012608 B (249.1 GB)
    |
    +-&gt; Logical Volume Family 4CBD3D40-147F-4B2D-A997-975E00295101
        ----------------------------------------------------------
        Encryption Status:       Unlocked
        Encryption Type:         None
        Conversion Status:       NoConversion
        Conversion Direction:    -none-
        Has Encrypted Extents:   No
        Fully Secure:            No
        Passphrase Required:     No
        |
        +-&gt; Logical Volume B3E1FCD6-ACAB-4152-AEB5-71F41C329C17
            ---------------------------------------------------
            Disk:                  disk1
            Status:                Online
            Size (Total):          248687755264 B (248.7 GB)
            Conversion Progress:   -none-
            Revertible:            Yes (no decryption required)
            LV Name:               oldHD
            Volume Name:           oldHD
            Content Hint:          Apple_HFS


The operating system (os x 10.9.5) and all my files are in the mainHD, where I'm running out of space. I would like to delete the oldHD so that I can increase the size of mainHD. 

When I try to delete oldHD via the graphical disk utility I get an Alert (null) box where I can select cancel or remove, if I click on remove nothing happens and in the log I see: 

: Preparing to remove partition from disk: “APPLE SSD SM512E Media”
: Could not unmount partition to be deleted.


How can I get oldHD deleted and mainHD resized?
To delete CoreStorage volumes you have to use the CLI:


please backup your volume "mainHD"
boot to Internet Recovery Mode (hit altcmdR immediately after the start-up chime)
open Disk Utility and check/repair mainHD
quit Disk Utility , open in the menubar Utilities/Terminal.app and enter diskutil cs deleteVolume LVUUID to delete the Logical Volume
in your case: diskutil cs deleteVolume B3E1FCD6-ACAB-4152-AEB5-71F41C329C17
and then
diskutil cs delete LVGUUID to delete the Logical Volume Group
in your case: diskutil cs delete C2BDDBCA-73CF-473C-B9DA-E5682EF29610. Your LGV will be converted to a simple, empty volume with the name "Untitled".
enter diskutil list and sudo gpt -r -vvv show -l /dev/disk0
result of the latter (start blocks and block sizes differ because the example disk is half as big as yours &amp; some parts of the output are omitted):

...
         40       409600      1  GPT part - "EFI System Partition"
     409640    244763224      2  GPT part - "mainHD"
  245172864      1269536      3  GPT part - "Recovery HD"
  246442400    242522776      4  GPT part - "Untitled"
  488965176      1269536      5  GPT part - "Recovery HD"
...  

enter diskutil unmountDisk /dev/disk0
then remove any partition except those with index 1 and 2 (EFI and mainHD) with  sudo gpt remove -i IndexNumber disk0
enter diskutil resizeVolume disk0s2 0b to expand it to the full size.
enter exit and quit Terminal
open Disk Utility, check/repair mainHD again and quit afterwards
reboot to main HD
rebuild Recovery HD with Recovery Partition Creator 3.8 or by just reinstalling Mavericks 10.9.5 (don't use 10.9.4 or earlier!). Your data and apps will be preserved.