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

Nov 18, 2012 12:13 PM in response to Marionumber1

That layout isn't ideal for hybrid MBR because the #1 MBR entry, 0xEE, to protect partitions you don't want exposed to MBR aware applications, can only include sectors for s1, s2 and s3. Then MBR #2 exposes s4 for Windows. So now what? How do you protect s5, s6, s7 with only two MBR entries left? Well you can't.


So Windows should be s7. And if you want to read OS X you'd make it s6. That way you protect GPT partitions s1 through s5 as a single 0xEE entry, and then add s6 OS X to MBR #2. And add s7 Windows to MBR 3. That way all sectors have assignment in the MBR.


Sectors not assigned to something in the MBR appear as free space to applications that only understand MBR, which obviously is risking data on those sectors. So you just have to be really aware of what your tools do if you're not going to do this conservatively.

Nov 18, 2012 12:58 PM in response to Christopher Murphy

So my expected GPT disk layout is this?


disk0s1: EFI System Partition

disk0s2: Lion Recovery Partition

disk0s3: BIOS Boot Partition

disk0s4: Ubuntu

disk0s5: Swap

disk0s6: Mac OS X Lion

disk0s7: Windows 7


And my expected MBR layout is this?


1. EFI Protective Partition

2. Mac OS X

3. Windows 7


Is it possible to change my partitions like this in Disk Utility?

Nov 18, 2012 1:35 PM in response to Marionumber1

That's ideal. But Apple doesn't let you choose where Recovery HD goes in relation to OS X. To do what I'm suggesting requires some surgery to make happen, and I'm only familiar with command line tools to make that happen. The GUI tools simply don't allow it.


1.

You could do a rough partition layout with Disk Utility:

GUI partition 1 should be sized as Lion Recovery + BIOS Boot + Ubuntu + Swap. You can get the size of a current Lion Recovery HD using 'diskutil list'. (This will actually be GPT partition 2, because GPT 1 is EFI System, which is hidden in the GUI.)


GUI Partition 2 will be OS X.


GUI Partition 3 will be Windows.


2.

Next install OS X which will split GUI partition 2 into two partitions: OS X and Recovery HD.


3.

Find the exact sector count for the Recover HD partition. Use gdisk to delete GPT partition 2 so that it's all free space, then create new partitions. The order doesn't matter but it's easier to let Ubuntu be last since the others are fixed sizes and Ubuntu can float in size. Lion Recovery should be the same number of sectors as the one created by the installer, BIOS Boot should be 1MB, and Swap should be system RAM size + 2GB. So create those partitions in gdisk and if necessary use the resort option from the main menu so they're all in order. When you create those partitions, you specify their partition type codes which will inform the firmware and bootloaders what they are. i.e. BIOS Boot is EF02, Swap is 8200, Recovery HD is AB00, Windows is 0700.


4.

Next you'll use dd to sector copy the current installer created Lion Recovery HD to it's new location. e.g.


dd if=/dev/disk0s7 of=/dev/disk0s2 bs=256k


The bs=256k just makes it go faster by using a larger block size, otherwise it's optional. Do make sure that you get the slice number correct because the destination, the one defined by of=, will have data overwritten, and you won't be asked for permission.


5.

Delete GPT 7 and 8 (original Recovery HD and Windows), and make a new partition GPT 7 which uses up all remaining free space at the end of the disk (effectively combines Recovery HD and Windows partitions).


6.

Use gdisk to create a new hybrid MBR adding OS X and Windows only to the MBR.


7.

Install Windows.


8.

Install Ubuntu.


9.

Ubuntu almost certainly uses parted, but I'm not sure if they look at the hybrid MBR and restore it after installation? Parted by default destroys hybrid MBRs. So just know that you may have to recreate the hybrid MBR using gdisk. Even if the system works, you should check and make sure the hybrid MBR is created correctly.

Nov 18, 2012 2:39 PM in response to Christopher Murphy

I see your reply on my email, but it doesn't appear here in the topic. So I guess I'll reply to this post.


Anyway, I have two questions about that reply.


1. You said that parted will destroy the hybrid MBR. Would I be able to change the GPT partition table to the disk layout that I posted using parted or gparted, then create the hybrid MBR that I posted?


2. If I can't do that, I guess that I would need to use your layout. Would I be able to use dd to back up my Windows 7 and Mac OS X partitions instead of reinstalling them?

Nov 18, 2012 7:07 PM in response to Christopher Murphy

@Marionumber1

1. The question is confusing because you've posted more than one layout and I don't know which one you're talking about. But in any case parted/gparted can create any layout you want, but neither are capable of creating hybrid MBRs. You need a different tool for that. I use gdisk to modify GPTs and create hybrid MBRs from them.


2. Yes but you need a disk at least twice the size of the partition you're duplicating if it's a same disk partition copy; and the file system can't be mounted so you'll have to boot from a LiveCD or something to do such copying.


I see my post but not yours. I wonder if this thread is broken. For months when I click on the link in email notifications, it takes me to a page in teh middle of the thread, not the beginning or the end. So I wonder if the thread is breaking the forum's ability to resolve it. Kindof a long thread.

Nov 19, 2012 3:55 AM in response to Christopher Murphy

My expected GPT disk layout is this:


disk0s1: EFI System Partition

disk0s2: Lion Recovery Partition

disk0s3: BIOS Boot Partition

disk0s4: Ubuntu

disk0s5: Swap

disk0s6: Mac OS X Lion

