How to write to both GPT and MBR manually

bootgptmbr

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 …

Best Answer

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.

Related Question