gillus

Q: Repairing Boot Camp after creating new partition

I did the stupid thing to create a 3rd partition while having bootcamp..

I know there are very similar posts, but i need help to make sure to get it right repairing the MBR..(if possible?)

 

Here is the situation ( diskutil list, gpt, fdisk, gdisk results) I'll be very grateful if someone knowledgeable answer me... ( will i have the chance to get a response from Christopher Murphy...?)

 

MAC OS X (10.9.5 )

 

diskutil list

/dev/disk0

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:      GUID_partition_scheme                        *251.0 GB   disk0

   1:                        EFI EFI                     209.7 MB   disk0s1

   2:                  Apple_HFS Macintosh HD            188.9 GB   disk0s2

   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

   4:       Microsoft Basic Data BOOTCAMP                60.0 GB    disk0s4

 

 

sudo gpt -r -vv show disk0

gpt show: disk0: mediasize=251000193024; sectorsize=512; blocks=490234752

gpt show: disk0: Suspicious MBR at sector 0

gpt show: disk0: Pri GPT at sector 1

gpt show: disk0: Sec GPT at sector 490234751

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

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

  370587616    2459680        

  373047296  117186560      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

  490233856        863        

  490234719         32         Sec GPT table

  490234751          1         Sec GPT header

 

sudo fdisk /dev/disk0

Disk: /dev/disk0 geometry: 30515/255/63 [490234752 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 -  368908440] HFS+       

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

4: 0C 1023 254  63 - 1023 254  63 [ 373047296 -  117186560] Win95 FAT32L

MacBook-Pro-de-Gilles:~ gilles$ diskutil list

/dev/disk0

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:      GUID_partition_scheme                        *251.0 GB   disk0

   1:                        EFI EFI                     209.7 MB   disk0s1

   2:                  Apple_HFS Macintosh HD            188.9 GB   disk0s2

   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

   4:       Microsoft Basic Data BOOTCAMP                60.0 GB    disk0s4

 

sudo gdisk /dev/disk0

Password:

GPT fdisk (gdisk) version 1.0.0

 

Warning: Devices opened with shared lock will not have their

partition table automatically reloaded!

Partition table scan:

  MBR: hybrid

  BSD: not present

  APM: not present

  GPT: present

 

Found valid GPT with hybrid MBR; using GPT.

 

 

Command (? for help): p

Disk /dev/disk0: 490234752 sectors, 233.8 GiB

Logical sector size: 512 bytes

Disk identifier (GUID): CC0F4C25-407E-49FF-9BC0-235DAD29CA3A

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 490234718

Partitions will be aligned on 8-sector boundaries

Total free space is 2460549 sectors (1.2 GiB)

 

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

   1              40          409639   200.0 MiB   EF00  EFI System Partition

   2          409640       369318079   175.9 GiB   AF00  Customer

   3       369318080       370587615   619.9 MiB   AB00  Recovery HD

   4       373047296       490233855   55.9 GiB    0700  BOOTCAMP

MacBook Pro with Retina display, OS X Mavericks (10.9.5)

Posted on May 2, 2015 8:25 AM

Close

Q: Repairing Boot Camp after creating new partition

  • All replies
  • Helpful answers

