MacOS – Expanding a Fusion Drive partition

core-storagedisk-utilitymacospartition

I created a partition on my Fusion Drive when I first purchased my iMac running Yosemite, and I would like to now resize that drive ("Data" in the screenshot below), but Disk Utility doesn't allow it (the "Partition" button is disabled).

Partition button is disabled

diskutil list

/dev/disk0 (internal, physical):
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:      GUID_partition_scheme                        *121.3 GB   disk0
    1:                        EFI EFI                     209.7 MB   disk0s1
    2:          Apple_CoreStorage Macintosh HD            121.0 GB   disk0s2
    3:                 Apple_Boot Boot OS X               134.2 MB   disk0s3
/dev/disk1 (internal, physical):
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:      GUID_partition_scheme                        *3.0 TB     disk1
    1:                        EFI EFI                     209.7 MB   disk1s1
    2:          Apple_CoreStorage Macintosh HD            2.7 TB     disk1s2
    3:                 Apple_Boot Recovery HD             650.1 MB   disk1s3
    4:                  Apple_HFS Data                    326.8 GB   disk1s4
/dev/disk2 (internal, virtual):
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:                  Apple_HFS Macintosh HD           +2.8 TB     disk2
                                  Logical Volume on disk0s2, disk1s2
                                  03BC8817-F05E-4FC3-9A5C-50130CDAB3AB
                                  Unencrypted Fusion Drive

diskutil cs list

CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group DFD31523-36BE-47AB-A666-54B64038E46B
    =========================================================
    Name:         Macintosh HD
    Status:       Online
    Size:         2793817645056 B (2.8 TB)
    Free Space:   0 B (0 B)
    |
    +-< Physical Volume FEC1934B-53F8-49A1-ABE6-5155689D9A68
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk0s2
    |   Status:   Online
    |   Size:     120988852224 B (121.0 GB)
    |
    +-< Physical Volume 4F985EA2-E22B-451F-BEB3-E5EF76D14A59
    |   ----------------------------------------------------
    |   Index:    1
    |   Disk:     disk1s2
    |   Status:   Online
    |   Size:     2672828792832 B (2.7 TB)
    |
    +-> Logical Volume Family 27D90160-503D-48B7-B434-798CEE738260
        ----------------------------------------------------------
        Encryption Type:         None
        |
        +-> Logical Volume 03BC8817-F05E-4FC3-9A5C-50130CDAB3AB
            ---------------------------------------------------
            Disk:                  disk2
            Status:                Online
            Size (Total):          2787630755840 B (2.8 TB)
            Revertible:            No
            LV Name:               Macintosh HD
            Volume Name:           Macintosh HD
            Content Hint:          Apple_HFS
            LVG Type:              Fusion, Sparse

Is there another way to expand the partition? Maybe a third party software solution?

Best Answer

The good message: you can resize both partitions with on-board tools. The bad message: you can't change the start block of a partition to a lower block number (i.e expand Data to lower block numbers). The partition Data has to be deleted first.

Preparation:

  • Backup your Mac
  • Safe all files and folders in Data to an external drive
  • If you don't have an external drive you can also save the files to Macintosh HD – if it contains enough free space for all files (~223 GB) and the expansion size of Data. Example: If you want to expand Data by 673 GB (to 1000 GB!) you need at least 926 GB (223 GB + 673 GB + ~30 GB some free space for the system) free space on Macintosh HD.
  • Detach any external drive (especially your external Time Machine backup drive)
  • Restart to Internet Recovery Mode by pressing alt cmd R at startup. Booting to Recovery Mode is not conducive because the Recovery HD will be moved in one of the steps below. And you can't move a partition used as a boot volume.

    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 into 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.

    Alternatively you may start from a bootable installer thumb drive (preferably Yosemite or El Capitan) or a thumb drive containing a full system (preferably Yosemite or El Capitan). If you boot to a full system and login as admin you have to prepend sudo to execute special commands like gpt ...!

Remove the partition Data and shrink the CoreStorage Volume Group

  • Booted to Internet Recovery Mode open Utilities → Terminal in the menubar and enter: diskutil list to get the disk identifiers and diskutil cs list to get a CoreStorage listing. Below I assume that your main disks have the disk identifiers disk0 (usually the SSD)/disk1(usually the HDD) and the CoreStorage Logical Volume disk2.

  • First you have to remove the Data partition:

    gpt -r show /dev/disk1 #to get an overview
    

    To remove a partition with gpt the disks (and all related disks like the inherent CoreStorage volume) have to be unmounted - first the CoreStorage Logical Volume and then the physical disks (SSD and HDD):

    diskutil unmountDisk /dev/disk2
    diskutil unmountDisk /dev/disk1
    diskutil unmountDisk /dev/disk0
    gpt remove -i 4 /dev/disk1 #remove the *Data* partition
    
  • Then you have to resize the Logical Volume Group:

    diskutil mount /dev/disk0s2 #mount the physical volume of the CoreStorage Logical Volume Group
    diskutil mount /dev/disk1s2 #mount the physical volume of the CoreStorage Logical Volume Group
    diskutil mount lvUUID #lvUUID: the logical volume UUID - in your case 03BC8817-F05E-4FC3-9A5C-50130CDAB3AB
    diskutil cs resizeStack lvUUID size
    

    in your case (assuming you want to "resize" Data to 1000 GB (3121 GB-1000=2121 GB):

    diskutil cs resizeStack 03BC8817-F05E-4FC3-9A5C-50130CDAB3AB 2121g
    

    Your Recovery HD should be moved automatically - regardless of whether shrinking or expanding the CS volume - to the very end of it.

  • Enter the following to get the new partition scheme:

    gpt -r -vv show /dev/disk1
    
  • To add a partition with gpt the disks (and all related disks like the inherent CoreStorage volume) has to be unmounted

    diskutil unmountDisk /dev/disk2 #use the diskidentifier of the CS logical volume
    diskutil unmountDisk /dev/disk1 #use the diskidentifier of the HDD
    diskutil unmountDisk /dev/disk0 #use the diskidentifier of the SSD
    
  • Enter

    gpt add -b StartBlock -s NumberOfBlocks -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk1
    

    to create a new HFSJ+ partition on disk1. 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 equally divisible through 8!

    Example:

    if the result of gpt -r -vv show /dev/disk1 is

    gpt show: /dev/disk1: mediasize=68719476736; sectorsize=512; blocks=134217728
    gpt show: /dev/disk1: PMBR at sector 0
    gpt show: /dev/disk1: Pri GPT at sector 1
    gpt show: /dev/disk1: Sec GPT at sector 134217727
          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  104974016      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
      105383656    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
      106653192   27564503      
      134217695         32         Sec GPT table
      134217727          1         Sec GPT header
    

    then StartBlock would be 106653192 and the NumberOfBlocks (27564503/8=3445562,875 -> 3445562*8) 27564496

    The resulting gpt command to create a new JHFS+ partition occupying all available free space would be:

    gpt add -b 106653192 -s 27564496 -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk1
    
  • Enter exit and quit Terminal

  • Open Disk Utility and erase/initialize the newly created volume
  • Check the main volume Macintosh HD for errors
  • Quit Disk Utility and reboot to your main volume