taibanl

Q: Fixing missing Bootcamp partition after Mavericks rewrote wrong GPT

Screen Shot 2013-11-14 at 3.56.59 PM.pngPreviously resized my boot camp partition (manually)

 

Installed Mavericks

 

Boot Camp disappeared

 

Disk0s4 is visible in Disk utility but reflects the OLD disk size (pre-resize) and additional space (available for OSX expansion) now appears in its place

 

[REDACTED] sudo gpt -r -vv show disk0

 

WARNING: Improper use of the sudo command could lead to data loss

or the deletion of important system files. Please double-check your

typing when using sudo. Type "man sudo" for more information.

 

To proceed, enter your password, or type Ctrl-C to abort.

 

Password:

gpt show: disk0: mediasize=240057409536; sectorsize=512; blocks=468862128

gpt show: disk0: Suspicious MBR at sector 0

gpt show: disk0: Pri GPT at sector 1

gpt show: disk0: Sec GPT at sector 468862127

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

  312909640    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC

  314179176   76558744       

  390737920   78123008      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

  468860928       1167       

  468862095         32         Sec GPT table

  468862127          1         Sec GPT header

[REDACTED] sudo fdisk /dev/disk0

Disk: /dev/disk0          geometry: 29185/255/63 [468862128 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 -  312500000] HFS+      

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

4: 0C 1023 254  63 - 1023 254  63 [ 390737920 -   78123008] Win95 FAT32L

[REDACTED ]

MacBook, OS X Mavericks (10.9)

Posted on Nov 29, 2013 6:04 PM

Close

Q: Fixing missing Bootcamp partition after Mavericks rewrote wrong GPT

  • All replies
  • Helpful answers

