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

Jan 23, 2013 6:04 PM in response to maghikal

Not sure. But you can use the dd + hexdump command on both disks and see if only one of them has bootloader code in that first sector. Only one disk should. If both disks have boot loader code, that might cause confusion becase Apple's CSM-BIOS is kinda dumb with a one track mind. It only expects to find and boot one Windows system, and isn't configurable like a real BIOS where you can choose what disk or partition to boot from.

Jan 23, 2013 6:47 PM in response to Christopher Murphy

Thanks for the heads up about the instability of identity of disks 0 and 1.


$ sudo fdisk /dev/disk0

Password:

Disk: /dev/disk0 geometry: 14593/255/63 [234441648 sectors]

Signature: 0xAA55

Starting Ending

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

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

1: EE 1023 254 63 - 1023 254 63 [ 1 - 234441647] <Unknown ID>

2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused

3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused

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

$


So, I should reboot, and then verify which disk is 0 and which is 1, then use gdisk to "create a new hybrid MBR on disk1."


That things be clear, is it my goal, after I study the menus of gdisk and restudy this long thread, to change the Bootcamp slice that is now disk1s5 per my first post so that it becomes "a new hybrid MBR on disk1?" That is to say, do I seek to change the characteristics of a thing that now exists? If it matters, this drive is on my MBP 7,1, OS X 10.8.2 (12C60)

Jan 23, 2013 7:13 PM in response to autnagrag

I've been reading the man pages for GDISK (8) at http://www.rodsbooks.com/gdisk/gdisk.html


I'm a bit daunted. I especially don't see how to apply what you suggest, and I don't understand how I access the three different menus of gdisk that are detailed there. I'm going to leave work & go home, entailing a reboot, and see what is up here when I do that. Also I'll check diskutil list after booting.

Jan 23, 2013 7:28 PM in response to autnagrag

diskutil list

sudo gdisk /dev/diskX


Replace X with the number for the whole disk that contains the Windows partition. Once you hit return, you will be in gdisk, in interactive mode. Use ? <enter> to display the main menu. You're after the recover/transformation menu, so that's r <enter>. Again use ? to display the options in this menu, you'll find the option to create a new hybrid MBR is h, and which point you'll be asked to input the information relevant to your disk. For those with 4 or fewer partitions, add all except partition 1. It's trickier when you have 5 or more partitions. Everyone should add EFI GPT to the first MBR entry (that's a y then enter). Once you're done that it asks for each partition you're adding what hex code to use, just enter the default, gdisk grabs the right code from the GPT; and asks whether it should be flagged bootable or not. Only the Windows partition should be flagged bootable.


When you're back at the prompt "Recovery/transformation command (? for help):" you can type p <enter> and o <enter> which will display the GPT and the new hybrid MBR. This is all in memory, it's not yet commited to disk so you can post those two things and just leave gdisk waiting in the background (hide Terminal if you want). When you're ready to write it out, w <enter> and then reboot after gdisk quits.

Jan 24, 2013 7:41 AM in response to Christopher Murphy

Thank you for drawing my attention to the apparent drive identity change. After reboot, my former disk0 is now disk1.


Since I do not want or need the Recovery HD partition anyway, I was considering


$ diskutil mergePartitions JHFS+ "MtnLion1" disk1s2 disk1s3


Then I would only have 4 partitions. Would you advise me to do that using diskutil, or to get rid of the offender in the process of using gdisk as you detail so clearly? If I understand you, when I am adding partitions to the about to be created new MBR hybrid, I would simply omit addition of the Recovery HD partition, which is now at


disk0s3


?

Jan 24, 2013 7:41 AM in response to Christopher Murphy

I backed up the drive to a network drive so I'm just now getting started. I followed the directions but didn't get the EE or 07 default HEX code that you stated in the first set of instructions on the first page of this thread. Instead I got this:


User uploaded file

Not wantng to bork it even worse I decided to let it sit until confirmation from you that its ok to proceed.

Jan 24, 2013 10:48 AM in response to autnagrag

Actually it's a good point that you can use diskutil mergepartitions to do this. Just make sure you have a backup.


The man page makes it clear that:


All data on merged partitions other than the first will be lost.

So make really sure that the first partition is the OS X partition you want to keep.


Data on the first partition will be lost as well if the force argument is given.

So don't use force.


However, realize that this merge will only grow the OS X partition into the Recovery HD partition. You have much, much more free space after the Recovery HD that this command will not recapture. For that you'll need to use diskutil resizevolume after you've mergedpartitions.

Jan 24, 2013 10:52 AM in response to Gatormac2112

That 2nd partition is your OS X partition. The hex code is AF. So just accept the default. The next question about it will be whether to make it bootable, and the answer is no.


The following partition, #3, is your Recovery HD partition, the hex code is AB, you should accept that as default, and also do not make it bootable.


The last partition, #4, is Windows, accept the 07 default, do make this one bootable.


It's not strictly necessary to add OS X and Recovery HD partitions to the hybrid MBR. However I have some reason to believe that unsync'd hybrid MBRs and GPTs is causing some Apple utility to try to fix it, which can subsequently cause data loss. I haven't figured that part out at all because I have never seen a before MBR/GPT just prior to an OS upgrade that goes badly. So whenever possible I recommend people mimic Apple's version of a hybrid MBR, which is what I'm doing in this case.

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.