disk0s7: Windows 7


And my expected MBR layout is this:


1. EFI Protective Partition

2. Mac OS X

3. Windows 7


If this partition scheme will work, then here's my plan.


1. Install rEFIt on my Mac.

2. Use gparted to create this partition layout, turning my hybrid MBR into a protective MBR.

3. Install Ubuntu 12.04 on its GPT partition.

4. Recreate the hybrid MBR with gdisk and add the Mac and Windows partitions.

Nov 22, 2012 10:21 AM in response to Christopher Murphy

Hi,


I have a similar issue, that since Mountain Lion, I cannot boot from bootcamp anymore, but the data is still there.


The results are:


gpt show: disk0: mediasize=250059350016; sectorsize=512; blocks=488397168

gpt show: disk0: Suspicious MBR at sector 0

gpt show: disk0: Pri GPT at sector 1

gpt show: disk0: Sec GPT at sector 488397167

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 275556528 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC

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

277235712 211161088 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

488396800 335

488397135 32 Sec GPT table

488397167 1 Sec GPT header



and:


Disk: /dev/disk0geometry: 30401/255/63 [488397168 sectors]

Signature: 0xAA55

Starting Ending

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

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

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

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

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

*4: 07 1023 254 63 - 1023 254 63 [ 277235712 - 211161088] HPFS/QNX/AUX



Any idea why this doesn't work anymore?

Can I use Christopher's procedure, just using partition 4 instead of 5?

r <enter> go to the recovery & transformation menu

h <enter> create a new hybrid MBR

5 <enter> add partion 5 to the MBR

<enter> accept the default MBR hex code of 07

y <enter> set the bootable flag

n <enter> do not protect more partitions

o < enter> print (display) the MBR


You should have two entries. One type EE, one 07, with the 07 entry marked with * under Boot. If you don't, report back. If you do, write out the update partition information, and hope a power failure doesn't occur for the next few seconds...


Many thanks for your help!!


Matthias


w <enter> write partition table to disk

Nov 22, 2012 11:56 AM in response to Christopher Murphy

Finally, just to make sure, is this the command to create my hybrid MBR?


disk0s1: EFI System Partition

disk0s2: Lion Recovery Partition

disk0s3: BIOS Boot Partition

disk0s4: Ubuntu

disk0s5: Swap

disk0s6: Mac OS X Lion

disk0s7: Windows 7


1. EFI Protective Partition

2. Mac OS X

3. Windows 7


r <enter> go to the recovery & transformation menu

h <enter> create a new hybrid MBR

6 7 <enter> add partions 6 and 7 to the MBR

<enter> accept the default MBR hex code of af

<enter> accept the default MBR hex code of 7

y <enter> set the bootable flag

n <enter> do not protect more partitions

o < enter> print (display) the MBR

Nov 22, 2012 2:36 PM in response to Christopher Murphy

Okay, I'm going to do this soon. Just to make sure, here are all the steps I will follow.


disk0s1: EFI System Partition

disk0s2: Lion Recovery Partition

disk0s3: BIOS Boot Partition

disk0s4: Ubuntu

disk0s5: Swap

disk0s6: Mac OS X Lion

disk0s7: Windows 7


1. EFI Protective Partition

2. Mac OS X

3. Windows 7


1. Install rEFIt on my Mac.

2. Use gparted to create this partition layout, turning my hybrid MBR into a protective MBR.

3. Install Ubuntu 12.04 on its GPT partition. During the install process, I'll install GRUB2 on the BIOS Boot Partition.

4. Recreate the hybrid MBR with gdisk and add the Mac and Windows partitions.


r <enter> go to the recovery & transformation menu

h <enter> create a new hybrid MBR

6 7 <enter> add partions 6 and 7 to the MBR

<enter> accept the default MBR hex code of af

<enter> accept the default MBR hex code of 7

n <enter> do not set the bootable flag on the Mac partition

y <enter> set the bootable flag on the Windows partition

n <enter> do not protect more partitions

o < enter> print (display) the MBR


After this process, I should have Windows, Mac OS X, and Ubuntu installed. The Mac and Windows partitions will be inside the hybrid MBR, with the Windows partition set as the active partition. GRUB2 will be installed on the BIOS Boot Partition, and it will boot the Ubuntu partition. Ubuntu will use disk0s5 as its swap partition.


Also, all of these operating systems will be displayed in the rEFIt menu, along with the Lion Recovery Partition.

Nov 22, 2012 2:57 PM in response to Marionumber1

Umm, your steps don't really make sense to me.


a. In Step 1 you're installing rEFIt, but then you're repartitioning on step 2 which will remove it.

b. rEFIt is no longer maintained, rEFInd is current.

c. You do not install GRUB2 to any partition, you install it onto a whole disk, the GRUB2 installer will automatically find BIOS Boot.

d. You have a number of missing steps to get the GPT partition layout as you describe, as the OS X installer will *always* install Recovery HD immediately after the OS X partition.

e. You're better off with Ubuntu as s5 because it doesn't need to have a fixed size, whereas the Recovery HD, BIOS Boot, and swap partitions are fixed size; but I've already mentioned this.

f. Your step 4 is conceptually correct, but the individual commands aren't in the correct order. gdisk will ask for each partition (in order) what partition type and the boot flag state.


Also, you kinda have to sort out if Ubuntu is going to be installed UEFI or BIOS, because this matters whether or not you even need BIOS Boot.

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.