You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Repairing Boot Camp after creating new partition

I'm running OS X 10.8 and Windows 7 x64 Pro.


After properly setting up Boot Camp to dual-boot Windows on my Mac mini, I decided to test whether or not it was true that creating another partition (a data partition for OS X) would interfere with Boot Camp. Wikipedia claims it does interfere but without citing a source, whilst the Boot Camp documentation itself only specifies that the disk must be a single partition _prior_ to setup - there's no mention of whether the disk must be _kept_ that way afterwards.


I opened Disk Utility, reduced the size of my OS X parition from 420GB to 80GB, and created a new partition in the unallocated space. Here's how it looks now:

User uploaded file

When I attempted to proceed with the process, I did receive a warning that doing this (and I quote), "may" cause problems with Boot Camp. Seeing as it was inconclusive, I thought I'd give it a shot - nothing ventured…


Of course, it borked Boot Camp, otherwise I wouldn't be posting here. Whilst OS X boots just fine, the Boot Camp partition now no longer shows up in the Startup Manager, though it does in the Startup Disk prefPane. If I do attempt to boot into Boot Camp, I receive the following message on a black screen:

No bootable device --- insert boot disk and press any key

The advice given to someone who had this same problem was, "fix your damaged Boot Camp volume." But I'm at a loss as to how to do that.


So, anyone know how to proceed now so that I can keep my partitions as is, whilst fully restoring normal Boot Camp functionality?

Mac mini (Mid 2011), Mac OS X (10.7.4)

Posted on Jul 26, 2012 11:28 PM

Reply
1,534 replies

Feb 23, 2014 2:22 PM in response to Christopher Murphy

Christopher Murphy wrote:


bootrec / scanos and Windows Recovery Console can also be used to scan/fix the MBR.


Not applicable, there's nothing to fix. You're not understanding what I wrote. The internal disk, if it had Windows on it, probably still has boot code in its MBR boot strap region. That needs to be removed because on Macs only one disk can have BIOS boot code.

/ScanOs

This option scans all disks for installations that are compatible with Windows Vista or Windows 7. It also displays the entries that are currently not in the BCD store. Use this option when there are Windows Vista or Windows 7 installations that the Boot Manager menu does not list.


This is what I was suggesting. From the oft-referenced http://support.microsoft.com/kb/927392


Option key should also show various bootable disks.


I would also be curious about what fdisk would show on /dev/rdisk0.

Feb 23, 2014 3:00 PM in response to waffenschmiede

Remove the code from the disk's MBR with this command. Have backups and be certain you get it correct or it'll quickly (effectively) erase the drive.


sudo dd if=/dev/zero of=/dev/diskX bs=440 count=1


This will write zeros onto the first 440 bytes of LBA 0, to diskX, thus removing only the boot code, not the MBR partition map. Now, one small gotcha is that it might refuse to let you do this, suggesting "resource busy". If so, maybe enlarge the command text in TextEdit first, and then either print it out or copy it exactly, and then see if it'll work rebooted in single user mode (command-s at the startup chime). If that still doesn't work, then you'll need to do it from Recovery HD and find the hidden Terminal application in one of the drop down menus.


Warning, anytime you reboot, the designation of a disk can change. That is, this boot the drive is /dev/disk0 but if you boot single user mode or from Recovery HD, it might become /dev/disk1 or even /dev/disk10. So you need to make really sure you're using the above command with the right disk number. That's why I wrote it as diskX above instead of disk0. Use:



diskutil list



first to make sure.

Feb 26, 2014 2:15 PM in response to Scotch_Brawth

Hi everyone,


First off, thanks to everyone for their contributions to this post. I foolishly repartitioned my OS X drive and obliterated my MBR. This post helped me recover it. What I was trying to do was set up three partitions on my Mac - one for OS X Mavericks, one for Bootcamp (Windows 7 Professional) and one as a shared drive so I can access my documents, music, videos, and pictures from either OS. After reading several posts on here, I tried creating a hybrid MBR (using gdisk) with partitions 4 and 5 included, but the system won't let me. When I get to the step where it creates an entry for partition #4 (MBR hex code 07, no bootable flag), it skips creating the entry for partition #5 and goes straight to "unused partition space(s) found..." What am I doing wrong? I've pasted the info from my terminal below:


Last login: Wed Feb 26 13:53:08 on ttys000

DGH-LAPTOP:~ admin$ sudo gdisk /dev/disk0

Password:

GPT fdisk (gdisk) version 0.8.9


Warning: Devices opened with shared lock will not have their

partition table automatically reloaded!

Partition table scan:

MBR: hybrid

BSD: not present

APM: not present

GPT: present


Found valid GPT with hybrid MBR; using GPT.


Command (? for help): r


Recovery/transformation command (? for help): h


WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,

just hit the Enter key at the below prompt and your MBR partition table will

be untouched.


Type from one to three GPT partition numbers, separated by spaces, to be

added to the hybrid MBR, in sequence: 4 5

Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y


Creating entry for GPT partition #4 (MBR partition #2)

Enter an MBR hex code (default 07):

Set the bootable flag? (Y/N): y


NOTE: Here's where it deviates. Instead of saying "Creating entry for GPT partition #5..." (as I assume it should) it skips past that step every time. I tried listing the partitions as "5 4" instead of "4 5" and it did the opposite (created 5 and skipped 4). Am I doing something wrong?


Unused partition space(s) found. Use one to protect more partitions? (Y/N): n


Recovery/transformation command (? for help): o


Disk size is 977105060 sectors (465.9 GiB)

MBR disk identifier: 0xE8D38E1B

MBR partitions:


Number Boot Start Sector End Sector Status Code

1 1 388397927 primary 0xEE

2 * 388397928 587413503 primary 0x07