first Previous Page 3 of 4 last Next
  • by Loner T,

    Loner T Loner T Dec 7, 2013 7:15 AM in response to andsosa
    Level 7 (24,202 points)
    Safari
    Dec 7, 2013 7:15 AM in response to andsosa

    As long as Windows does not want to repair any disk partition related stuff, a repair/windows update should be fine.

     

    If you are starting over, the following may not matter, and you have a USB stick to boot/mount the machine anyway.

     

    In your fdisk output, this (the Recovery HD) is missing. (This is your GPT 3 or GPT 4 and can be found with Testdisk).

     

    587030720   588300263    ab00

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Dec 7, 2013 11:14 AM in response to andsosa
    Level 3 (555 points)
    Dec 7, 2013 11:14 AM in response to andsosa

    It should be OK to run Windows startup repair. Because OS X Finder mounts the Windows volume read only, that's a bit safer, so I'd sooner do that and get at least the most important data backedup before repairing Windows.

  • by taibanl,

    taibanl taibanl Jan 29, 2014 10:42 PM in response to Christopher Murphy
    Level 1 (0 points)
    Jan 29, 2014 10:42 PM in response to Christopher Murphy

    You sir, are nothing short of Amazing:

     

    I had trouble getting Gdisk installed as root, as  Mavericks seemed to not want to allow it to install where it wanted to.  Ultimately got it installed on usb disk, even though it didnt want me to install it there.

     

    I followed your steps one at a time slowly - knowing not what I was doing...had to search some of the submenus but found all the commands you referenced.

     

    Windows gave me a BSOD after its first boot but CHKDSK ran on 2nd boot and seems to have fixed itselfScreen Shot 2014-01-30 at 12.41.48 AM.jpg.

     

    So - parting question....did these steps leave my GPT and Hybrid MBR in a matching configuration?

  • by boswan,

    boswan boswan Mar 12, 2014 6:04 PM in response to Christopher Murphy
    Level 1 (0 points)
    Mar 12, 2014 6:04 PM in response to Christopher Murphy

    In one of your posts you mention using a VM instead of bootcamp and dual booting.  What are the downsides of using a VM?  Will both OS X and Windows run with less resources (RAM is my main concern).

  • by boswan,

    boswan boswan Mar 12, 2014 7:59 PM in response to boswan
    Level 1 (0 points)
    Mar 12, 2014 7:59 PM in response to boswan

    My disk seems to be a little different.  No Darwin Boot.

     

    sudo fdisk /dev/disk0

     

    Disk: /dev/disk0          geometry: 60801/255/63 [976773168 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 -  585937496] HFS+       

    3: 0C 1023 254  63 - 1023 254  63 [ 898164736 -   78608384] Win95 FAT32L

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

     

    sudo gpt -r -vv show /dev/rdisk0

     

     

    gpt show: /dev/rdisk0: mediasize=500107862016; sectorsize=512; blocks=976773168

    gpt show: /dev/rdisk0: Suspicious MBR at sector 0

    gpt show: /dev/rdisk0: Pri GPT at sector 1

    gpt show: /dev/rdisk0: Sec GPT at sector 976773167

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

      586347136  311817600        

      898164736   78608384      3  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

      976773120         15        

      976773135         32         Sec GPT table

      976773167          1         Sec GPT header

     

    Do I need to add a new partition? What start sector would I use? 586347136?  And what size? 311817600?  Or do I need to use testdisk to get that information? If so, what options to that command? I think partition is really the Recovery HD.

     

    Any help is greatly appreciated!

  • by Loner T,

    Loner T Loner T Mar 12, 2014 8:01 PM in response to boswan
    Level 7 (24,202 points)
    Safari
    Mar 12, 2014 8:01 PM in response to boswan

    VMs have no access to true hardware but can do some limited driver stuff, but can run Guest OS (Windows) and Host OS (OS X) simultaneously. VMs usually are heavy on batteries and memory, but can avoid the specific issue of Bootcamp implementation on OS X (MBR and CSM-BIOS vs UEFI).

     

    VM engines can let you boot bootcamp partition as a VM, which can be an appealing solution. Moving VMs to newer HW is easier than moving Bootcamp. VM engines can let you migrate between different engines (for example, VirtualBox to Fusion, or back).

     

    It depends on what you want to achieve with either approach.

  • by Loner T,

    Loner T Loner T Mar 12, 2014 8:07 PM in response to boswan
    Level 7 (24,202 points)
    Safari
    Mar 12, 2014 8:07 PM in response to boswan

    You do not have Windows bootable. fdisk entry #3 should be id 07 and flagged as bootable. (See man fdisk and look at option -e). Did your Bootcamp installation ever work?

     

    Typically, you should have 4 partitions in MBR.

     

    What events caused this state?

  • by boswan,

    boswan boswan Mar 12, 2014 8:45 PM in response to Loner T
    Level 1 (0 points)
    Mar 12, 2014 8:45 PM in response to Loner T

    Created bootcamp. Later resized the OS X and bootcamp partitions. Everything was working fine up to this point. Installed Maverics. Restored 10.8.5 from Time Machine backup.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Mar 12, 2014 8:45 PM in response to boswan
    Level 3 (555 points)
    Mar 12, 2014 8:45 PM in response to boswan

    For 10.6 and older it's normal to not have a Darwin Boot partition. The layout suggests that Disk Utility was used to shrink the OS X volume. Use fdisk to change the MBR #3 type code to 07 and make it bootable. The fdisk commands to use for that are setpid and flag, use help to get more information.

     

    Then backup OS X and Windows from their respective environments. The use diskutil resize (use man diskutil to learn how) to grow the OS X volume to use the space from the shrink you did. Now you'll have to fix the MBR yet again since diskutil removes this information due to a long standing OS X bug. And finally if you really want OS X smaller you should use someting like Camptune or Winclone or iPartition to adjust the relative sizes of these two partitions since Apple does not provide tools to do this. Otherwise, use Boot Camp Assistant to blow away Windows, and then use it to resize the drive the way you really want it, reinstall Windows from scratch with install media, and then restore your user data from backups.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Mar 12, 2014 8:49 PM in response to boswan
    Level 3 (555 points)
    Mar 12, 2014 8:49 PM in response to boswan

    What broke it was the Mavericks installer, which found that the MBR and GPT weren't synced because you did the resize with an unsupported utility that doesn't understand Boot Camp layouts. The installer, upon seeing the unsync'd MBR and GPT wrongly decides to fix it for you, an in so doing it causes Windows to no longer be bootable.

     

    So anyway, I suggest you make a decision on what you want this to look like because at the moment it seems like you're not certain what OS you even want to be running let alone what you want the partition layout to be. Once you have a stable decision, and express it, then it'll be easier to tell you how to achieve it.

  • by boswan,

    boswan boswan Mar 12, 2014 9:06 PM in response to Christopher Murphy
    Level 1 (0 points)
    Mar 12, 2014 9:06 PM in response to Christopher Murphy

    The installation I had was working fine for me 300GB OS X and the rest BOOTCAMP (Windows 7). Thought upgrading to Maverics would be simple.

     

    I was asking about VM because I thought about going that route when I first set this up almost 2 years ago, but thought Windows would run too slow or be limited in RAM.  So I went the BOOTCAMP route, but I made the disk too small ...

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Mar 12, 2014 10:14 PM in response to boswan
    Level 3 (555 points)
    Mar 12, 2014 10:14 PM in response to boswan

    Well unfortunately Apple doesn't follow its own advice by disallowing Disk Utility to modify the GPT once a hybrid MBR has been created. They should only permit complete obliteration of all contents of a drive rather than allowing the perception of safe resizing. The trap you ran into is that the MBR described the disk one way, the GPT another way, but each permitted Windows and OS X to boot OK. But then when the Mavericks installer ran, it detected the difference and incorrectly assumed that they needed to be the same. On top of the mistake of modifying it at all, it "fixed" it wrong in two ways: did not set the active flag, it did not set the type code correctly. For some people it's a strike three when it deletes valuable information about the true Windows partition start sector in favor of the wrong (stale) information in the GPT. And the thing is, this has been filed as a bug for a long time and they either don't understand it still or they don't care. So there you have it, it's really not a platform particularly friendly to running anything other than OS X, what can I say?

     

    As for the VM route, yes you avoid these particular problems with partitions and such. You do run into performance limitations, but how noticable this is depends on what you're running. Games are usually a non-starter because they want a lot of memory and need full access to accellerated video (GPU acceleration) which is very limited through a virtual machine. If it's for accounting applications and such, you probably won't notice any performance degradation.

     

    If you want to keep on using Boot Camp, just don't trust Disk Utility to be of much help. And make regular backups of both environments because unless you have esoteric knowledge, it's a flaky arrangement that as you've experienced can blow up on you doing seemingly safe things like an OS ugprade that has nothing at all whatsoever to do with Windows.

  • by boswan,

    boswan boswan Mar 12, 2014 10:41 PM in response to Christopher Murphy
    Level 1 (0 points)
    Mar 12, 2014 10:41 PM in response to Christopher Murphy

    So if I change the id of partition 3 to "07" and make it bootable what are the chances I can get back what I had before?

     

    Then your suggestion is to back everything up and start over. I think I tried starting over before.  On Windows I tried making a disk image and restoring that, but it just gave me back the same size partition.

     

    Obviously I don't know what I'm doing. You suggested that I could do this with Camptune or Winclone or iPartition.  I don't mind restoring my user data, but all the programs and settings is a real hassle.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Mar 12, 2014 11:08 PM in response to boswan
    Level 3 (555 points)
    Mar 12, 2014 11:08 PM in response to boswan

    If you change the MBR #3 partition to ID 07 and set the boot flag there's every reason to believe Windows will be bootable. Sometimes it's necessary to repair Windows with Windows Startup Repair afterward.

  • by boswan,

    boswan boswan Mar 13, 2014 12:22 AM in response to boswan
    Level 1 (0 points)
    Mar 13, 2014 12:22 AM in response to boswan

    Setting partition 3 to "07" and making it bootable did allow it to show up as a bootable drive on system restart with the option key held down, but instead of booting it said "Press Ctrl-Alt-Del".

     

    I decided to try testdisk "analyze" to see what it thought about my disk.  It wasn't too happy.  Even "Quick Search" took a long time.

     

    TestDisk 6.14, Data Recovery Utility, July 2013

     

    Disk /dev/disk0 - 500 GB / 465 GiB - 976773168 sectors (RO)

     

     

    The harddisk (500 GB / 465 GiB) seems too small! (< 700 GB / 651 GiB)

    Check the harddisk size: HD jumpers settings, BIOS detection...

     

     

    The following partitions can't be recovered:

         Partition               Start        End    Size in sectors

    >  MS Data                966160592 1044768975   78608384

       MS Data                976773112 1367197680  390424569

       MS Data                976773119 1055381502   78608384

       Mac HFS                976773124  978042659    1269536

     

    I also got these messages.

    Warning: number of heads/cylinder mismatches 255 (NTFS) != 1 (HD)

    Warning: number of sectors per track mismatches 63 (NTFS) != 1 (HD)

     

    and trying to look for files I got this for all NTFS partitions

    Can't open filesystem. Filesystem seems damaged.

     

    So it looks like deleting boot camp and starting over is in order.

first Previous Page 3 of 4 last Next