Apple - How can I delete a partition (coreStorage logical volume?) from the Terminal?

I highly recommend completely backing up the machine before attempting this, either using TM with no exclusions set, or better yet, cloning the whole drive using a program like Carbon Copy Cloner.

Unmount the Logical Volume:

sudo diskutil unmount force /dev/disk1

Remove the Logical Volume Group and all of its contents:

sudo diskutil cs deleteLVG B6308EC8-297D-44BD-9212-6BD867F6331B

From diskutil's man page:

  delete | deleteLVG lvgUUID | lvgName
           Delete a CoreStorage logical volume group. All logical volume families with their
           logical volumes are removed, the logical volume group is destroyed, and the now-
           orphaned physical volumes are erased and partition-typed as Journaled HFS+.

Merge the now orphaned partition disk0s4 into startup volume disk0s2 (note: disk0s3, one recovery partition, will be erased and merged as well). disk0s5, the other recovery partition, shouldn't be affected:

sudo diskutil mergePartitions HFS+ "Apple_HFS Macintosh HD" disk0s2 disk0s4

Again, from the man pages:

 Merge two or more partitions on a disk.  All data on merged partitions other than the first
                will be lost.  Data on the first partition will be lost as well if the force argument is
                given.

                If force is not given, and the first partition has a resizable file system (e.g. JHFS+), the
                file system will be preserved and grown in a data-preserving manner; your format and name
                parameters are ignored in this case.

Verify the boot Volume structure.

diskUtil VerifyVolume /

Verify the partition map:

diskutil verifyDisk disk0

Boot into Recovery Mode, or Internet Recovery if needed -- if any errors appear:

You should be left with:

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

I know this is an old article, but this recently happened to me and the easiest way to get rid of the Yosemite partition is to:

  1. Boot your other OS, mine was Mavericks
  2. Open Disk Utility
  3. Select the Yosemite partition
  4. Select the erase tab, erase it,
  5. Select the main drive and go to the partition tab, where you can then delete the Yosemite partition and resize it back to the original size.