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 7, 2013 10:03 AM in response to Scotch_Brawth

When I encrypted my MBP's SSD all I did was clone the OS X partition, boot into Recovery HD, re-format the OS X partition as HFS Encrypted, then clone my data back to the newly-encrypted partition—and it works just fine.


The last time I tried it was 10.7 and this method wasn't bootable. I like the idea, however, because the conversion method reads-encrypts-writes every sector, which thwarts dynamic wear leveling, and is not good for SSD performance. The SSD thinks every sector is in use. An SSD that supports TRIM, and the OS using TRIM after encrypting the volume, works around this, but many SSDs actually either don't support TRIM, or don't perform well when it's used. Officially TRIM is only supported with Apple SSDs, on OS X. Whereas the method you're referring to is better for any SSD.


whether that process would upset the delicate nature of the hybrid MBR.


Disk Utility does modify the hybrid MBR, but since the code isn't available to look at, it would require testing to know how it behaves. I would probably use gdisk to replace the existing hybrid MBR with a protective MBR. Then do what you need to in Disk Utility. Then go back to gdisk and create a new hybrid MBR. I trust Disk Utility next to zero at this point when it comes to this stuff.


cloning a single disk, partitions and all, such that the clone could be used in lieu of the original and work just as well, and in the same way, as the original? Or, would I have to individually clone the OS X, OS X data and Boot Camp partitions, set up the new disk with the appropriate partitions first, then clone the data to the appropriate partitions?


dd can be used to sector copy disk to disk, partition to partition, disk to file, partition to file, and the inverse of those. The filename extension is typically .bin but you can also use .iso even though it's technically not correct. If you do this with a partition to a file and make it .iso, it's mountable just like a DMG, but obviously it's read only. This is as exact a clone as you can get. File system doesn't matter (you can dd an NTFS source partition to a .bin file stored on JHFS+ for example).


Just realize that there is a volume, and there is a partition. They're not the same. The partition size is set in the partition table (the GPT), and the volume size is the size of the file system. Apple's utilities, even on the command line, tend to manage these two separate things at the same time. So if you dd a partition, you need to make a note of the exact size of that partition so that when you dd it back onto a disk partition, you've first set that partition to the *exact* same number of sectors. You can make a partition bigger than its original volume, but then you must resize the volume to fit. Making a partition smaller than a volume is a recipe for lots of problems.

Feb 7, 2013 10:09 AM in response to Christopher Murphy

Here is what comes out from Terminal:


Last login: Thu Feb 7 19:53:09 on console

dario-pc:~ darioganzetti$ diskutil resizevolume disk0s2 limits

For device disk0s2 Macintosh HD:

Current size: 550.0 GB (549999996928 Bytes)

Minimum size: 228.6 GB (228627828736 Bytes)

Maximum size: 550.0 GB (549999996928 Bytes)

dario-pc:~ darioganzetti$ diskutil list

/dev/disk0

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *750.2 GB disk0

1: EFI 209.7 MB disk0s1

2: Apple_HFS Macintosh HD 550.0 GB disk0s2

3: Apple_Boot Recovery HD 650.0 MB disk0s3

4: Microsoft Basic Data BOOTCAMP 92.3 GB disk0s4

/dev/disk1

#: TYPE NAME SIZE IDENTIFIER

0: FDisk_partition_scheme *500.1 GB disk1

1: Windows_FAT_32 VERBATIM HD 500.1 GB disk1s1


Thanks a lot for your help.

Feb 7, 2013 10:10 AM in response to Scotch_Brawth

BTW, sector copies clone *everything* down to the sector. That means the file system, encryption (or not), etc. So any dd clone is exact. If you dd a partition containing a Core Storage volume that's encrypted, that's what's put into the .bin file. If you dd that file to another partition, it becomes an encrypted Core Storage volume.


What dd does NOT do, is, it doesn't change the partition type GUID to match the contents. You have to use gdisk to do that. From the main menu, that's t for type, and you can use L to get a listing of partition type codes.

Feb 7, 2013 10:16 AM in response to ganze

What an adorable utility, that lets you create free space, and then won't let you re-absorb that free space. So yeah, you're stuck. You either have to back everything up, blow away the entire hard drive reverting back to a single partition, reinstall OS X and Window and restore from backup; or you have to get fancy.


