Cannot delete or merge old boot camp partition in El Capitan

Solution 1:

Hold down the Command ⌘OptionR keys at startup to boot to OS X Internet Recovery. Once you have started your Mac in OS X Internet Recovery mode, you need to use the gpt command to remove the unneeded partitions. You can then expand your core storage partition to recovery the freed space back into your OS X partition.

To use the gpt command, you need to unmount your physical internal disk. If you are using core storage, then you have to unmount the virtual internal disk first. The commands are shown below. Note: Once booted to internet recovery, the disk numbers may change. The disk numbers used below are based the the values shown in your posted question. The partitions to be removed are 4, 5 and 6 on disk0.

To remove partition 6, enter the commands.

diskutil  unmountDisk  /dev/disk1
diskutil  unmountDisk  /dev/disk0
gpt  remove  -i  6  /dev/disk0

To delete the remaining partitions, repeat the commands.

diskutil  unmountDisk  /dev/disk1
diskutil  unmountDisk  /dev/disk0
gpt  remove  -i  5  /dev/disk0
diskutil  unmountDisk  /dev/disk1
diskutil  unmountDisk  /dev/disk0
gpt  remove  -i  4  /dev/disk0

Now, when executing the command

gpt  -r  show  /dev/disk0

the removed partitions should not appear. You can restart back to El Capitan.

Use the Disk Utility application to recover the freed space. Use the steps below.

  1. Highlight the internal disk.
  2. Click on the icon labeled "Partition".
  3. Highlight the free space shown in the pie chart. See example below.

    321

  4. Click on the "-" symbol. Your OS X partition should fill the pie chart. See example below.

    322

  5. Click on the "Apply" button.

Solution 2:

The answer is so simple. Forget terminals and internet recovery. Here's what you gotta do:

  1. Format the BOOTCAMP-partition through disk utility to MS-DOS (FAT)
  2. Press cmd + space and write bootcamp-assistant, open bootcamp
  3. Erase windows and merge the partitions as one mac HD-partition.

Solution 3:

You can not use DiskUtility on a Bootcamp partition, whatever you want to do. Only use BootcampAssistant when you want to change or delete the Bootcamp partition.