9

I have a partition that I no longer use. I've tried erasing with the disk utility GUI, but when I try to remove (with the '-' minus button on the partition view) this feature is disabled. I've also tried reducing the size of the unused partition and applying changes, but they don't save.

This is the out put of diskutil list from the console:

/dev/disk0 (internal):   
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:      GUID_partition_scheme                        *251.0 GB   disk0
    1:                        EFI EFI                     209.7 MB   disk0s1
    2:                  Apple_HFS Macintosh H             68.3 GB    disk0s2
    3:          Apple_CoreStorage BOOTCAMP                181.2 GB   disk0s3
    4:                 Apple_Boot Recovery HD             650.0 MB   disk0s4
/dev/disk1 (internal, virtual):
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:                  Apple_HFS BOOTCAMP               +180.8 GB   disk1
                             Logical Volume on disk0s3
                             E4625018-24BC-4F8B-8B57-1131F79B331A
                             Unencrypted

BOOTCAMP is my main storage, and I don't want to lose any data, here. Macintosh H is the unused partition that I'd like to remove and add the space to BOOTCAMP

4
  • "BOOTCAMP" is the name given to the partition created by Boot Camp Assistant to which Windows is installed. Did you at one time install Windows and then reformat that volume to HFS+? Commented Dec 31, 2015 at 16:19
  • @bmike - yes. I forgot that I did that, but that's how I got here. Commented Dec 31, 2015 at 17:47
  • @bmike I removed the bootcamp tag again because despite the name of the volume it's not involved.
    – klanomath
    Commented Dec 31, 2015 at 18:08
  • Cheers and thanks @klanomath - hard to derail the brain when the text matches expectations :-)
    – bmike
    Commented Dec 31, 2015 at 20:38

2 Answers 2

17

You can't move the start block of a CoreStorage Volume Group ("BOOTCAMP" in your case) non-destructively (OK, there is a workaround: please check the Scattered Physical Volumes method at the end of my answer). The same is valid for non-CoreStorage partitions with on-board tools. AFAIK only iPartition and gparted work for the latter. 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.

You may either remove the partition Macintosh H or repartition the internal drive. I recommend the latter because removing one partition will not increase the size of the second partition!

Preparation:

  • Attach a backup drive and use Time Machine to backup BOOTCAMP.
  • Detach the 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 removed in one of the steps below. And you can't remove 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 ...!

Either remove one partition (not recommended)

  • Open Utilities -> Terminal
  • Enter diskutil list
  • Enter diskutil umountDisk /dev/diskX with diskX: disk identifier of the CoreStorage volume (probably disk2)
  • Enter diskutil umountDisk /dev/diskY with diskY: disk identifier of your internal drive (probably disk0) and
  • Enter gpt -r show /dev/diskY to get an overview and the index number of Macintosh H (probably 2)
  • Enter gpt remove -i 2 /dev/diskY with diskY: disk identifier of your internal drive (probably disk0)
  • Enter exit and quit Terminal

Or remove all partitions (recommended)

  • Open Utilities -> Terminal
  • Enter diskutil list
  • Enter diskutil umountDisk /dev/diskX with diskX: disk identifier of the CoreStorage volume (probably disk2)
  • Enter diskutil umountDisk /dev/diskY with diskY: disk identifier of your internal drive (probably disk0) and
  • Enter gpt destroy /dev/diskY with diskY: disk identifier of your internal drive (probably disk0)
  • Enter exit and quit Terminal
  • Open Disk Utility and partition your internal drive

Either reinstalling OS X booted to IRM

  • Quit Disk Utility and open Restore OS X
  • Install and configure OS X
  • Download the latest OS X and upgrade to OS X El Capitan
  • attach your backup drive
  • Use the Migration Assistant to import your old users/data

Or reinstalling OS X booted to a bootable El Capitan installer thumb drive (recommended)

  • Quit Disk Utility
  • attach your backup drive
  • Install OS X El Capitan
  • Use the Migration Assistant to import your old user(s)/data


If you hesitate to reinstall OS X and migrate your data, you may convert the first OS X partition of your disk to a Physical Volume and add it to your Logical Volume Group. After extending the Logical Volume, BOOTCAMP will cover almost all of your disk. The content of BOOTCAMP will be preserved.

The approach is similar to a Fusion Drive (two Physical Volumes -> one Logical Volume Group/Logical Volume) however using only one disk.

Scattered Physical Volumes method

  • Attach a backup drive and use Time Machine to backup BOOTCAMP.
  • Detach the backup drive
  • Restart to Recovery Mode by pressing cmd R at startup.
  • Open Utilities -> Terminal
  • Enter diskutil list to list all partitions
  • Enter diskutil cs list to list the CoreStorage items
  • Enter diskutil cs addDisk lvgUUID diskYsZ to add a Physical Volume
    lvgUUID is the UUID of the Logical Volume Group, diskYsZ is the disk identifier of the empty partition Macintosh H (probably disk0s2). The content of the partition will be destroyed!
  • Enter diskutil cs resizeVolume lvUUID size to extend BOOTCAMP
    lvUUID is the UUID of the Logical Volume, size: size in t, g, m, k or b (in your case 250g. If you get an error regarding missing space use 249g).
  • Enter exitand quit Terminal. Open Disk Utility and verify the CoreStorage Volume Group.
  • Reboot to your main volume.

The pros:

  • it's fast; it takes about 3 minutes.

The cons:

  • your CoreStorage LVG is non-contiguous and fragmented.
0

I had a related problem which I resolved by converting Core Storage. This may work for you, although it may not apply to your case. https://apple.stackexchange.com/a/209350/19086

This was simpler than the alternatives, but @klanomath suggested solutions to this problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .