13

For some reason, the BootCamp Assistant app won't let me delete my BootCamp partition. How can I do so using Terminal and the diskutil terminal app?

10
  • Have you tried Disk Utility in the Applications folder?
    – Vickash
    Commented Jun 28, 2012 at 21:38
  • 1
    It was the second thing I tried; all the partition controls are greyed out.
    – Jules
    Commented Jun 29, 2012 at 0:46
  • Did you customize the partitions after installing BootCamp? This discussion may provide some useful information: discussions.apple.com/thread/3698348. The executive summary is that if you've got more than two OS partitions, you may need to backup your OS X partition and reformat the drive (or at least delete the existing partitions), and then restore your OS X partition.
    – Chris Page
    Commented Jun 29, 2012 at 12:24
  • No I didn't customize the partitions. After setting up BootCamp, I lost all control of partitions via Disk Utility. Can't resize, delete, or add partitions.
    – Jules
    Commented Jun 29, 2012 at 14:23
  • 1
    Deleting a BootCamp partition with BootCamp Assistant may not be identical to deleting partitions with Disk Utility, and if BootCamp Assistant isn’t letting you delete the partition things may be messed up in a way that’s important to resolve before deleting the partition. At the very least it’s a clue as to what’s wrong. Have you tried contacting Apple about this? (1-800-SOS-APPLE, for example.)
    – Chris Page
    Commented Jul 4, 2012 at 3:29

6 Answers 6

17

Here's what worked for me:

  1. use diskutil list to find the small Microsoft Reserved partition you're trying to delete but disk utility (or the command-line equivalent diskutil) won't allow. Let's say it's on disk 99 partition 400 (mine was on disk 0 partition 4)
  2. sudo diskutil eraseVolume JHFS+ deleteme /dev/disk99s400

The above reformats the partition to journaled HFS+ and once you've done that you can just simply delete it (and then resize etc. as you wish).

Note: I've used /dev/disk99s400 because that should not ever work, you have to replace those with the right disk and partition.

WARNING: Destructive, high risk. ALWAYS do a full back up first before screwing with partitions. ALWAYS.

2
  • This totally worked for me. I had a bootcamp partition Bootcamp assistant wouldn't remove, and Disk Utility wasn't showing (El capitan beta 3) and wiping it using this command caused it to show up. I could then use disk utility to erase it and grow the main macintosh HD back up to the full drive Commented Jul 14, 2015 at 19:13
  • This is perfect for fixing this error when trying to remove a Windows partition: “MediaKit reports not enough space on device for requested operation.” Commented Apr 5, 2017 at 11:18
3

Have you tried booting from OSX installation media? Those have both a Terminal (with diskutil) and the GUI Disk Utility, which might start working as you're no longer trying to partition the drive you're booting from.

Caution, from now on: here be dragons! Make sure you understand what's going on before you start on this, you can't back out halfway! Check your backups are readable!

If both versions of diskutil fail here too, stay in the installation media's terminal and get the raw partition table using:

gpt -r show disk0

What has likely happened is that the two partition tables, the GPT and the MBR, have gone out of sync. This happens if you try to partition your Mac disk from Windows. The above shows the GPT version (which OSX uses). This shows the MBR version (which Windows uses):

fdisk /dev/disk0

Make sure this is the disk you want to change (might be disk1, disk2, etc). Note the number (index) of the partition you want to delete in both the GPT and the MBR. They might not be the same!

If confused, post the output from the above 2 here, and don't proceed.

Unmount all mounted partitions on the disk you want to partition, e.g.

diskutil unmount "/Volumes/Macintosh HD"
diskutil unmount "/Volumes/BOOTCAMP"

Then comes the dangerous bit (make sure you have backups): Delete the partition using the gpt utility:

gpt remove -i 4 disk0

Make sure to substitute the index of the partition to delete (IN THE GPT) instead of "4" and the exact disk you're partitioning instead of "disk0"!

Finally, you'll need to delete the same partition from the MBR (you may need to unmount again at this point).

Option 1: Remove all trace of bootcamp (only boot OSX on this disk)

If you want to completely remove any trace of Boot Camp (no OSes other than Mac OS X) you can completely destroy the MBR partition table and replace it with a so-called "protective MBR":

fdisk -e /dev/disk0

This lands you at the fdisk command line - the parts in bold are what you type.

fdisk: 1>p

This will show your partition table, same as earlier. You want to replace it with a single protective partition of type EE, covering the whole disk.

fdisk: 1>erase

fdisk:*1>edit 1

Partition id ('0' to disable) [0 - FF]: [0] (? for help)EE

Do you wish to edit in CHS mode? [n]n

Partition offset [0 - 505856]: [63]1

Partition size [1 - 505855]: [505855] (just press enter here to go with the default - the exact number will depend on your disk size)

fdisk: 1>p

This should now show a partition table with the first entry of type EE, and the remaining 3 entries blank.

fdisk: 1>w

Writes your changes to disk. You'll need to quit out of fdisk with

fdisk: 1>q

Next: reboot and pray.

Option 2: Remove only the affected partition (go from triple boot to dual boot or so)