The short, non-detailed version (I'm leaving out steps), is you can either blow away Recovery HD also, and then you'll be able to reabsorb the space to OS X. Or you can make a partition for Recovery HD just in front of the current Windows volume, and move it, then reabsorb the free space between it and OS X. But it can only be done with multiple steps using gdisk, dd, and diskutil.

Feb 7, 2013 10:20 AM in response to Christopher Murphy

ok, I'm tempted by the second instead of the first, since with OSX it's relatively easy to back up everything and the put it back to place, but for windows it get a little more painful. Meanwhile I can think about it and take it like that for the moment and wait for a free time to do the clean up job. Since I have fans revving all the time on OSX, I would like to make a clean install and copy the essentials office files back to OSX, and reinstall all the apps.

Feb 7, 2013 11:32 AM in response to ganze

So what you're going to do is use gdisk to make a new partition and then dd the Recovery HD to the new partition. Then you'll delete the original Recovery HD partition. Then you'll be able to resize the OS X partition consuming all the free space. And things will be back to normal.


Use gdisk -l to find out the start/end sectors for the current Recovery HD, find out how many sectors that is, and subtract that value from the start sector value for Windows/BootCamp. Create a new partition with this value as the First sector. You might get a message that the requested sector was changed in order to align on 16-sector boundaries, it should have rounded this down, which is fine but note that "to" value, add the sector length of the original Recovery HD (end sector value minus start sector value) and enter this as the Last sector for this new partition. When asked for the type code, it needs to be AB00. Write out the partition, and reboot OS X.


diskutil list


Your original Recovery HD I'm guessing is disk0s3, and the new one is disk0s4, but you have to be certain. The two will be ~ 620MB in size. The dd command is:


dd if=/dev/disk0sX of=/dev/disk0sY


X=slice/partition number for the original Recovery HD

Y=slice/partition number for the new one


Once that's done you can test it by rebooting with option key. You'll have two Recover HD options, and you can try them both to be sure.


Next, gdisk again, and delete the original Recovery HD partition.


Next, test the resize with

diskutil resizevolume disk0s2 limits


I *think* when you're ready you can use R instead of limits to absorb all remaining free space.


gdisk again, and use command 's' to resort the partition table, so everything is in order. Then go to the recovery menu, make a new hybrid MBR, add partitions 2 3 4, make 4 only bootable. Accept the default hex codes with just a return. And then write out the new maps.

Feb 11, 2013 8:40 AM in response to Christopher Murphy

Hi Chris,


So I've posted in this thread a long time ago and you helped me out then in getting my system to tri-boot with OSX, Win7 and Win8. So I tried to turn that system back to a dual-boot, Bootcamp-like setup. I managed to get the thing to boot, but I believe I messed up the delicate GUID/MBR setup from before. I can boot to both partitions, and everything works fine except the windows machine can't see the OSX partition. OSX can see windows but not the other way around. I was wondering if you could help guide me in the right direction to repair this.

Feb 11, 2013 11:38 AM in response to nikdaquik

For Windows to see OS X, the OS X partition must be in the hybrid MBR. So chances are what you need to do is just make a new hybrid MBR with gdisk, adding partitions 2 3 4, making 4 only bootable. That's the conventional layout for a dual boot Mac.


I don't know that I want to know how you got rid of Windows 8 though, because if you used a Windows tool to resize Windows 7 to take over the space from Windows 8, this is very bad to do as it causes corruption of the GPT. Hopefully you are keeping current backups!

Feb 11, 2013 2:13 PM in response to Christopher Murphy

ok, i'll try editing the MBR. As for the resize, yeah i made that mistake...it wasn't fun...it made all parties involved very sad but somehow I managed to create a semi-stable MBR/GPT.


I believe that my current MBR has 5 parts actually, with two windows segments. However, I merged those two partitions so i don't know how that still lets me boot. This is the output from gdisk:


Disk /dev/disk0: 976773168 sectors, 465.8 GiB

Logical sector size: 512 bytes

Disk identifier (GUID): E2BACA2E-849F-4BCF-B5FA-A79C88CFFA86

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 976773134

Partitions will be aligned on 8-sector boundaries

Total free space is 1638 sectors (819.0 KiB)



Number Start (sector) End (sector) Size Code Name

1 40 409639 200.0 MiB EF00 EFI System Partition

2 409640 586347135 279.4 GiB AF00 Untitled

3 586347136 587616671 619.9 MiB AB00 Recovery HD

4 587618304 683321343 45.6 GiB 0700 WIN8

5 683321344 976773134 139.9 GiB 0700 Microsoft basic data


and diskutil:

/dev/disk0

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *500.1 GB disk0

1: EFI 209.7 MB disk0s1

2: Apple_HFS Macintosh HD 300.0 GB disk0s2

3: Apple_Boot Recovery HD 650.0 MB disk0s3

4: Microsoft Basic Data WIN8 49.0 GB disk0s4

5: Microsoft Basic Data 150.2 GB disk0s5


I couldn't tell you how this works exactly, but it does so I'm grateful. just trying to repair the damage so one can see the other now.

Feb 11, 2013 2:21 PM in response to nikdaquik

Don't edit the MBR. Create a new hybrid MBR from within gdisk.


Anyway, the GPT you've provided here isn't how you described it earlier. This still has two Windows partitions on it for a total of five GPT partitions. You can't do what you want to do with five partitions, because the MBR can only hold four partitions. So you have to get rid of one of the Windows partitions or the Recovery HD partition, in order to create a four partition MBR that contains both OS X and both Windows partitions.


You *can* hypothetically leave it as a five partition GPT, and create a four partition MBR by simply not adding Recovery HD to the MBR; so you'd add partitions 2 4 5 and make either 4 or 5 bootable (I have no idea which one is bootable). But this exposes the Recovery HD as free space to Windows, and so it's unprotected. I'd sooner get rid of it, than create a hybrid MBR of this kind.

Feb 11, 2013 2:35 PM in response to Christopher Murphy

Ok, I just created a fresh MBR from gdisk. As for the GPT I posted, I honestly have not a clue how that has gotten the job done. In reality, I only have those four partitions, I fused the two windows ones using a utility within windows (very bad idea, like you said). Somehow in all my attempts to make windows bootable, I created an MBR with only 2 entries (OS X, including EFI and recovery, and Windows) and I suppose I never touched the GPT...


..So, I updated the GPT using gdisk to only have 4 partitions (I merged the two windows partitions) and then made a fresh MBR to reflect that...now the big question is: will rebooting this bad boy turn my computer into a giant paperweight or not.

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.