Scotch_Brawth

Q: 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:

/___sbsstatic___/migration-images/190/19047693-1.png

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

Close

Q: Repairing Boot Camp after creating new partition

  • All replies
  • Helpful answers

first Previous Page 34 of 102 last Next
  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Feb 7, 2013 10:10 AM in response to Scotch_Brawth
    Level 3 (555 points)
    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.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Feb 7, 2013 10:16 AM in response to ganze
    Level 3 (555 points)
    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.

  • by ganze,

    ganze ganze Feb 7, 2013 10:20 AM in response to Christopher Murphy
    Level 1 (0 points)
    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.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Feb 7, 2013 11:32 AM in response to ganze
    Level 3 (555 points)
    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.

  • by nikdaquik,

    nikdaquik nikdaquik Feb 11, 2013 8:40 AM in response to Christopher Murphy
    Level 1 (0 points)
    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.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Feb 11, 2013 11:38 AM in response to nikdaquik
    Level 3 (555 points)
    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!

  • by oly va ha,

    oly va ha oly va ha Feb 11, 2013 11:54 AM in response to Christopher Murphy
    Level 1 (36 points)
    Feb 11, 2013 11:54 AM in response to Christopher Murphy

    my problem is similar but not the same...ive been searching google and here since friday to no avail...could you take a look at my post and maybe point out something it looks like you're very good with these issues?

     

    https://discussions.apple.com/thread/4796985 sorry for trolling but i dont how else to contact you

  • by nikdaquik,

    nikdaquik nikdaquik Feb 11, 2013 2:13 PM in response to Christopher Murphy
    Level 1 (0 points)
    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.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Feb 11, 2013 2:21 PM in response to nikdaquik
    Level 3 (555 points)
    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.

  • by nikdaquik,

    nikdaquik nikdaquik Feb 11, 2013 2:35 PM in response to Christopher Murphy
    Level 1 (0 points)
    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.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Feb 11, 2013 2:42 PM in response to nikdaquik
    Level 3 (555 points)
    Feb 11, 2013 2:42 PM in response to nikdaquik

    Probably. Because that Windows only utility would have only updated the MBR, which you just nuked with gdisk when you created a new hybrid MBR. You didn't tell me until now that you used a Windows utility to do the resizing, or I wouldn't have told you to create a new hybrid MBR.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Feb 11, 2013 2:45 PM in response to nikdaquik
    Level 3 (555 points)
    Feb 11, 2013 2:45 PM in response to nikdaquik

    I think that Windows volume is SOL unless you have a copy of the MBR reported from fdisk, before it was replaced by gdisk.

     

    Whatever you do, don't let chkdsk try to repair the NTFS volume.

     

    What is the result from

    sudo fdisk /dev/disk0

  • by nikdaquik,

    nikdaquik nikdaquik Feb 11, 2013 2:54 PM in response to Christopher Murphy
    Level 1 (0 points)
    Feb 11, 2013 2:54 PM in response to Christopher Murphy

    Ok, here's the output from fdisk:

     

    Disk: /dev/disk0geometry: 60801/255/63 [976773168 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   25 127  15 - 1023 254  63 [    409640 -  585937496] HFS+       

    3: AB 1023 254  63 - 1023 254  63 [ 586347136 -    1269536] Darwin Boot

    *4: 07 1023 254  63 - 1023 254  63 [ 587618304 -  389154831] HPFS/QNX/AUX

     

    and the GPT 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       976773134   185.6 GiB   0700  Microsoft basic data

     

    and finally the MBR from gdisk:

     

    Disk size is 976773168 sectors (465.8 GiB)

    MBR disk identifier: 0xBBC11FA9

    MBR partitions:

     

     

    Number  Boot  Start Sector   End Sector   Status      Code

       1                     1       409639   primary     0xEE

       2                409640    586347135   primary     0xAF

       3             586347136    587616671   primary     0xAB

       4      *      587618304    976773134   primary     0x07

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Feb 11, 2013 3:34 PM in response to nikdaquik
    Level 3 (555 points)
    Feb 11, 2013 3:34 PM in response to nikdaquik

    I don't know how to help you when this sort of thing happens:

     

     

    3:15pm

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

       4       587618304       683321343   45.6 GiB    0700  WIN8

       5       683321344       976773134   139.9 GiB   0700  Microsoft basic data

     

    45 minutes later

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

       4       587618304       976773134   185.6 GiB   0700  Microsoft basic data

     

    Your GPT has changed inside of 45 minutes. So I don't know what you did, or how you got here, and I can't tell you a thing about whether the state of your partition schemes will work or not.

  • by nikdaquik,

    nikdaquik nikdaquik Feb 11, 2013 4:05 PM in response to Christopher Murphy
    Level 1 (0 points)
    Feb 11, 2013 4:05 PM in response to Christopher Murphy

    Ok, sorry I've been jumping around alot with the steps I took. I took your suggestion to blow away the MBR and create a fresh one. However, I couldn't figure out how to merge the two partitions in the GPT (4 and 5) which were "left over" after I merged my two windows partitions into one using a windows utility.  So I blew the entire GPT away and made a new one using gdisk taking care to keep the exact same sector #s as the original (and merging 4 and 5 into one new partition to reflect the one Windows partition).  That's how the GPT changed and I then blew away the MBR and created a fresh one based on that new GPT with only 4 entries.  I really jumped the gun on a few of these steps, but does that GPT/MBR setup look like it'll be stable?

first Previous Page 34 of 102 last Next