How to restore GPT/MBR partition (Bootcamp no longer boots)

Discussion in 'Windows, Linux & Others on the Mac' started by benze, May 15, 2012.

  1. benze macrumors newbie

    Joined:
    May 15, 2012
    #1
    Hi,

    I had Lion and Win7 (via BootCamp) running on my Macbook Pro (8,2) system and recently migrated to a larger drive. I cloned the entire drive over using Clonezilla. Everything worked fine, except that my BootCamp partition was in the middle of the drive. So I used gparted to move the BootCamp partition to the end of the drive, and apparently killed the MBR in the process.

    I can still boot Lion without any issues, but can no longer boot my Win7 partition. I can, however, mount/read the Bootcamp partition fine from within Lion.

    After reading around a little, it would appear that I trashed the MBR by using gParted. Should have read around a little first. :) Mea Culpa.

    How can I restore it? I have seen references to using gptrefresh from Winclone, gptsync from rEFIt, or gdisk, but cannot find detailed instructions. I do not have Winclone so would rather use gptsync or gdisk.

    I downloaded rEFIt, and tried installing it onto a USB drive, but am not quite sure how to access/run gptsync (I found it as gptsync.eft and if I try to execute it, I get "cannot execute binary file") and I cannot find a binary version of gdisk.

    Can anyone give me a hand as to what to do at this point please?

    Thanks!

    Eric
     
  2. benze thread starter macrumors newbie

    Joined:
    May 15, 2012
    #2
    Update:
    I found a live CD (system recover cd) with GPT fdisk on it. I followed the instructions at http://www.rodsbooks.com/gdisk/hybrid.html to rebuild the hybrid GPT/MBR table.

    When I boot up now, I can see the windows partition in the BootCamp menu. However, if I choose Windows, I now get a Windows Boot Manager error "Windows failed to start. A recent hardware or software change might be the cause ..... Status: 0xc0000225 ... Info: The boot selection failed because a required device is inaccessible."

    Given that I only moved the partition to the edge of the drive, I am a bit uncertain as to why this would suddenly cause any issues. I am not sure if I need to reinstall the Win7 boot loader or do a fixmbr, but I fear touching any of that and destroying the GPT.

    This is my first time dealing with GPT and hybrid tables, so I am not sure how to best proceed.

    Any suggestions / recommendations would be appreciated.

    Thanks,

    Eric
     
  3. Quad5Ny macrumors 6502a

    Quad5Ny

    Joined:
    Sep 13, 2009
    Location:
    New York, USA
    #3
    The Windows BCD (Boot Configuration Data Store) needs to be updated with the new partition location.

    1. Put your Windows 7 DVD/ThumbDrive in
    2. Boot off of it
    3. Click "Next"
    4. Click "Repair your Computer"
    5. Wait for it to search
    6. Click "View details" to view the changes that will be made
    7. Click "Close"
    8. If everything is correct then Click "Repair and restart"
    9. Remove your Windows 7 DVD/ThumbDrive
     
  4. benze thread starter macrumors newbie

    Joined:
    May 15, 2012
    #4
    Is this new in Win7 vs XP? I haven't done much manual boot configuration in Win7, but in XP, there was a boot.ini file which contained the disk number and partition number, but didn't care about the partition location as such (ie: start/end cylinders, etc). Does Win 7's BCD now care about this?

    My battery is dead so won't be able to run the repair until tonight, but in the meantime I tried looking at my desktop's Win7 BCD config and don't see anything specific relating to partition location.

    Thanks!

    Eric
     
  5. biohead macrumors 6502

    Joined:
    Jun 18, 2010
    Location:
    West Drayton, UK
    #5
    The entire booting process in Windows was overhauled for Windows Vista, and carried on to Windows 7. It's extremely different to the old WinXP configuration.

    Try booting the Windows 7 install DVD, and running startup repair. It's usually pretty good at sorting out most errors like this.
     
  6. Quad5Ny macrumors 6502a

    Quad5Ny

    Joined:
    Sep 13, 2009
    Location:
    New York, USA
    #6
    The BCD in Vista/7 is located either in a hidden 200MB partition or in "%SystemDrive%\Boot\" (whether the extra hidden partition exists depends on if you ran setup on a pre-partitioned disk or not).

    Anyway, the BCD is not a text file. It's actually a registry hive which you can take a look at if you launch regedit (under HKEY_LOCAL_MACHINE\BCD00000000). The partition information is stored in hex and is tied to whatever the layout of your disk was at the time it was written (which you changed :p).

    Windows doesn't really support making changes via regedit though. The correct way to edit it would be to use bcdedit.

    ---

    I'm not sure, but its definitely not textual data that's stored.

    For example this is the data stored for the "osdevice" entry on my disk which points to my Windows partition:
    Code:
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    06 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00
    00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 01 00 00 00 C4 42 DD 54 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    
     
  7. benze thread starter macrumors newbie

    Joined:
    May 15, 2012
    #7
    Thanks! Worked like a charm. The only catch I had was that my install DVD for some reason didn't have a repair option. I had to find another W7 installation and run the Win7 Repair Disk creator to create a repair disk that I was then able to boot and repair the partition.

    Thanks again!

    Eric
     

Share This Page