How to fix an accidentally created Apple CoreStorage Volume, LVG, Logical Volume Group (broken partitions) I used Unetbootin and accidentally chose a partition on my HDD to install the Lubuntu Live-USB I wanted to create on an USB Stick.

Now, my HDD looks like this 



I can boot into Mac OS X and everything works fine. 

This is a 4TB SHDD. Is there any option to recreate the original settings with only one partition?

GPT fdisk (gdisk) shows the following:

Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): x

Expert command (? for help): o

Disk size is 7814037168 sectors (3.6 TiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1   4294967294   primary     0xEE

Expert command (? for help): 


gpt and diskutil output is:

    BVs-iMac-3:~ bvimac$ sudo gpt -r show disk0
Password:
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34           6         
          40      409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      409640  2728147912      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  2728557552     1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  2729827088        1264         
  2729828352  2529234944      4  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  5259063296      262144      5  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  5259325440  2554711695         
  7814037135          32         Sec GPT table
  7814037167           1         Sec GPT header
BVs-iMac-3:~ bvimac$ diskutil cs list
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group 28A99931-20D1-4D0C-8B5A-9872BC7270E2
    =========================================================
    Name:         LINUX
    Status:       Online
    Size:         1294968291328 B (1.3 TB)
    Free Space:   1294632738816 B (1.3 TB)
    |
    +-&lt; Physical Volume 42D47656-F1D4-4FE4-BAB2-D572CA06D233
        ----------------------------------------------------
        Index:    0
        Disk:     disk0s4
        Status:   Online
        Size:     1294968291328 B (1.3 TB)
The following should work:


Open Terminal and enter:

diskutil list
diskutil cs list

Verify (and repair) the volume if necessary:

diskutil verifyVolume disk0s2


If a repair is required boot to Recovery Mode and repair the main OS X volume.
Delete the Logical Volume Group

diskutil cs delete 28A99931-20D1-4D0C-8B5A-9872BC7270E2


This should convert the LVG LINUX to a normal partition
Then enter diskutil list again and erase the 134 MB and the 1.3 TB partition (use the proper disk identifiers found in your listing above here):

diskutil eraseVolume Free Space disk0s5
diskutil eraseVolume Free Space disk0s4

Verify the volume again:

diskutil verifyVolume disk0s2

Check the limits of disk0s2

diskutil resizeVolume disk0s2 limits


This will output something like that:

For device disk0s2 iMac HD:
    Current size:  1.4 TB (1396811730944 Bytes)
    Minimum size:  ? 
    Maximum size:  ?

Try to expand the main volume - you can't expand the volume beyond the limit shown in the previous output

 diskutil resizeVolume disk0s2 R


If the R size option fails try to use a real size like 3999g or a percentage 100% (on some external disks this may fail because of some 2 TiB limit).

 diskutil resizeVolume disk0s2 3999927271424b


or

 diskutil resizeVolume disk0s2 100%