How to write to both GPT and MBR manually?

7,330

Thank you for your advices.

I followed them and got help from Rod Smith (creater of gdisk).

The problem came from the fact that Easeus (the partition tool I used) was not aware of "hybrid MBR/GPT" systems. It did a mess thus.

Here were the steps to be taken : 1) using gdisk I repaired the GPT : - added the missing Mac partition (command 'n' in gdisk stating the type AF and the begin and end position) - sorted the partitions for it to become the second one as expected (command 's' in gdisk) 2) I have recreated the hybrid MBR based on these data ('x' command and then 'h' command in gdisk).

Of course, Gdisk allows also to create a backup of both partitions tables. That is a great tool and Rod's documentation on his website rodsbooks.com is great too (with examples and so on).

If you have a dual boot Mac with Windows that is great to correct your messed up partitions.

Share:
7,330

Related videos on Youtube

Stan
Author by

Stan

Updated on September 18, 2022

Comments

  • Stan
    Stan almost 2 years

    I have a big deal here. I have a MacBook with three partitions:

    1. HFS partition for Mac OS X 10.6
    2. NTFS partition for Windows 7 64-Bit
    3. NTFS partition for my documents

    It thus works with both GPT and MBR. I use rEFIt to switch the system at boot.

    Having had troubles with my Windows roaming increasing dramatically (what a pain), I had to increase the size of my second partition after reducing my third partition...

    My problem is that my partitioning tool did a mess with the GPT and the MBR (I am a beginner to these systems and I used EaseUS's tool to work on the partitions. It was a big mistake.)

    Now I have the following.

    In the GPT

    Partition  Start LBA     End LBA Type
    
    1                 40      409639 EFI System (FAT)     ⇐ The boot sector, I guess
                                                          ⇐ I miss my Mac OS partition (the entry was suppressed by Easeus)
    2          126240768   252067839 Basic Data           ⇐ My Windows partition
    3          278693928   976773165 Basic Data           ⇐ My Documents partition at the right place
    

    In the MBR

    Partition   Start LBA    End LBA Type
    
    1                   1     409639 EE               ⇐ The boot sector I guess
    2              409640  125976615 AF Mac OS X HFS+ ⇐ My Mac OS partition at the right place etc
    2           126240768  252067839 07 NTFS/HPFS     ⇐ my Windows partition
    3           252069888  976773165 07 NTFS/HPFS     ⇐ my Documents partition at the WRONG old place
    

    rEFIt offers me to automatically copy the content of my GPT to my MBR: It would give me back access to my "documents" partition, but I would lose my OS X partition.

    How do I manually write in those GPT and MBR to setup both sides? I heard it would be possible with UBCD …

    • JdeBP
      JdeBP almost 13 years
      Neither of those are the boot sector. The EFI System Partition is your system volume and the type EE entry in the old-style partition table is a protective placeholder.
    • Stan
      Stan almost 13 years
      OK, thanks for the TIP. But could you tell me how to write those two tables ?
    • JdeBP
      JdeBP almost 13 years
      I was going to, but was beaten by Rod Smith I see. I personally recover from such situations with a hex editor. But my recommendation to you would have been the same as M. Smith's: Re-add the partition to the EFI table using a non-destructive create and then update the old-style table from the EFI one. I also agree with M. Smith on the avoidance of hybrid partitioning unless one knows fully what one is doing. Why don't you just get your 64-bit Windows 7 to use the EFI partition table directly as it can?
  • Stan
    Stan almost 13 years
    I have burnt the gparted live CD, but when booting on it. It stops with no reason in the middle of the process... No way to have it continue.
  • harrymc
    harrymc almost 13 years
    Does this thread help ? If not, does it stop with any message (or what is the last displayed message) ?
  • Stan
    Stan almost 13 years
    No actually my problem is not solved... sadly. Rod Smith (the editor of gparted gave me good advices but I can't actually solve my issue... Best regards.
  • harrymc
    harrymc almost 13 years
    The above thread also gave such advice as using a Linux distribution that contains gdisk. The list is here. You might try a LiveCD, for example Fedora LiveCD is one of the best at detecting hardware.