MacOS – Reclaim SSD space from deleted partition

bootcampcore-storagemacospartition

I have a very similar problem to one that was answered here, but I don't know how to apply the answer to my mac.

MacBook Pro 15", Late 2013, 2.3GHz/16GB/512GB, Yosemite 10.10.3

I was attempting to load Windows 8.1 using bootcamp but had continued errors with the Windows install and eventually abandoned the process and deleted the bootcamp partition using disk utility. Now I can't drag down the main Macintosh HD partition to reclaim the 50GB of free space.

enter image description here

diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage                         449.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           *449.0 GB   disk1
                                 Logical Volume on disk0s2
                                 7527240B-2663-4F9F-8803-B602F828E193
                                 Unencrypted

sudo gpt -r show /dev/disk0
      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  877662072      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  878071712    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  879341248   97763779         
  977105027         32         Sec GPT table
  977105059          1         Sec GPT header


sudo fdisk /dev/disk0
Disk: /dev/disk0    geometry: 60821/255/63 [977105060 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -  977105059] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused  

Thanks in advance for any help!

Best Answer

Your internal disk is set up as a CoreStorage Volume Group. You can't easily expand it with Disk Utility booted from the internal main volume. To modify it you have to boot to Internet Recovery Mode or to an external boot drive.

Preparation:

  • Backup your data.
  • Detach any external drive (especially your external Time Machine backup drive).
  • 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.

    Alternatively you may start from a bootable installer thumb drive (Mavericks or Yosemite) or a thumb drive containing a full system (Mavericks or Yosemite).

Modify CoreStorage stack:

  • Open in the menubar 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.3 GB    disk0
       1:                        EFI EFI                    209.7 MB    disk0s1
       2:          Apple_CoreStorage                        449.4 GB    disk0s2
       3:                 Apple_Boot Recovery HD            650.0 MB    disk0s3
       4:                        EFI No Name EFI            100.0 MB    disk0s4
    /dev/disk1
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     Apple_partition_scheme                         *1.3 GB    disk1
       1:        Apple_partition_map                         30.7 KB    disk1s1
       2:                  Apple_HFS OS X Base System        *1.3 GB    disk1s2
    /dev/disk2
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:                  Apple_HFS Macintosh HD          *449.0 GB    disk2
                                     Logical Volume on disk0s2
                                     7527240B-2663-4F9F-8803-B602F828E193
                                     Unencrypted
    /dev/disk3-disk12 ...belong to the OS X Base System (your recovery system you booted to previously)
    

    Disk0 is your main internal disk device containing the EFI-partition (dis0s1), the CoreStorage partition (disk0s2) and the Recovery HD (disk0s3).

    Disk1 is a logical disk created by booting to the netboot image which contains a recovery system (OS X Base System = disk1s2) similar to the Recovery HD.

    Disk2 is also a logical disk residing in disk0s2 and it contains the CoreStorage stack.

  • Enter gpt -r -vv show /dev/disk0
    Example listing:

    sudo gpt -r show /dev/disk0
          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  877662072      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
      878071712    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
      879341248   97763779         
      977105027         32         Sec GPT table
      977105059          1         Sec GPT header
    
  • Enter diskutil cs list
    Example listing:

      CoreStorage logical volume groups (1 found)
    |
    +-- Logical Volume Group A629E051-D7B0-4B8C-A803-074F62704636
        =========================================================
        Name:         System
        Status:       Online
        Size:         449362980864 B (449.0 GB)
        Free Space:   16777216 B (16.8 MB)
        |
        +-< Physical Volume 90C09FC0-4215-4871-901B-70E2C9C7D464
        |   ----------------------------------------------------
        |   Index:    0
        |   Disk:     disk0s2
        |   Status:   Online
        |   Size:     449362980864 B (449.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 7527240B-2663-4F9F-8803-B602F828E193
                ---------------------------------------------------
                Disk:                  disk2
                Status:                Online
                Size (Total):          4488010800 B (448.8 GB )
                Conversion Progress:   -none-
                Revertible:            Yes (no decryption required)
                LV Name:               System
                Volume Name:           System
                Content Hint:          Apple_HFS
    

    You don't have a blocking No Name EFI (disk0s4) which usually is created while installing Windows with the Boot Camp Assistant - even if the install fails.

  • You may now immediately 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 7527240B-2663-4F9F-8803-B602F828E193 475g  
    

    to expand it to 475 GB

    diskutil cs resizeStack 7527240B-2663-4F9F-8803-B602F828E193 0g 
    

    to expand it to the full available size (0g is a magic number here).

    Your Recovery HD should be moved automatically.

  • Quit Terminal by entering exit and open Disk Utility.

  • Check the superior Logical Volume Group (Macintosh HD) and the Logical Volume (the ingferior Macintosh HD) for errors.
  • Reboot your Mac to your main volume.