Recovery/transformation command (? for help): q


Here's some additional information from Terminal that may be useful:


Last login: Wed Feb 26 17:06:07 on ttys000

DGH-LAPTOP:~ admin$ sudo gpt -r -vv show disk0

Password:

gpt show: disk0: mediasize=500277790720; sectorsize=512; blocks=977105060

gpt show: disk0: Suspicious MBR at sector 0

gpt show: disk0: Pri GPT at sector 1

gpt show: disk0: Sec GPT at sector 977105059

start size index contents

0 1 MBR

1 1 Pri GPT header

2 32 Pri GPT table

34 6

40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640 386718744 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC

387128384 1269544 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC

388397928 199015576 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

587413504 389691523 5 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

977105027 32 Sec GPT table

977105059 1 Sec GPT header

DGH-LAPTOP:~ admin$ sudo fdisk /dev/disk0

Disk: /dev/disk0 geometry: 60821/255/63 [977105060 sectors]

Signature: 0xAA55

Starting Ending

#: id cyl hd sec - cyl hd sec [ start - size]

------------------------------------------------------------------------

1: EE 0 0 2 - 25 127 14 [ 1 - 409639] <Unknown ID>

2: AF 1023 254 63 - 1023 254 63 [ 409640 - 386718744] HFS+

3: AB 1023 254 63 - 1023 254 63 [ 387128384 - 1269544] Darwin Boot

4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused

DGH-LAPTOP:~ admin$ diskutil list

/dev/disk0

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *500.3 GB disk0

1: EFI EFI 209.7 MB disk0s1

2: Apple_HFS Macintosh HD 198.0 GB disk0s2

3: Apple_Boot Recovery HD 650.0 MB disk0s3

4: Microsoft Basic Data 101.9 GB disk0s4

5: Microsoft Basic Data 199.5 GB disk0s5

DGH-LAPTOP:~ admin$

Feb 26, 2014 2:31 PM in response to Number88

The interesting thing about that is that I created the partitions using "add a new partition" in gdisk (instead of through Disk Utility's partition tool) so I could specify a start and end sector number to prevent there from being unused space so the fact that I'm getting a message about unused space has me puzzled. That said, here's what happens when I choose "y":


Unused partition space(s) found. Use one to protect more partitions? (Y/N): y

Note: Default is 0xEE, but this may confuse Mac OS X.

Enter an MBR hex code (default EE):


Recovery/transformation command (? for help): o


Disk size is 977105060 sectors (465.9 GiB)

MBR disk identifier: 0xE8D38E1B

MBR partitions:


Number Boot Start Sector End Sector Status Code

1 1 388397927 primary 0xEE

2 388397928 587413503 primary 0x07

4 587413504 977105059 primary 0xEE


Recovery/transformation command (? for help):


I'm very much a newbie as far as MBRs are concerned so naturally I'm quite weary of confirming the changes with the "w" (write table to disk & exit) command to see what happens. But my guess is that because I'm seeing 1, 2, and 4 instead of just 1 and 2, that my shared partition will end up not being added to the hybrid MBR and therefore I won't see it in Windows. But I don't know for sure.

Feb 26, 2014 2:39 PM in response to DHughes01

This isn't something I've tried before. Changes like this will be over-written with subsequent OSX upgrades and other things too, rendering Windows unbootable again.

Having said that, in the example above you have accepted the default partition type EE for the last partition. Two partitions of type EE on the same disk is not a particularly good thing to have.

I might try entering "07" (without quotes) at that point then press enter. If it asks you if you want to make it bootable answer N.

Then you can write the changes to disk with a "w".

Feb 26, 2014 3:49 PM in response to Scotch_Brawth

Duly noted, but I can't bear the thought of having to lug around an external drive all the time, not to mention I have an SSD installed as an internal drive for speed purposes and I hate to lose some of that speed saving to a non-SSD. (That said, for safety purposes, I will be backing up my Winclone image and my regular files to a home network drive regularly.)


At one point I considered wiping out the recovery drive so that I could simply have 4 normal partitions without the need of a custom-configured MBR. But I don't like not having a built-in way to repair the Mac OS should something go haywire. My understanding is that four is the maximum number of partitions that an MBR can hold without having to tinker around with stuff the way I'm trying to do now.


I wonder if I could save the recovery drive as an image and make a bootable CD out of it, then set the computer up with just 4 partitions: the EFI partition, Mac OS X, Windows, and a shared partition. Hmm....

Feb 26, 2014 3:57 PM in response to DHughes01

I have done something similar in the past creating a USB using the OSX installer image rather than the recovery partition. That would need to be downloaded from Apple and subsequently installed on a USB (assuming your Mac can boot from a USB).

I think it may depend on how old your Mac is and what version of OSX it came with (but not 100% sure on that).

Feb 26, 2014 6:31 PM in response to DHughes01

When I get to the step where it creates an entry for partition #4 (MBR hex code 07, no bootable flag), it skips creating the entry for partition #5 and goes straight to "unused partition space(s) found..." What am I doing wrong?


Looks like a new bug in 0.8.9 because I can reproduce it. If I revert to 0.8.8 it works as expected. I've reported it to the developer.

Feb 26, 2014 6:37 PM in response to DHughes01

Also, 5+ partitions in the GPT means you can't have a GPT and MBR that are sync'd. This currently invites certain Apple utilities to "repair" them without notice, mainly this is Disk Utility but also includes the OS Installer. So far minor updates haven't caused this behavior, that I'm aware of, but even that could happen. The "repair" replaces the hybrid MBR with a protective MBR which renders the non-OS X operating system unbootable. So just make sure you're keeping backups - it's not like it should just vanish in normal use. But you'll always wonder.

Repairing Boot Camp after creating new partition

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.