If you want to keep the hybrid MBR, just not the one partition, begin editing the MBR like so:

fdisk -e /dev/disk0

This lands you at the fdisk command line - the parts in bold are what you type.

fdisk: 1>p

This will show your partition table, same as earlier.

Find the entry that corresponds to the partition you're deleting, e.g. 4, then edit that entry (replace "4" with your entry):

fdisk:*1>edit 4

Partition id ('0' to disable) [0 - FF]: [7] (? for help)0

Partition 4 is disabled.

fdisk: 1>p

This should now show a partition table with the deleted partition missing.

fdisk: 1>w

Writes your changes to disk. You'll need to quit out of fdisk with

fdisk: 1>q

Next: reboot and pray.

1
  • 2
    As noted, this won't work if you're booted into normal OS X (you can't edit a drive you're using). iMacs have a major hardware defect where the DVD drive often breaks after only a few uses, so ... I couldn't boot from the official DVD. Obviously the Recovery Partition was no good either - but downloading Apple's "USB Recovery Disk creator" app, and booting from that, did the trick -- support.apple.com/downloads/DL1433/en_US/RecoveryDiskAssistant.dmg
    – Adam
    Commented Jan 25, 2013 at 12:27
2

The answer is to boot off the recovery HD partition, use disk until and select the Bootcamp partition. Then on the erase tab select the format and change it to Mac OS Extended journaled. Now you can erase the drive.

1

I am not certain we have the exact situation, but through following/translating advice on another thread, http://apple.stackexchange.com/questions/145292/i-deleted-my-bootcamp-partition-but-cant-resize-my-os-x-partition I was able to restore functionality to Bootcamp Assistant. I lack the "reputation points" to comment there, but wanted to pass on that this worked for me. My system/hardware specifications are as follows:
MacBook Pro (Retina, 13-inch, Early 2015)

OSX Yosemite: 10.10.5 (14F1605) Processor: 2.7 GHz Intel Core i5 Memory: 8 GB 1867 MHz DDR3 Graphics: Intel Iris Graphics 6100 1536 MB

My specific information:
I, unfortunately, followed errant advice from apple support, and followed instructions by phone support to enter Disc Utility and erased my BOOTCAMP partition and set the format to OS X Extended (Journaled). Following this action, Windows was erased, several megabytes of "other" remained, and my partition was still in place, with 98 GB of inaccessible storage.
This was how I created the same situation as you seem to be describing. As a result, my Disc Utility no longer responded to efforts to modify my partition, and my Bootcamp assistant now had a greyed out tab which, if I had been directed to it initially, would have erased the windows partition AND Restored a single drive.
Note that bootcamp began as part of a single drive, this is important. I have no idea if this solution will work for bootcamp set-ups on separate drives. My problem went to a supervisor, and after two weeks I have had no response from Apple support, so I researched online and found what worked!

SOLUTION: As advised on the thread, I ran Disc Utility again. Two members suggested setting the format to something other than OS X Extended Journaled. Re-erasing and formatting was the only option Disc Utilities provided.
One comment from user102419 suggested erasing and formatting to "microsoft FAT".
A second, more detailed answer from http://apple.stackexchange.com/users/5472/bmike suggested a similar quick fix, but specified formatting to MS DOS to trick the computer into believing Windows was still installed within the partition.
End result, this worked for me, but the terminology used for the drop-down menu in Yosemite was "DOS FAT".
Erasing and formatting the partition in DOS FAT resulted immediately in a return to functionality of the Bootcamp Assistant choice to add or remove Windows. I happily made the choice, pushed continue and was given the option to RESTORE my drive to a single 248 GB OS X.

The process took about 5-7 minutes...which is a long time when you are worrying you may have messed it up..... but, voila, 249.78 GB of available space on my Macintosh Hard Drive. No need to enter internet recovery mode, no need to erase the entire system and reboot from Time Machine.
I did back up everything before trying..just in case.

I hope this answer is helpful for you, and for others trying to reclaim space from a windows Bootcamp partition after following advice to erase windows through the Disc Utility.

0

For those who tried to install windows and something messed and cannot restore partition and it shows gray (-) sign, launch windows installer and remove windows reserved partitions first. You can check those partitions by first going to terminal on mac and type: "diskutil list". You will see there windows reserved portions which apparently can only be removed with windows installer by simply highlighting them and clicking delete on the screen

-2

I had the same problem and I HAVE THE SOLUTION. The problem is that when you install Windows with bootcamp it is creating a Logic Volume Group. What you need to do is delete the Logical Volume Group. Very similar to if you have ever undone a manual fusion drive. Bust out terminal:

diskutil coreStorage list

Copy the Logical Volume Group ID

diskutil coreStorage delete lvgUUID

IT WORKS!

1
  • I would caution anyone to have a backup of all connected disks and a plan to restore that backup before issuing any diskutil coreStorage delete command. This answer would need some detailed editing to make it useful or safe for most people or the general case. Core Storage can be set up in many,many ways and nuking a group might be more like using a grenade when a fly swatter is more appropriate.
    – bmike
    Commented Mar 4, 2016 at 14:04

You must log in to answer this question.

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