How do I remove unused partition (El Capitan)?
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 likegpt ...
!
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
exit
and 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.