# 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)
|
+-< Physical Volume 42D47656-F1D4-4FE4-BAB2-D572CA06D233
----------------------------------------------------
Index:    0
Disk:     disk0s4
Status:   Online
Size:     1294968291328 B (1.3 TB)

• Please add the output of sudo gpt -r show disk0 and diskutil cs listto your question. – klanomath Jan 31 '17 at 17:44
• BTW you didn't create a Linux LVM (UUID: E6D6D379-F507-44C2-A23C-238F2A3DF928) but a Apple CoreStorage LVG (UUID: 53746F72-6167-11AA-AA11-00306543ECAC) – klanomath Feb 1 '17 at 13:19
• Is this the same system as apple.stackexchange.com/questions/271092/… ? – bmike Feb 1 '17 at 17:44
• No. The other one is a Laptop with a currently unbootable Windows partition. This one here was an iMac where Unetbootin went the wrong way. – Ben Feb 1 '17 at 18:05

## 1 Answer

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%

• @Ben I read your other question. David Anderson probably provided an answer to your question already. I don't find the duplicate though. – klanomath Jan 31 '17 at 22:22
• The answer helped. I deleted the LVG. But i cannot resize the disk0s2. Maximum size is I as current size. I suspect it is because the Recovery partition is in the way. I was able to do it via disk utility, though. – Ben Feb 1 '17 at 13:08
• @Ben It's usually possible to resize a HFS partition and a subsequent Recovery partition. It's not possible to resize 3 partition at once (e.g. hfs+recovery+ntfs -> free space). A resize may also fail after modifying the partition layout with Boot Camp. – klanomath Feb 1 '17 at 13:14
• After using this answer my recovery partition was broken and I had to remove it. apple.stackexchange.com/questions/271254/… – Ben Feb 2 '17 at 2:23
• @Ben The commands in my answer shouldn't touch the Recovery HD! – klanomath Feb 2 '17 at 2:27