How can I resize a partition on OSX 10.10.5

I have a Mac with OS X 10.10.5 on a HD which had 4 partitions.

Using Disk Utility I deleted one of the 4, intending to slightly grow the 3rd (containing the OS), leaving space for a new partition to install El Capitan.

This has been my practice up to now when a new version comes out.

I booted to another HD and deleted the partition, but it then proceeded to resize the 3rd partition YoodenVranx to use all the free space.

There seems to be no way to change the Partition Layout, or resize the partition.

I rebooted and used diskutil to list the current state.

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Fenchurch               80.0 GB    disk0s2
   3:                  Apple_HFS BxxxxxData              70.0 GB    disk0s3
   4:          Apple_CoreStorage                         349.0 GB   disk0s4
   5:                 Apple_Boot Recovery HD             650.0 MB   disk0s5
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS YoodenVranx            *348.6 GB   disk1
                                 Logical Volume on disk0s4

Solution 1:

To get some additional un-allocated disk space on disk0 to create a new partition you have to shrink your CoreStorage Volume Group and all subsequent CoreStorage items.

To resize the CoreStorage Volume Group in your case you have to use the Terminal booted to an external boot drive.

Preparation:

  • Backup your data.
  • Detach any external drive (especially your external Time Machine backup drive) except your external boot drive.
  • Boot from your external drive or a bootable installer thumb drive (Mavericks or Yosemite)/a thumb drive containing a full system (Mavericks or Yosemite).

    or

    Restart to Internet Recovery Mode by pressing alt cmd R at startup.
    The prerequisites are the latest firmware update installed, either ethernet or WLAN (WPA/WPA2) and a router with DHCP activated.
    On a 50 Mbps-line it takes about 4 min (presenting a small animated globe) to boot to a recovery netboot image which usually is loaded from an apple/akamai server.

    I recommend ethernet because it's more reliable. If you are restricted to WIFI and the boot process fails, just restart your Mac until you succeed booting.

Modify CoreStorage stack:

  • Open Disk Utility and check your disks for errors. Repair them and quit Disk Utility.
  • Open /Applications/Utilities/Terminal

First you should get an overview of your disks and the partition layout:

  • Enter diskutil list:

    Example listing:

    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *500.1 GB   disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:                  Apple_HFS Fenchurch               80.0 GB    disk0s2
       3:                  Apple_HFS BxxxxxData              70.0 GB    disk0s3
       4:          Apple_CoreStorage                         349.0 GB   disk0s4
       5:                 Apple_Boot Recovery HD             650.0 MB   disk0s5
    /dev/disk1
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *100.1 GB   disk1
       1:                        EFI EFI                     209.7 MB   disk1s1
       2:                  Apple_HFS BlinkenDonx              99.9 GB    disk1s2
    /dev/disk2
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:                  Apple_HFS YoodenVranx            *348.6 GB   disk2
                             Logical Volume on disk0s4
    

    with disk0: your internal disk, disk1: a fictional external boot drive with 100 GB containing your boot volume (BlinkenDonx) and disk2: your CoreStorage Volume Group YoodenVranx residing in disk0s4.

  • Enter diskutil cs list

    Example listing:

      CoreStorage logical volume groups (1 found)
    |
    +-- Logical Volume Group A629E051-D7B0-4B8C-A803-074F62704636
        =========================================================
        Name:         YoodenVranx
        Status:       Online
        Size:         349046696192 B (349.0 GB)
        Free Space:   16777216 B (16.8 MB)
        |
        +-< Physical Volume 90C09FC0-4215-4871-901B-70E2C9C7D464
        |   ----------------------------------------------------
        |   Index:    0
        |   Disk:     disk0s2
        |   Status:   Online
        |   Size:     349046696192 B (349.0 GB)
        |
        +-> Logical Volume Family F6962E38-50E4-4458-BFE6-CF2E179352F5
            ----------------------------------------------------------
            Encryption Status:       Unlocked
            Encryption Type:         None
            Conversion Status:       NoConversion
            Conversion Direction:    -none-
            Has Encrypted Extents:   No
            Fully Secure:            No
            Passphrase Required:     No
            |
            +-> Logical Volume BD36C73D-860D-4DC6-B125-AD624F448B88
                ---------------------------------------------------
                Disk:                  disk2
                Status:                Online
                Size (Total):          348696696192 B (348.6 GB)
                Conversion Progress:   -none-
                Revertible:            Yes (no decryption required)
                LV Name:               YoodenVranx
                Volume Name:           YoodenVranx
                Content Hint:          Apple_HFS
    
  • Now resize the CoreStorage volume with

    diskutil cs resizeStack LVUUID size 
    

    with LVUUID: UUID of the logical volume and size: the final size of your CoreStorage volume.
    Examples:

    diskutil cs resizeStack BD36C73D-860D-4DC6-B125-AD624F448B88 300g  
    

    to shrink it to 300 GB

    diskutil cs resizeStack BD36C73D-860D-4DC6-B125-AD624F448B88 295400m  
    

    to shrink it to 295.4 GB

    Your Recovery HD should be moved automatically.

  • To add an additional partition for your future El Capitan volume enter first:

    sudo gpt -r show /dev/disk0
    

    to get an overview

    Example listing:

    gpt show: /dev/disk0: mediasize=500119476736; sectorsize=512; blocks=976757816
    gpt show: /dev/disk0: PMBR at sector 0
    gpt show: /dev/disk0: Pri GPT at sector 1
    gpt show: /dev/disk0: Sec GPT at sector 976757815
          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  156250000      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
      156659640  136718750      3  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
      293378390  544921872      4  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
      838300262    1269536      5  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
      839569798  137187985         
      976757783         32         Sec GPT table
      976757815          1         Sec GPT header
    

    with i=1: EFI 2: Fenchurch 3: BxxxxxData 4: Apple_CoreStorage 5: Recovery HD and about 70.2 GB free space (assuming you shrunk your CoreSorage volume to ~279 GB in the previous step to be able to create a new 70 GB volume).

  • To create a new volume with gpt you have to unmount all mounted volumes on disk0 (first the CoreStorage volume, which has its own disk identifier disk2 but resides on disk0, then all other mounted volumes on disk0)

    diskutil umountDisk /dev/disk2
    diskutil umountDisk /dev/disk0
    
  • Now add a new JHFS+ volume with gpt:

    sudo gpt add -b StartBlock -i IndexNumber -s SizeOfVolume -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0
    

    StartBlock is the number of the first block in the unallocated space and NumberOfBlocks is the number of free blocks or smaller. NumberOfBlocks has to be dividable through 8!

    For the example above that's:

    sudo gpt add -b 839569798 -i 6 -s 137187984 -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0
    
  • Enter exit and quit Terminal.
  • Open Disk Utility and erase your newly created partition disk0s6 (Journaled HFS+) and rename it.
  • Then check your shrunk CoreStorage volume for errors.
  • Quit Disk Utility.
  • Reboot to your main volume.