GPT Partition Broken

Discussion in 'Windows, Linux & Others on the Mac' started by kkrull, Mar 4, 2013.

  1. kkrull macrumors regular

    kkrull

    Joined:
    Dec 19, 2006
    #1
    So I had a functional triple boot system with OSX, Win 8 x64 EFI and now x64 Linux Mint on four usable partitions on a retina Macbook Pro.

    Windows 8 had a minor "windows update" problem that in trying to solve broke my machine so it would only safeboot. Then system refresh and/or automatic repair destroyed it to the point that even a system reset is impossible. Certainly the restore points are gone.

    Currently I cannot reinstall Windows. Somewhere in the above Windows devolution I believe that the GPT got damaged. I would like to attempt a repair on that partition before I wipe the disk and start over.

    I was hoping for some advice from any GPT experts. Here is what I know...

    from MacOS

    $ gdisk /dev/disk0 p

    Disk /dev/disk0: 490234752 sectors, 233.8 GiB
    Disk identifier (GUID): ...
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 490234718
    Total free space is 936829 sectors (457.4 MiB)

    Number Start (sector) End (sector) Size Code Name (my notes)
    2 409640 146894007 69.8 GiB AF00 Customer (OSX created HFS Plus)
    3 146894008 148163543 619.9 MiB AB00 Recovery HD (OSX created)
    4 148164608 148426751 128.0 MiB AF00 Apple_HFS_Untitled_2 (unknown)
    5 148426752 148688895 128.0 MiB 0C01 Microsoft reserved par (unknown)
    6 148688896 343736319 93.0 GiB 0700 Basic data partition (Win created NTFS)
    7 343738184 382800679 18.6 GiB 0700 DOS_FAT_32_Untitled_3 (Linux 3.5 created ext3)
    8 383062824 489972567 51.0 GiB 0700 Windows_NTFS_Untitled_ (Win created exFAT)​

    You can see my notes on the far right (my notes in parenthesis) that some of the listed partition types are incorrect.

    From Windows 8 x64 EFI install I see these partitions

    Name Total Size Type
    Drive 0 Partition 1 200 MB Primary
    Drive 0 Partition 2 69.8 GB System
    Drive 0 Partition 3 619 MB Primary
    Drive 0 Partition 4 128 MB Primary
    Unallocated Space 163 GB

    In selecting the "unallocated space" (which I realize is wrong) from the partition selection screen I get these three errors in the from partition 4 above

    Windows cannot be installed to this hard disk space. The selected disk has the maximum number of partitions of this type.

    Windows cannot be installed to this disk the selected disk has an MBR partition table. On EFI systems, Windows can only be installed to GPT disks

    Windows cannot be installed to this disk This computer's hardware may not support booting to this disk. Ensure that the disk's controller is enabled in the computer's BIOS menu​

    From the Win 8 x64 EFI command prompt under "diskpart" I get only the first four partitions. I can't even find diskpart.efi from the install disk.

    Advice? I was thinking about trying the following
    1. manually changing the partition types in gdisk
    2. trying to find and run window's diskpart.efi
    3. removing the MBR and/or rebuilding the MBR
    4. trying any MBR sync utilities from rEFInd
    5. trying clean or repair functions from gdisk
    6. trying clean or repair functions from EaseUS Partition Manager

    The Linux partition couldn't be the culprit. I don't think Linux bootloads in EFI, but the Windows problems were all concluded before Linux was installed.
     
  2. somecallmesum macrumors newbie

    Joined:
    Mar 24, 2009
    Location:
    USA
    #2
    windows 8 restarts and updates will hostage your efi to windows 8, its not supported and wont run for more than a couple days

    have to wait for bootcamp update
     
  3. srs5694 macrumors newbie

    Joined:
    Mar 18, 2012
    #3
    It looks like you've got a hybrid MBR, which Windows will interpret as an MBR disk. With such a configuration, you should be able to install Windows in BIOS mode, but you'll need to adjust the hybrid MBR to reference your Windows partitions. Alternatively, if you're sure you had an EFI installation working, you could try converting your hybrid MBR back to a protective MBR. Windows booted in EFI mode should then see all of your partitions. You can do either of these things (create a fresh hybrid MBR with the partitions you want or create a fresh protective MBR) with gdisk. Be aware that the gptsync utility is very inflexible and will create a hybrid MBR that contains just the first few partitions on the disk, which in your case is inappropriate.
     
  4. kkrull thread starter macrumors regular

    kkrull

    Joined:
    Dec 19, 2006
    #4
    I am unclear on what this means. If you mean that restarts and updates will damage the EFI settings or configurations, I don't think this is true. I ran dozens of updates over six months and never had a problem. It was only after I tried to "fix" the uninstalled updates that I ran into trouble.

    I do think it is possible that the restore, refresh and auto repair functions in Windows will mess up the GUID Partition Table. I don't know how bootcamp, which I am not using as a partition utility - only as drivers, would make any difference.
     
  5. murphychris macrumors 6502a

    Joined:
    Mar 19, 2012
    #5
    Some of this sounds like the Windows 8 fast boot gotcha, it's becoming corrupted if you're doing any writes to the NTFS volume outside of Windows 8.

    I don't know why you think you're booting Windows 8 in EFI mode, the evidence points to it being booted with the CSM-BIOS. In gdisk if you go to the recovery/transformation menu, type p <enter> and o <enter> and post the results.

    Another thing to do is:
    Code:
    sudo mount -t msdos /dev/disk0s1 /Volumes/
    I think you'll see a message that it's mounting this as /Volumes/EFI but you'll need to look in the Finder for another mounted volume probably with the name EFI. In there you should see an Apple folder. The question is if there's also a Microsoft folder and if so what's in it. If there isn't a Microsoft folder, but there is an Apple folder, then you definitely don't have an EFI installation of Windows 8.
     
  6. ethan1878 macrumors newbie

    Joined:
    Jan 20, 2013
    #6
    I'm having very similar problems with my MacBook Pro. I installed windows 7 via bootcamp then upgraded to windows 8 pro when it was available. however, windows had changed my GPT to LDM and my MBP only recognises windows!!! even worse, I only have a 50GB partition for windows (wiht only around 10GB available) so I couldn't play about with many programs to try to fix it. even wore, windows update rebooted my MBP and now my windows partition is corrupt. I have tried refreshing and resetting windows 8 but i keep getting the error that my recovery disk is invalid. all i am left with is a dead MBP with no bootable os and no recovery methods at all. any help would be greatly appreciated, thanks.
    Finally, i am sorry for resurrecting an old thread
     
  7. kkrull thread starter macrumors regular

    kkrull

    Joined:
    Dec 19, 2006
    #7
    Interesting. I got criticised for having an exFAT data partition to avoid this. Do you know if I had a non-boot NTFS shared partition if I would run into the same Fast Startup issues? I will disable Fast Startup when I get this repaired.
    I am going to need some help with syntax trying this.

    How do I get into the recovery option menu for gdisk from Mac OS? Or did you mean from Linux?

    If I try
    Code:
    sudo mount -t msdos /dev/disk0s1 /Volumes/
    from OSX I just get resource busy.

    Also, in my main OSX volume under /EFI there is a windows directory

    Thanks for weighing in murphychris

    The non EFI boot of Linux Mint in this multiboot environment may be more of a problem than I thought.

    Do you mean a four day old original thread or the most recent twelve hour old reply? I believe this is usually referred to as hijacking. Grin
     
  8. murphychris macrumors 6502a

    Joined:
    Mar 19, 2012
    #8
    exFAT is for flash media like SD cards that go in cell phones and cameras. It has one FAT. It's not journaled. If it gets corrupted repairs aren't often as successful. Use FAT32 in a bind. Better to use NTFS or HFSJ, and get a 3rd party tool that can rw the "guest" file system. Best to use a VM which will have integrated file sharing between environments, or use a NAS. Definitely don't add another partition to a Bootcamp'd disk with Disk Utility, this causes the Windows volume to become unbootable.


    I don't know for sure, but I seriously doubt it. All of the Fast Startup writes to disk should be the boot disk.

    ? gets you a menu of options. Transform/recovery menu I think is t.

    Try this:
    Code:
    mkdir /Volumes/esp
    sudo mount -t msdos /dev/disk0s1 /Volumes/esp
    ls -l /Volumes/esp/EFI/
    sudo umount /dev/disk0s1
    That's unexpected. When did this EFI folder appear? What's inside the windows directory?

    This is why I'm using Fedora, but it has a unique variation on supporting Macs. It creates a 2nd ESP, formatted HFS+, and installs its files there, rather than leveraging the original (actual) ESP. They do this so System Preferences > Startup Disk will show Fedora as a boot option, which can't be done unless the boot loader is on an HFS+ volume. Yay proprietary Apple EFI.
     
  9. kkrull, Mar 9, 2013
    Last edited: Mar 9, 2013

    kkrull thread starter macrumors regular

    kkrull

    Joined:
    Dec 19, 2006
    #9
    Not sure how I had such an old version of gdisk on OSX but here are the results from 0.8.6...

    Partition table scan:
    MBR: hybrid
    BSD: not present
    APM: not present
    GPT: present

    Found valid GPT with hybrid MBR; using GPT.

    ...

    Recovery/transformation command (? for help): p
    Disk /dev/disk0: 490234752 sectors, 233.8 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): ...
    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 527229 sectors (257.4 MiB)

    Number Start (sector) End (sector) Size Code Name
    1 40 409639 200.0 MiB EF00 EFI system partition
    2 409640 146894007 69.8 GiB AF00 Customer
    3 146894008 148163543 619.9 MiB AB00 Recovery HD
    4 148164608 148426751 128.0 MiB AF00 Apple_HFS_Untitled_2
    5 148426752 148688895 128.0 MiB 0C01 Microsoft reserved part
    6 148688896 343736319 93.0 GiB 0700 Basic data partition
    7 343738184 382800679 18.6 GiB 0700 DOS_FAT_32_Untitled_3
    8 383062824 489972567 51.0 GiB 0700 Windows_NTFS_Untitled_4

    Recovery/transformation command (? for help): o

    Disk size is 490234752 sectors (233.8 GiB)
    MBR disk identifier: 0x09F0561C
    MBR partitions:

    Number Boot Start Sector End Sector Status Code
    1 1 409639 primary 0xEE
    2 * 409640 146894007 primary 0xAF
    3 146894008 148163543 primary 0xAF
    4 148164608 148426751 primary 0xAF
    Many of these partition types are wrong: 2 is HFSPlus, 6 is NTFS, 7 is ext3 and 8 is exFAT.

    Clearly srs5694 is right about the hybrid MBR, but I think I have to convert my Linux Mint boot to EFI before I delete that hybrid MBR and create a protective MBR.

    mkdir command doesn't return an error but the mount command still returns "Resource Busy"

    Not sure when the folder appeared. Now I can't find it, but I would have sworn it was there. Now in OSX finder I have an efi folder with a refind and tools directories. And now I have an EFI drive mounted there with an EFI folder and an empty esp folder. In the second EFI folder I have APPLE, Boot and Microsoft folders. In the Apple folder I have EXTENSIONS and FIRMWARE folders. In the Microsoft folder I have a boot directory. I would have sworn that I saw a windows directory with the same content as boot. Maybe I had mounted this same directory under this name.

    Any advice on what to do next?
    Change the Linux Mint boot over to EFI?
    Manually correct some incorrect GPT entries?
    Reconstruct the protective MBR?

    On my own I would probably try all three in that order before attempting a reinstall of Window 8 EFI x64. I would estimate my success rate on first attempts of the above three steps to be 20%, 50% and 95% likely, respectively.
     
  10. murphychris macrumors 6502a

    Joined:
    Mar 19, 2012
    #10
     
  11. kkrull, Mar 10, 2013
    Last edited: Mar 11, 2013

    kkrull thread starter macrumors regular

    kkrull

    Joined:
    Dec 19, 2006
    #11
    I really like rEFInd. I am using kernel 3.8 so it should boot through the EFI stub boot loader, but I just tried to set it up the stub boot loader and I am not making it work.

    Here is what I have in grub.cfg...

    menuentry 'Linux Mint 14 Cinnamon 64-bit, 3.8.0-030800-generic (/dev/sda7) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
    recordfail
    insmod gzio
    insmod part_gpt
    insmod ext2
    set root='hd0,gpt7'
    if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7 35d5e2b0-20bf-41b8-aa38-3b37e234a53a
    else
    search --no-floppy --fs-uuid --set=root 35d5e2b0-20bf-41b8-aa38-3b37e234a53a
    fi
    echo 'Loading Linux 3.8.0-030800-generic ...'
    linux /boot/vmlinuz-3.8.0-030800-generic root=UUID=35d5e2b0-20bf-41b8-aa38-3b37e234a53a ro recovery nomodeset
    echo 'Loading initial ramdisk ...'
    initrd /boot/initrd.img-3.8.0-030800-generic
    }​

    and here is what I have in refind_linux.conf generated from the .sh script...
    "Boot with standard options" "ro root=UUID=35d5e2b0-20bf-41b8-aa38-3b37e234a53a quiet splash "
    "Boot to single-user mode" "ro root=UUID=35d5e2b0-20bf-41b8-aa38-3b37e234a53a quiet splash single"
    "Boot with minimal options" "ro root=UUID=35d5e2b0-20bf-41b8-aa38-3b37e234a53a"​

    I thought that since the GUIDs match it would work but those 35d5... GUIDs are not the partition GUID. The partition GUID starts with A073... and the volume GUID starts with 00002160... Interesting that the grub file identifies the partition 'hd0,gpt7' and the refind_linux file does not.

    Attempting EFI booting under linux I get
    [ 0.055485] [Firmware Bug]: ioapic 2 hasno mapping iommu, interrupt remapping will be disabled
    [ 3.251738] pci 0000:00:01.0: ASPM: Could not configure common clock
    [ 4.483767] i8042: No controller found
    [ 4.801016] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)​
     
  12. srs5694 macrumors newbie

    Joined:
    Mar 18, 2012
    #12
    With most filesystems, including all Linux filesystems, on a GPT disk, there are two UUIDs/GUIDs for each filesystem/partition:

    • The partition has a GUID. This is displayable in gdisk and some other partitioning tools and is used by some EFI utilities.
    • The filesystem has a UUID. This is displayable by Linux's "blkid" utility and can be used in certain Linux configuration files, such as /etc/fstab and /boot/refind_linux.conf.

    "Unable to mount root fs" errors can result from either:

    • Bad or missing initial RAM disk (initrd) -- Check that your initrd file is present in the same directory as the Linux kernel, and check that rEFInd is passing a correct reference to the file. (You can do the latter in rEFInd by hitting F2 or Insert twice to examine the options that are being passed to the kernel.)
    • An incorrect "root=" specification. It's conceivable that the UUID value in refind_linux.conf is wrong. To test this, you can change to a simpler device specification (like "root=/dev/sda4" or whatever the correct device identifier is), either by editing refind_linux.conf or by using Insert or F2 to edit the option on a one-boot basis.
     
  13. somecallmesum macrumors newbie

    Joined:
    Mar 24, 2009
    Location:
    USA
    #13
    New bootcamp is out :)

    make sure to restart w bootcamp every time

    selecting via ctrl at startup may interfere with windows restart if used moreso than select startup disk or bootcamp control toggle in win8
     

Share This Page