16

I didn't realize this would cause issues, but I used Disk Utility to delete my Bootcamp partition and then tried to resize my main partition to fill the disk. This causes an error and I searched for answers only to be told,

You're going to have to reinstall Mac OS X (that's the only solution).

You should have removed the Boot Camp partition in the Boot Camp Assistant.

What?? I Didn't see any warning in Disk Utility.

If you delete this Bootcamp partition you may not be able to boot Windows anymore.

I saw this but figured it was ok -- I didn't want to boot Windows anymore, I wanted to delete it. So now what am I supposed to do?

  • I had had similar problem and when I opened bootcamp assistant the erase the windows partition, i opened disk utility and "erased the bootcamp partition as microsoft FAT" and this did the trick,opened bootcamp assistant back up and the greyed out box was back in bold I clicked it and voila my hardrive is ONE now – user102419 Nov 26 '14 at 17:27
  • I would like to add that this method above (erasing bootcamp partition as FAT and then opening bootcamp assistant) worked absolutely perfectly, with minimal effort and in about 3 minutes. – xdavidliu Jun 25 '16 at 18:26
  • Sure, that's the "Quick fix" at the start of the answer :) – arya Jun 26 '16 at 16:56
22

Quick fix: Fake Bootcamp.

"I partitioned the free space (that OS X couldn't use) as MS-DOS, Bootcamp Assistant thought it was Windows, and was able to remove this MS-DOS partition and restore Mac OS to a single partition."

This is the easiest solution, so try that first.

No luck? Long fix:

In my case, I couldn't get Disk Utility to create the partition.

I tried using gpt to recreate the partition, but it wouldn't write to the GPT while any of the partitions were mounted. But since it's my boot partition we're talking about, the disk was in use, because one of the partitions (my boot partition!) is mounted. So we need to boot from not-this-disk, and unmount all the partitions on the disk, and then use gpt.

Internet Recovery

Boot to Internet Recovery (hold Cmd+Opt+R during startup), so that the disk will not be in use. If your machine is too old for Internet Recovery, you should be able to boot from another disk (not another partition) and get the same result. Note: in this case that the disk numbers (/dev/disk0) may be different for you.

Start Internet Recovery, and go to Utilities -> Terminal.

Internet Recovery terminal

-bash-3.2# gpt show /dev/disk0

gpt show my former bootcamp partition

This is the space I want to reclaim.

As a sanity check, take the size (second column), multiply it by 512, and divide by a billion. The result should match the size of your former Bootcamp partition in GB.

Example: 58593759 * 512 / 1,000,000,000 = 30 GB

Take the start position (first column), that's where we'll tell gpt to make the new partition, with

gpt add -b <start position> -t windows /dev/disk0

In my case, you can see that the start position is 431640960. You can and should select/Copy/Paste in your own Terminal to get this number copied correctly.

Example: -bash-3.2# gpt add -b 431640960 -t windows /dev/disk0

/dev/disk0s4 added

Finally!

If you got an error No such file or directory, read the next section, and then come back here and try again.

Assuming you got the disk added ok, reboot and use Disk Utility to erase the new partition as MS-DOS. Run Bootcamp assistant and choose Remove Windows 7.

Bootcamp has been removed and your disk has been restored to a single volume.

And all it took was my whole day.

unable to open device '/dev/disk0': No such file or directory

When you use the gpt add command, you might get the error

unable to open device '/dev/disk0': No such file or directory

This message is very confusing. We just read that device earlier with gpt show. This message really means "device is in use".

OS X Recovery may have mounted it, and you have to unmount it. Use the mount command to find your mounted partition and umount it.

-bash-3.2# mount

will produce a huge list of partitions:

/dev/disk2s3 on /
devfs on /dev
/dev/disk3 on /Volumes
/dev/disk4 on /private/var/tmp
/dev/disk5 on /private/var/run
/dev/disk6 on /System/Installation
/dev/disk7 on /private/var/db
/dev/disk8 on /private/var/folders
/dev/disk9 on /private/var/root/Library
/dev/disk10 on /Library/ColorSync/Profiles/Displays
/dev/disk11 on /Library/Preferences
/dev/disk12 on /Library/Preferences/SystemConfiguration
/dev/disk13 on /Library/Keychains
/dev/disk1 /Volumes/Macintosh HD  <--- unmount this /Volumes/<YourDisk>

-bash-3.2# umount /dev/disk1

It will periodically be remounted automatically, so try to hurry or you'll have to unmount it again.

  • Alternative [if rather facetious] solution. Don't put Bootcamp on your main drive in the first place. I put mine on a separate drive & never had to go through your apparent hell [for which you have my total sympathy & well done for figuring it all out] in ... maybe 8 years of tweaks, upgrades, etc. – Tetsujin Sep 14 '14 at 19:10
  • @Tetsujin: Even safer solution while we're in the neighborhood: Don't use Bootcamp at all. I'll be using VirtualBox from this point forward! – arya Sep 14 '14 at 22:54
  • Great post - if you want to add in how someone would back up their system as a step one here, that would be great. I edited it out of the question since it seems part of the solution and not the initial problem. – bmike Nov 26 '14 at 17:34
  • A few extra tips: While you are in "Recovery Mode" - also do a Repair Disk on the main OSX partition. I had a couple small issues that prevented bootcamp from completing the recovery (last step in the process). Some people reported that they had to turn off File Vault to finish this process. I ended up turning mine off too but I'm not sure if it was needed. – user104930 Dec 16 '14 at 3:15
  • 1
    Just saved me from a full reformat. Only minor difference was when doing gpt add got "Resource Busy" but simple enough to figure out to use same umount solution and then it added fine. In disk utility, don't use the "-" link but instead the "erase" by clicking on the newly created partition and renamed to BOOTCAMP, then the restore magically worked! – ldg Aug 2 '16 at 1:44

You must log in to answer this question.

protected by Community Jan 8 '15 at 2:58

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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