How to add free space to a Logical Volume Group? (Resizing Partitions)

Solution 1:

You can't move the start block (=380677208 for LVG2 or "Macintosh HD 2" in your case) of a CoreStorage Volume (Group) non-destructively. The same is valid for non-CoreStorage partitions with on-board tools. AFAIK for the latter only iPartition and gparted work. Therefore you can't easily reclaim empty space with a lower start block and an arbitrary size and add it contiguously to existing CoreStorage or non-CoreStorage volumes.

Or with other words: You can expand volumes (CoreStorage or non-CoreStorage) from the ending block to higher block numbers but not from the starting block to lower ones.

You have 2 options though:

  • Recreating a larger second CoreStorage volume
  • Creating a new partition in the empty space and adding it as physical volume to your second Logical Volume Group. This will scatter your second Logical Volume Group over several Physical Volumes (PV2 & PV3 - the latter build in the empty space) on the same drive but might be unavoidable if another partition like your Recovery HD or a Data volume exists between LVG1 and immediately before PV2.

Both methods require you to backup/move the content of the second Logical Volume to another volume and its deletion afterwards.

For both methods force-backup all your data.

Then boot to an external thumb drive containing a bootable system or to Internet Recovery Mode (hit altcmdR immediately after the start-up chime)

  • open Terminal.app in the menubar (Utilities/Terminal)
  • enter diskutil cs list and diskutil list
  • enter diskutil cs deleteVolume LV2UUID to delete the second Logical Volume
    in your case diskutil cs deleteVolume 976CA58C-E8FF-492A-9968-6FEF64C58A31

Now the 2 different methods divert:

Recreating a larger second CoreStorage volume (recommended):

  • enter diskutil cs delete LVG2UUID to delete the second Logical Volume Group
    in your case diskutil cs delete 4793C4C8-0F56-4673-A2B6-98B15403CD33
    Your second Logical Volume Group will be converted to a classical volume with the name "Untitled". This will take some time because it also has to be decrypted.
  • If you enter diskutil cs list repeatedly you will see the progress of the decryption task (in %).
  • after the conversion completed enter sudo gpt -r -vvv show -l /dev/disk0*
    you have to enter an admin password then
    result (some parts omitted):

    ...
             40       409600      1  GPT part - "EFI System Partition"
         409640    244763224      2  GPT part - "Macintosh HD"
      245172864      1269536      3  GPT part - "Recovery HD"
      246442400(s) 134234808(a)         
      380677208    108287968(b)   4  GPT part - "Untitled"
      488965176      1269536      5  GPT part - "Recovery HD"
    ...  
    
  • enter diskutil list
  • enter diskutil unmountDisk /dev/DiskIdentifierLV (probably disk1) to unmount "Macintosh HD"
  • enter diskutil unmountDisk /dev/disk0
  • enter sudo gpt remove -i IndexNumber DiskIdentifier to remove a partition
    in your case sudo gpt remove -i 4 disk0 to remove the partition named "Untitled"
  • enter sudo gpt add -b StartBlock(s) -s NumberOfBlocks(a+b) DiskIdentifier to create a new partition filling the empty space.
    in your case probably sudo gpt add -b 246442400 -s 242522776 disk0
  • enter diskutil list to get the DiskIdentifier of your newly created partition (probably disk0s4)
  • enter diskutil cs create Name /dev/DiskIdentifier to recreate your second LVG
    in your case probably diskutil cs create "Macintosh HD 2" /dev/disk0s4
  • enter diskutil cs list to get the UUID of LVG2. Copy it.
  • enter diskutil cs createVolume LVG2UUID jhfs+ Name 100%
    in your case diskutil cs createVolume <-PasteTheLVG2UUIDHere-> jhfs+ "Macintosh HD 2" 100%
  • enter exit, quit Terminal and reboot to "Macintosh HD"
  • Open "Disk Utility", check the newly created CoreStorage volume "Macintosh HD 2" and quit the app
  • open the Info window of the volume in Finder and uncheck the box labeled 'Ignore ownership on this volume'.
  • enable FileVault for the volume/encrypt it
  • restore "Macintosh HD 2" from your Time Machine backup

Scattered brain PhysicalVolumes method (not recommended but sometimes necessary):

This method is necessary if sudo gpt -r -vvv show -l /dev/disk0 shows following result (some parts omitted):

    ...
             40       409600      1  GPT part - "EFI System Partition"
         409640    244763224      2  GPT part - "Macintosh HD"
      245172864      1269536      3  GPT part - "Recovery HD"
      246442400     83034808
      329477208     51200000      4  GPT part - "Data"         
      380677208    108287968      5  GPT part - "Macintosh HD 2"
      488965176      1269536      6  GPT part - "Recovery HD"
    ... 

This partition layout may occur if you have an additional Data partition between your 2 CoreStorage volumes.

  • enter diskutil list
  • enter diskutil unmountDisk /dev/DiskIdentifierLV (probably disk1) to unmount "Macintosh HD"
  • enter diskutil unmountDisk /dev/disk0
  • enter sudo gpt add -b StartBlock -s NumberOfBlocks DiskIdentifier to create new partition filling the empty space.
    in the case above sudo gpt add -b 246442400 -s 83034808 disk0
  • enter diskutil list to get the DiskIdentifier of the newly created partition (probably disk0s6 - check the size!)
  • enter diskutil cs list to get the LVG2UUID
  • enter diskutil cs addDisk LVG2UUID DiskIdentifier to add a physical disk to LVG2
    in your case diskutil cs addDisk 4793C4C8-0F56-4673-A2B6-98B15403CD33 disk0s6
  • enter diskutil cs createVolume LVG2UUID jhfs+ Name 100% to create a new Logical Volume in LVG2
    in your case diskutil cs createVolume 4793C4C8-0F56-4673-A2B6-98B15403CD33 jhfs+ "Macintosh HD 2" 100%
  • enter exit, quit Terminal and reboot to "Macintosh HD"
  • Open "Disk Utility", check the newly created CoreStorage volume "Macintosh HD 2" and quit the app
  • open the Info window of the volume in Finder and uncheck the box labeled 'Ignore ownership on this volume'.
  • enable FileVault for the volume/encrypt it
  • restore "Macintosh HD 2" from your Time Machine backup

*You don't have to enter 'sudo gpt...' if you are logged in as root (e.g. Internet Recovery Mode)