Previous Page 2
  • by Loner T,

    Loner T Loner T May 3, 2015 7:10 AM in response to gillus
    Level 7 (24,855 points)
    Safari
    May 3, 2015 7:10 AM in response to gillus

    I am glad it solved you issue. The Testdisk was not really needed in your specific case. It is needed in some others, depending on the history before the problem occurred. (BTW, I am a very ugly girl - just kidding).

     

    1. Please back up OS X and Windows to separate external disks, as a baseline for the future.

    2. It is a pain to recover the 1.9 GB, because it is sitting between Windows and Recovery HD. If you really want it back. you will temporarily lose Recovery HD and will have to reinstall OS X. Let me know if you want to pursue it further.

  • by gillus,

    gillus gillus May 3, 2015 7:57 AM in response to Loner T
    Level 1 (0 points)
    May 3, 2015 7:57 AM in response to Loner T

    Thanks again,.

     

    I think I would effectively like to recover the 1.9 Gb, unless you advice me not to.

    I thought that making a full image with disk utility before, and also save with time machine for MAC and Windows backup utility for PC this time would be enough before trying to extend the MAC partition with Disk Utility..?

    If something goes wrong, I could restore the image, I guess...

     

    It is true that running sudo gpt -r -vv show disk0 again still shows a suspicious MBR at sector 0..

  • by Loner T,

    Loner T Loner T May 3, 2015 10:32 AM in response to gillus
    Level 7 (24,855 points)
    Safari
    May 3, 2015 10:32 AM in response to gillus

    You will temporarily lose Recovery HD.

     

    1. Back up OS X.

    2. Back up Windows. Run diskutil list to verify slice disk order.

    3. Merge Recovery HD into OS X. The order of disks is critical in this step. Do not reorder disks under any circumstances.

     

    diskutil mergePartitions JHFS+ "Macintosh HD" disk0s2 disk0s3

     

    Here is the help for the command.

     

    diskutil mergepartitions

    Usage:  diskutil mergePartitions [force] format name

            DiskIdentifier|DeviceNode DiskIdentifier|DeviceNode

     

    Merge two or more pre-existing partitions into one.  The first disk parameter

    is the starting partition; the second disk parameter is the ending partition;

    this given range of two or more partitions will be merged into one.

     

    All partitions in the range, except for the first one, must be unmountable.

     

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

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

     

    If "force" is not given, and the first partition has a resizable file system

    (e.g. JHFS+), it will be grown in a data-preserving manner, even if a different

    file system is specified (in fact, your file system and volume name parameters

    are both ignored in this case). If "force" is not given, and the first

    partition is not resizable, you will be prompted if you want to erase.

     

    If "force" is given, the first partition is always formatted. You should

    do this if you wish to reformat to a new file system type.

     

    Merged partitions are required to be ordered sequentially on disk.

    See diskutil list for the actual on-disk ordering; BSD slice identifiers

    may in certain circumstances not always be in numerical order but the

    top-to-bottom order given by diskutil list is always the on-disk order.

     

    Ownership of the affected disk is required.

     

    Example: diskutil mergePartitions JHFS+ NewName disk3s4 disk3s7

             This example will merge all partitions *BETWEEN* disk3s4 and disk3s7,

             preserving data on disk3s4 but destroying data on disk3s5, disk3s6,

             disk3s7 and any invisible free space partitions between those disks;

             disk3s4 will be grown to cover the full space if possible.

     

    4. Once the merge is complete, you should now be able to stretch OS X in Disk Utility and stretch the bottom right corner so it touches the Bootcamp partition, which will absorb the 1.2 GB Free Space.

    5. Re-install OSX to get Recovery HD back - OS X: About OS X Recovery - Apple Support.

    6. Test both OSes, Local Recovery (Command+R) and Internet Recovery (Command+Opt+R - you must see a spinning a globe and please use a wired connection).

     

    There are other variations to this method, but the end result will be the same.

  • by gillus,

    gillus gillus May 4, 2015 12:14 AM in response to Loner T
    Level 1 (0 points)
    May 4, 2015 12:14 AM in response to Loner T

    Hello again dear personal life guard,

    Ok, let me be sure of the procedure before I choose to go for it or not

     

    1) Backup MAC with time machine

      done.

    2) Backup Windows with windows backup utility

      done.

    3) Merge Recovery HD into OS X :

     

    since diskutil list gives me :

     

    /dev/disk0

       #:                       TYPE NAME                    SIZE       IDENTIFIER

       0:      GUID_partition_scheme                        *251.0 GB   disk0

       1:                        EFI EFI                     209.7 MB   disk0s1

       2:                  Apple_HFS Macintosh HD            188.9 GB   disk0s2

       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

       4:       Microsoft Basic Data BOOTCAMP                60.0 GB    disk0s4

     

    I should run the exact command:

         diskutil mergePartitions JHFS+ "Macintosh HD" disk0s2 disk0s3


     

    4) Once the merge is complete, stretch OS X in Disk Utility and stretch the bottom right corner so it touches the Bootcamp partition, which will absorb the 1.2 GB Free Space.

     

    5) Re-install OSX to get Recovery HD back

      THIS IS WERE I NEED MORE INFO : since previous step destroyed the recovery HD partition, (Command+R) should not work and I have to do a network recovery with (Command+Opt+R) ? OR can I restore from my opened session

      What should I do exactly to Re-install OSX :  (Command+Opt+R)  and choose reinstall OX X command ?

    will I need the Time Machine backup even if things goes right ?

    Will I be able to re-install not the original version (Mountain Lion) but Mavericks that I have currently ?

    will I loose programs like MICROSOFT OFFICE for MAC ?

     

    Thank you in advance..

  • by Loner T,

    Loner T Loner T May 4, 2015 5:37 AM in response to gillus
    Level 7 (24,855 points)
    Safari
    May 4, 2015 5:37 AM in response to gillus

    gillus wrote:

     

    Hello again dear personal life guard,

    This made me chuckle a bit. I am to help.

    gillus wrote:

     

     

    5) Re-install OSX to get Recovery HD back

      THIS IS WERE I NEED MORE INFO : since previous step destroyed the recovery HD partition, (Command+R) should not work and I have to do a network recovery with (Command+Opt+R) ? OR can I restore from my opened session

    Your are correct, local Recovery HD no longer exists at this point. Command+Opt+R is recommended using a Wired Network, and choose Re-Install OS X. Please be aware of

    Which version of OS X is installed by OS X Recovery?

    • If you use the Recovery System stored on your startup drive to reinstall OS X, it installs the most recent version of OS X previously installed on this computer.
    • If you use Internet Recovery to reinstall OS X, it installs the version of OS X that originally came with your computer. After installation is finished, use the Mac App Store to install related updates or later versions of OS X that you have previously purchased.

    For example, if your Mac originally came with Mountain Lion, but you know have Yosemite, you will get ML back, and then will have to upgrade.

    There are other variants to get Recovery HD back, which include low level dd commands from OS X Terminal, but they can be convoluted and dangerous.

    will I need the Time Machine backup even if things goes right ?

    Will I be able to re-install not the original version (Mountain Lion) but Mavericks that I have currently ?

    No, not under normal circumstances. If anything goes towards Murphy's Law, then this is a safeguard. If you have the Mavericks Installer Application, then you do not need Internet Recovery. You can put this installer on a USB and boot from it or if this installer is currently on your OS X partition, just run it and when it reboots, ensure that you are pointing to the current OS X partition.

     

    will I loose programs like MICROSOFT OFFICE for MAC ?

    No. But there is always a "but". If you choose the Internet Recovery path, you may run into issues where M$ Service Packs of Office 2011 may not be valid on ML. They will work once you get to Mavericks (10.9.5).

  • by gillus,

    gillus gillus May 4, 2015 5:45 AM in response to Loner T
    Level 1 (0 points)
    May 4, 2015 5:45 AM in response to Loner T

    Thanks for the detailed support information. I will first finish to develop an application for robotic, then I probably do it.

    I'll post to let you know how it went for me..

    Merci beaucoup !

  • by Loner T,

    Loner T Loner T May 4, 2015 5:50 AM in response to gillus
    Level 7 (24,855 points)
    Safari
    May 4, 2015 5:50 AM in response to gillus

    BTW, my son works on Robotics and writes some controller code. He enjoys it.

  • by gillus,

    gillus gillus May 5, 2015 2:48 AM in response to Loner T
    Level 1 (0 points)
    May 5, 2015 2:48 AM in response to Loner T

    Hello Again, Loner T

    Just to tell you (and everyone interested), I did get back the missing 1,2 Gb applying the procedure you gave me, I worked very well.

     

    I first install OS X on an USB external SSD, restore with Time Machine everything on it. Works well (few problems restoring SAFARI pages, no big deal)

    Having 2 MAC OS working, I tried to install YOSEMITE on the external drive instead of Mavericks -> The downloading didn't worked, I did not pursue

     

    Being confidante that restoring actually works, I went for the merging procedure on the internal drive, worked fine, I tried to restart before re-installing MAC OS to get back the Apple_Boot Recovery HD, it works fine.

    Then I re-install MAC OS X on internal drive from the recovery of the external MAC:

          No Command+R or Command+Opt+R, just ALT then choose to start from restore partition of the external drive, select to re-install on the internal MAC partition : EVERYTHING WORKING SMOOTHLY !

    I now know a little more on MAC OS X, ( A shame for someone who spent its career writing kernel process in AIX, UNIX, writing low level soft including a full OS for equipment that fly on F18, Rafale, EF2000...)


    Thank you again, Loner T ! 


     

  • by Loner T,

    Loner T Loner T May 5, 2015 3:48 AM in response to gillus
    Level 7 (24,855 points)
    Safari
    May 5, 2015 3:48 AM in response to gillus

    Thank you for posting back with your success. Always to see things working properly.

Previous Page 2