Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
gdisk info, please help

Note the first letter of each line with size 0 begins with a d for directory. Directories always have file size of zero. That's normal.


Boot from Mac OS X, launch Terminal, and issue this command. It is a read only command, it makes no changes. Copy-paste the results into the forum, tagging the text with CODE tags for proper formatting. After pasting, highlight the text and use the # button in the toolbar to add the CODE tags.

Code:
sudo gpt -r -vv show disk0

Hi. Can you please advise with that?
My Bootcamp partition boots ok (with option key on startup) but not showing in OSX (i think agter Vmware Fusion 3.0.1 installation).
Therefore i cannot backup with Winclone, to replace harddisk!
Can you help? Giving info below.
Thank you, Alex

Code:
sudo gpt -r -vv show disk0

gpt show: disk0: mediasize=1000204886016; sectorsize=512; blocks=1953525168
gpt show: disk0: Suspicious MBR at sector 0
gpt show: disk0: Pri GPT at sector 1
gpt show: error: bogus map
gpt show: unable to open device 'disk0': No such file or directory


Code:
sudo gdisk -l /dev/disk0

GPT fdisk (gdisk) version 0.8.5

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

Found valid GPT with hybrid MBR; using GPT.
Disk /dev/disk0: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): EDAC09CB-91A9-45DB-9F4F-28663959FACF
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 8-sector boundaries
Total free space is 101668605 sectors (48.5 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640      1683420823   802.5 GiB   AF00  NotQuiteMaxDisk
   3      1785088000      1953523711   80.3 GiB    0700  BOOTCAMP

Code:
sudo fdisk /dev/disk0
Disk: /dev/disk0	geometry: 121601/255/63 [1953525168 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 -   25 127  14 [         1 -     409639] <Unknown ID>
 2: AF   25 127  15 - 1023 254  63 [    409640 - 1683011184] HFS+        
*3: 07 1023 254  63 - 1023 254  63 [1683435285 -  270084780] HPFS/QNX/AUX
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused
 
Last edited:
Hi. Can you please advise with that?
My Bootcamp partition boots ok (with option key on startup) but not showing in OSX (i think agter Vmware Fusion 3.0.1 installation).
Therefore i cannot backup with Winclone, to replace harddisk!

Did you make a VM that uses the Bootcamp partition? Could Fusion be grabbing the partition? Is Fusion running?

I don't think your issue is related to the partition table at all.

B
 
There is a discrepancy between the GPT and the MBR. You've done something, presumably resizing the Windows volume from within Windows? There are no GUI tools I'm aware of that can fix this discrepancy because it's ambiguous which one is correct and which one is incorrect. Invariably I'd expect total data loss with a GUI tool with this situation

Code:
   3      1785088000      1953523711   80.3 GiB    0700  BOOTCAMP

Code:
*3: 07 1023 254  63 - 1023 254  63 [1683435285 -  270084780] HPFS/QNX/AUX

The GPT says Boot Camp starts at sector 1785088000, but the MBR says it starts at 1683435285. If Boot Camp is booting, but Mac OS X can't see the disk, then that means the MBR has the correct information.

To fix it, you'll have to do something quite rare, which is you will need to wipe out the GPT, and recreate it from the MBR data. GPT fdisk (a.k.a. gdisk) can do this in the recovery/transformation menu, command f "load MBR and build fresh GPT from it".

When doing this, it's almost certainly going to get partition 1 wrong, because of how GPT partition 1 + the GPT itself are combined into MBR partition 1 as 0xEE. So it's good you've posted your GPT to the forum because that's likely to end up being your backup if this goes wrong.

So first use gdisk to create a fresh GPT from the MBR. Then, making sure you're still in the recovery/transformation menu, use the p command to print the resulting GPT, and the o command to print the MBR, and post both to the forum again.
 
Good catch on the discrepancy!

So it's good you've posted your GPT to the forum because that's likely to end up being your backup if this goes wrong.

IIRC, gdisk has "backup to file" and "restore from backup file" options too, so don't hesitate to save off a copy of the GPT table to a thumb drive as well.

B
 
It's a rather weird discrepancy, we haven't heard the whole story. The GPT is reporting an 80GiB Boot Camp partition, while the MBR is reporting a 129GiB partition. This is a considerable difference.

Another way around this if you're not comfortable with gdisk and editing two partitions: make sure you have a complete backup of OS X. Reboot and use Windows Backup to backup your Windows data. And then blow away this problemed boot drive (ie. partition it with one partition) and then restore from Time Machine if that's what you're using. Or reinstall OS X and restore your data from other backup.

My next recommandation is to actually not use Boot Camp. It's fragile, it's flakey, it's annoying, people have data loss using it all the time. I suggest you use a virtual machine like Parallels or VMWare. But if you refuse wise advise, or play Windows games, then you'll use Boot Camp Assistant to make a new partition from scratch, install Windows, install the updates, restore from Windows Backup.

Seriously, the GUI backup-restore takes forever and a day. But for many it's less obscure than a 2 minute fix of the partition table using a command line only tool. But it's nice to have choices.
 
You are really fast!

First of all, thank you for your immediate response.
I remember now, that when i installed fusion, it tried to load the Bootcamp OS (Windows7) with no success. Fusion is working now but with XP, imported from my old PC.
And i have also changed windows partition (increased from 80 to 129) but i do not remember how i did it, with Disk Utility from OSX or from inside Windows or using both?!
Probably i messed things up! Can you please advise with Gdisk? I will give it a try first. I have already backud up OSX with Time Machine and also Windows 7 with their system's "Backup and Restore" utility, to an external 2TB disk.
 
Last edited:
Download gdisk from sourceforge.

You will run gdisk with the following command. The subsequent letters are commands given within gdisk, each letter is followed by <return>. The portion in [] is a description.

Code:
sudo gdisk /dev/disk0
r     [recovery/transformation menu]
f     [create fresh GPT from MBR]
y     [yes I really want to destroy the GPT]
p     [print the GPT to screen]
o     [print the MBR to screen]


Post the results. You can either 'q' to quit gdisk without making changes, or command-c, or just leave gdisk running in the terminal. It won't hurt anything to leave it running, the changes to the GPT and MBR are only in memory and have not yet been written to disk. Do not 'w' write out the change yet until there is confirmation the MBR and GPT look correct from someone (probably me).
 
New feed

Did commands as you said. Here is the info

Code:
Recovery/transformation command (? for help): f
Warning! This will destroy the currently defined partitions! Proceed? (Y/N): y

Recovery/transformation command (? for help): p
Disk /dev/disk0: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): A001ECDE-8F76-4AB7-B2F6-1FEB585E718A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 429137 sectors (209.5 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   2          409640      1683420823   802.5 GiB   AF00  
   3      1683435285      1953520064   128.8 GiB   0700  

Recovery/transformation command (? for help): o

Disk size is 1953525168 sectors (931.5 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1   1953525167   primary     0xEE

Recovery/transformation command (? for help):
 
Code:
m   [go back to the main menu]
n   [add partition]
1
40   [first sector]
409639  [end sector]
EF00    [EFI System partition type code]
s       [sort  partitions]
r       [recovery transform menu]
h       [new hybrid mbr]
2 3     [add partitions 2 and 3 to the MBR]
y       [EFI GPT first, yes]
<return>   [accept default code]
n       [do not make bootable]
<return> [ accept default code]
y       [make bootable]
n       [do not protect more partitions]
o
p

repost the results from just the last two commands.
 
Code:
m   [go back to the main menu]
n   [add partition]
1
40   [first sector]
409639  [end sector]
EF00    [EFI System partition type code]
s       [sort  partitions]
r       [recovery transform menu]
h       [new hybrid mbr]
2 3     [add partitions 2 and 3 to the MBR]
y       [EFI GPT first, yes]
<return>   [accept default code]
n       [do not make bootable]
<return> [ accept default code]
y       [make bootable]
n       [do not protect more partitions]
o
p

repost the results from just the last two commands.

I believe that without w, nothing is actually changed, right?
 
Forgive me, but after n, is it l (el) or 1 (one) ? Because both give me different stuff

Code:
Command (? for help): n
Partition number (4-128, default 4): 1
Value out of range
Partition number (4-128, default 4): l
First sector (34-1953525134, default = 1683420824) or {+-}size{KMGTP}: 40
First sector (34-1953525134, default = 1683420824) or {+-}size{KMGTP}:
 
Forgive me, but after n, is it l (el) or 1 (one) ? Because both give me different stuff

Code:
Command (? for help): n
Partition number (4-128, default 4): 1
Value out of range
Partition number (4-128, default 4): l
First sector (34-1953525134, default = 1683420824) or {+-}size{KMGTP}: 40
First sector (34-1953525134, default = 1683420824) or {+-}size{KMGTP}:

Go ahead and accept 4. Looks like it won't accept 1. When you resort the 4 will become a 1.
 
It does not accept 40 either. Only 34, but then.. stuck. 39?

Code:
Command (? for help): n
Partition number (4-128, default 4): 1
Value out of range
Partition number (4-128, default 4): 4
First sector (34-1953525134, default = 1683420824) or {+-}size{KMGTP}: 40
First sector (34-1953525134, default = 1683420824) or {+-}size{KMGTP}: 40
First sector (34-1953525134, default = 1683420824) or {+-}size{KMGTP}: 40
First sector (34-1953525134, default = 1683420824) or {+-}size{KMGTP}: 34
Last sector (34-39, default = 39) or {+-}size{KMGTP}:
 
It does not accept 40 either. Only 34, but then.. stuck. 39?

No. I see what needs to be done. The alignment needs to be changed from 2048 to 1 first then it will let you use 40. But you'll have to force quit with control-c losing all changes thus far. So here it is starting from the beginning:

Code:
sudo gdisk /dev/disk0
r     [recovery/transformation menu]
f     [create fresh GPT from MBR]
y     [yes I really want to destroy the GPT]
x     [expert menu]
l     [that is an 'el', change alignment value]
1     [that is a 'one']
m     [go back to the main menu]
n     [add partition]
<return>    [accept the default]
40      [first sector]
409639  [end sector]
EF00    [EFI System partition type code]
s       [sort  partitions]
r       [recovery transform menu]
h       [new hybrid mbr]
2 3     [add partitions 2 and 3 to the MBR]
y       [EFI GPT first, yes]
<return>   [accept default code]
n       [do not make bootable]
<return> [ accept default code]
y       [make bootable]
n       [do not protect more partitions]
o
p

So I just ran through this in a virtual machine on a virtual disk of the same size and original partitioning as yours, and it appears to work.

I do still suggest posting the last results displayed from the 'o' and 'p' commands before issuing the 'w' command.
 
I am afraid i have cmd+c before, so i am doing this from start

Code:
GPT fdisk (gdisk) version 0.8.5

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

Found valid GPT with hybrid MBR; using GPT.

Command (? for help): r

Recovery/transformation command (? for help): f
Warning! This will destroy the currently defined partitions! Proceed? (Y/N): y

Recovery/transformation command (? for help): p
Disk /dev/disk0: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): AB17DF12-863C-4BAD-985A-EB61EA846B42
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 429137 sectors (209.5 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   2          409640      1683420823   802.5 GiB   AF00  
   3      1683435285      1953520064   128.8 GiB   0700  

Recovery/transformation command (? for help): o

Disk size is 1953525168 sectors (931.5 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1   1953525167   primary     0xEE

Recovery/transformation command (? for help): m

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-1953525134, default = 2048) or {+-}size{KMGTP}: 40
Information: Moved requested sector from 40 to 2048 in
order to align on 2048-sector boundaries.
Use 'l' on the experts' menu to adjust alignment
Last sector (2048-409639, default = 409639) or {+-}size{KMGTP}: 409639
Current type is 'Apple HFS/HFS+'
Hex code or GUID (L to show codes, Enter = AF00): ef00
Changed type of partition to 'EFI System'
Bogus UTF-16 name found in GPTPart::SetName()! Name not changed!

Command (? for help): s
You may need to edit /etc/fstab and/or your boot loader configuration!

Command (? for help): r

Recovery/transformation command (? for help): h

WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
just hit the Enter key at the below prompt and your MBR partition table will
be untouched.

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 2 3
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y

somewhere here i missed one command and spoiled it (i press no for default thinking it was concerning bootable). Does this info changes something or should i follow your latest guide?
 
I think i've done it correct

I gave it a try and followed your latest commands (with l for alignment).
I think that at the end it seems like it should be (correct).

I am waiting for a confirmation to w (write)


Code:
Recovery/transformation command (? for help): o

Disk size is 1953525168 sectors (931.5 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1       409639   primary     0xEE
   2                409640   1683420823   primary     0xAF
   3      *     1683435285   1953520064   primary     0x07

Recovery/transformation command (? for help): p
Disk /dev/disk0: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): EDF21596-E6D7-40F0-9A99-A391DAB31C77
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 1-sector boundaries
Total free space is 19537 sectors (9.5 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640      1683420823   802.5 GiB   AF00  
   3      1683435285      1953520064   128.8 GiB   0700  

Recovery/transformation command (? for help):
 
Last edited:
ok

ok, i did "w" and after a sudo reboot command, Bootcamp appeared again on my Desktop! as NTFS mounted disk. But it could not boot into W7 in it showing the message:


After repair, it gave me this screen


Finally Bootcamp DID start!!! THANK YOU SO MUCH!!!
So i made a winclone image of it from inside SL and backedup again everything with Time Machine. So i think i am ready to change the Hard disk.
Is anything else i should pay attention to?
Thanks again, Alex


Code:
iMac:~ alexv$ sudo gdisk -l /dev/disk0
GPT fdisk (gdisk) version 0.8.5

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

Found valid GPT with hybrid MBR; using GPT.
Disk /dev/disk0: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): AEC64B92-2C41-4B1D-9772-EDC4FDBDF5A4
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 8-sector boundaries
Total free space is 19537 sectors (9.5 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640      1683420823   802.5 GiB   AF00  
   3      1683435285      1953520064   128.8 GiB   0700  

iMac:~ alexv$ sudo gpt -r -vv show disk0
gpt show: disk0: mediasize=1000204886016; sectorsize=512; blocks=1953525168
gpt show: disk0: Suspicious MBR at sector 0
gpt show: disk0: Pri GPT at sector 1
gpt show: disk0: Sec GPT at sector 1953525167
       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  1683011184      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  1683420824       14461         
  1683435285   270084780      3  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1953520065        5070         
  1953525135          32         Sec GPT table
  1953525167           1         Sec GPT header
 

Attachments

  • boot failed.JPG
    boot failed.JPG
    500.9 KB · Views: 280
  • after repair.JPG
    after repair.JPG
    808.6 KB · Views: 249
Hello everyone!
I have a similar problem with mismatched/unsynced MBR and GPT, though I only learned that from this exact post - thank you for that.

Chris Murphy (murphychris), could you please help out with my specific situation? I hope you're not too sick of this.

I have OS X Lion and W7 Boot Camp. I DID resize my BootCamp partition (and possibly my OS X partition) through an app in W7 (though I forget exactly which one). I did not know there was a problem for months, until I logged into Lion, updated OS X, rebooted and attempted to log back into W7...

Now I get this message:
No bootable device --- insert boot disk and press any key

and OS X can't access the partition as NTFS, labeling it "disk0s4"

----------------------------------------------------------------------------------------------------------------

My gdisk Terminal command results are:

Code:
sudo gpt -r -vv show disk0

gpt show: disk0: mediasize=500107862016; sectorsize=512; blocks=976773168
gpt show: disk0: Suspicious MBR at sector 0
gpt show: disk0: Pri GPT at sector 1
gpt show: disk0: Sec GPT at sector 976773167
      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  821855000      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  822264640    1367192      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  823631832   55099432         
  878731264   98041856      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  976773120         15         
  976773135         32         Sec GPT table
  976773167          1         Sec GPT header

Code:
sudo gdisk -l /dev/disk0

GPT fdisk (gdisk) version 0.8.5

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

Found valid GPT with hybrid MBR; using GPT.
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): E9E5D469-91DB-4790-8196-991FBD914D6F
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773132
Partitions will be aligned on 8-sector boundaries
Total free space is 55099451 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       822264639   391.9 GiB   AF00  Macintosh HD
   3       822264640       823631831   667.6 MiB   AB00  Recovery HD
   4       878731264       976773119   46.8 GiB    0700  BOOTCAMP

Code:
sudo fdisk /dev/disk0
Disk: /dev/disk0	geometry: 60801/255/63 [976773168 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 -  821855000] HFS+        
 3: AB 1023 254  63 - 1023 254  63 [ 822264640 -    1367192] Darwin Boot 
*4: 0B 1023 254  63 - 1023 254  63 [ 878731264 -   98041856] Win95 FAT-32


The bug on my system seems to be a more or less simple mismatch (from the little I know about this) but I do not what and how to match it.

Please help, I'm dumb and didn't back up often (this situation change that) and it's important I retrieve that partition in tact.

Thank you in advance.

-Andre
 
Hello everyone!
I have a similar problem with mismatched/unsynced MBR and GPT, though I only learned that from this exact post - thank you for that.

Except they aren't mismatched, I'm not sure why you think they are. The only thing that's suspicious to me is the Windows entry in the MBR:

Code:
*4: 0B 1023 254  63 - 1023 254  63 [ 878731264 -   98041856] Win95 FAT-32

The type code 0B implies to me this partition has been formatted FAT32. Windows 7 uses NTFS. Either the type code is wrong, or it's been formatted FAT32.

Code:
dd if=/dev/disk0s4 of=~/4sdisk0s4.bin count=4
hexdump -C ~/4sdisk0.bin

This will write out 4 sectors of the 4th partition to a file in your home folder, and the second command displays the 4 sectors. Copy-paste that into the forum, with the code tags so it formats properly. We'll see if it's NTFS or FAT32.
 
Thank you for your prompt reply Chris/Murphy!

Unfortunately though, I got really impatient last night and thought that I can study the crap out of this post (especially your instruction as well as the changes in your instruction stemming from the replies of the OP) and that I could do it myself.

Forgive me for I may also be using the wrong jargon. When I said "mismatch" I meant generally that something is off because OS X wouldn't recognize the partition, and also I noticed that the code for partition 4 is not 07 as it seemingly should be based on everything else in this post/thread.

I also forgot to mention that before I found this post yesterday, I found another one and followed the advice to resize the OS X partition a little and then resize back, and that Disk Utility might fix everything on its own. That of course did not happen, but now there might be an actual sizing mismatch, though I wouldn't know about to how to verify. I will ad though that in Disk Utility, I have the OS X partition as well as the disk0s4, however, between them, there is a bunch of unused space. That should not be. That's not how it was when I left OS X to use Windows 7 for months, and that's not how it was in Windows 7 during the whole time I was working in it.

So, anyway, I went ahead and tried to make an MBR from the GPT and I got this:

Code:
Recovery/transformation command (? for help): g

MBR command (? for help): ?
a	toggle the active/boot flag
c	recompute all CHS values
l	set partition as logical
o	omit partition
p	print the MBR partition table
q	quit without saving changes
r	set partition as primary
s	sort MBR partitions
t	change partition type code
w	write the MBR partition table to disk and exit

MBR command (? for help): p

** NOTE: Partition numbers do NOT indicate final primary/logical status,
** unlike in most MBR partitioning tools!

** Extended partitions are not displayed, but will be generated as required.

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x15E666CE
MBR partitions:

                                                   Can Be   Can Be
Number  Boot  Start Sector   End Sector   Status   Logical  Primary   Code
   1                    40       409639   primary     Y        Y      0xEF
   2                409640    822264639   primary              Y      0xAF
   3             822264640    823631831   primary              Y      0xAB
   4             878731264    976773119   primary     Y        Y      0x07

MBR command (? for help): w

Converted 4 partitions. Finalize and exit? (Y/N): y
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Andre-Bulatovs-MacBook-Pro:~ andrebulatov$ sudo gdisk /dev/disk0
GPT fdisk (gdisk) version 0.8.5

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


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if
you don't want to convert your MBR partitions to GPT format!
***************************************************************

Bogus UTF-16 name found in GPTPart::SetName()! Name not changed!
Bogus UTF-16 name found in GPTPart::SetName()! Name not changed!

So then, I freaked out, calmed down and attempted to recreate the table that now went poof (I honestly thought that since the GPT was intact, it would reate a matching MBR from it, but instead, it deleted 3 partitions. Clearly, there is knowledge I am missing which confidently led me to the wrong conclusion.)

Anyway, here is the result of my ignorant labor:

Code:
Command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk0.
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.
Andre-Bulatovs-MacBook-Pro:~ andrebulatov$ sudo gdisk /dev/disk0
GPT fdisk (gdisk) version 0.8.5

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

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Command (? for help): r

Recovery/transformation command (? for help): o

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1    976773167   primary     0xEE

Recovery/transformation command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Recovery/transformation command (? for help): h

WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
just hit the Enter key at the below prompt and your MBR partition table will
be untouched.

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 2 3 4
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default AF): 
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #3 (MBR partition #3)
Enter an MBR hex code (default AB): 
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #4 (MBR partition #4)
Enter an MBR hex code (default 07): 
Set the bootable flag? (Y/N): y

Recovery/transformation command (? for help): o

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1       409639   primary     0xEE
   2                409640    822264639   primary     0xAF
   3             822264640    823631831   primary     0xAB
   4      *      878731264    976773119   primary     0x07

Recovery/transformation command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Recovery/transformation command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk0.
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.
Andre-Bulatovs-MacBook-Pro:~ andrebulatov$ ?
-bash: ?: command not found
Andre-Bulatovs-MacBook-Pro:~ andrebulatov$ sudo gdisk /dev/disk0
GPT fdisk (gdisk) version 0.8.5

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

Found valid GPT with hybrid MBR; using GPT.

Command (? for help): r

Recovery/transformation command (? for help): o

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1       409639   primary     0xEE
   2                409640    822264639   primary     0xAF
   3             822264640    823631831   primary     0xAB
   4      *      878731264    976773119   primary     0x07

Recovery/transformation command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Recovery/transformation command (? for help):

Now, the tables seem intact and matching, but OS X still sees the partition as disk0s4 and won't read it or repair it, and W7 still does not boot and actually now says
No operating system found
I am assuming the operating system was destroyed by me when I resized the OS X partition over onto the W7 partition...

Also, I have rEFIt installed, and when I restart the laptop and hold down Option, I get the typical Mac menu except instead of Macintosh, it has rEFIt as a choice, then Windows and Recovery. If I choose windows I get the No OS message, if I choose rEFIt, I get the rEFIt menu with OS X and Legacy options. OS X of course works well, I am here now.

Please advise dear kind wiseman Chris.

- Andre
 
Thank you for your prompt reply Chris/Murphy!

Unfortunately though, I got really impatient last night and thought that I can study the crap out of this post (especially your instruction as well as the changes in your instruction stemming from the replies of the OP) and that I could do it myself.

Forgive me for I may also be using the wrong jargon. When I said "mismatch" I meant generally that something is off because OS X wouldn't recognize the partition, and also I noticed that the code for partition 4 is not 07 as it seemingly should be based on everything else in this post/thread.

I also forgot to mention that before I found this post yesterday, I found another one and followed the advice to resize the OS X partition a little and then resize back, and that Disk Utility might fix everything on its own. That of course did not happen, but now there might be an actual sizing mismatch, though I wouldn't know about to how to verify. I will ad though that in Disk Utility, I have the OS X partition as well as the disk0s4, however, between them, there is a bunch of unused space. That should not be. That's not how it was when I left OS X to use Windows 7 for months, and that's not how it was in Windows 7 during the whole time I was working in it.

So, anyway, I went ahead and tried to make an MBR from the GPT and I got this:

Code:
Recovery/transformation command (? for help): g

MBR command (? for help): ?
a	toggle the active/boot flag
c	recompute all CHS values
l	set partition as logical
o	omit partition
p	print the MBR partition table
q	quit without saving changes
r	set partition as primary
s	sort MBR partitions
t	change partition type code
w	write the MBR partition table to disk and exit

MBR command (? for help): p

** NOTE: Partition numbers do NOT indicate final primary/logical status,
** unlike in most MBR partitioning tools!

** Extended partitions are not displayed, but will be generated as required.

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x15E666CE
MBR partitions:

                                                   Can Be   Can Be
Number  Boot  Start Sector   End Sector   Status   Logical  Primary   Code
   1                    40       409639   primary     Y        Y      0xEF
   2                409640    822264639   primary              Y      0xAF
   3             822264640    823631831   primary              Y      0xAB
   4             878731264    976773119   primary     Y        Y      0x07

MBR command (? for help): w

Converted 4 partitions. Finalize and exit? (Y/N): y
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Andre-Bulatovs-MacBook-Pro:~ andrebulatov$ sudo gdisk /dev/disk0
GPT fdisk (gdisk) version 0.8.5

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


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if
you don't want to convert your MBR partitions to GPT format!
***************************************************************

Bogus UTF-16 name found in GPTPart::SetName()! Name not changed!
Bogus UTF-16 name found in GPTPart::SetName()! Name not changed!

So then, I freaked out, calmed down and attempted to recreate the table that now went poof (I honestly thought that since the GPT was intact, it would reate a matching MBR from it, but instead, it deleted 3 partitions. Clearly, there is knowledge I am missing which confidently led me to the wrong conclusion.)

Anyway, here is the result of my ignorant labor:

Code:
Command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk0.
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.
Andre-Bulatovs-MacBook-Pro:~ andrebulatov$ sudo gdisk /dev/disk0
GPT fdisk (gdisk) version 0.8.5

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

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Command (? for help): r

Recovery/transformation command (? for help): o

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1    976773167   primary     0xEE

Recovery/transformation command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Recovery/transformation command (? for help): h

WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
just hit the Enter key at the below prompt and your MBR partition table will
be untouched.

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 2 3 4
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default AF): 
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #3 (MBR partition #3)
Enter an MBR hex code (default AB): 
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #4 (MBR partition #4)
Enter an MBR hex code (default 07): 
Set the bootable flag? (Y/N): y

Recovery/transformation command (? for help): o

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1       409639   primary     0xEE
   2                409640    822264639   primary     0xAF
   3             822264640    823631831   primary     0xAB
   4      *      878731264    976773119   primary     0x07

Recovery/transformation command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Recovery/transformation command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk0.
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.
Andre-Bulatovs-MacBook-Pro:~ andrebulatov$ ?
-bash: ?: command not found
Andre-Bulatovs-MacBook-Pro:~ andrebulatov$ sudo gdisk /dev/disk0
GPT fdisk (gdisk) version 0.8.5

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

Found valid GPT with hybrid MBR; using GPT.

Command (? for help): r

Recovery/transformation command (? for help): o

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1       409639   primary     0xEE
   2                409640    822264639   primary     0xAF
   3             822264640    823631831   primary     0xAB
   4      *      878731264    976773119   primary     0x07

Recovery/transformation command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 151C89F8-FD1C-42D3-A0A3-6AFC2AFDB104
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 55099453 sectors (26.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       822264639   391.9 GiB   AF00  
   3       822264640       823631831   667.6 MiB   AB00  
   4       878731264       976773119   46.8 GiB    0700  

Recovery/transformation command (? for help):

Now, the tables seem intact and matching, but OS X still sees the partition as disk0s4 and won't read it or repair it, and W7 still does not boot and actually now says
No operating system found
I am assuming the operating system was destroyed by me when I resized the OS X partition over onto the W7 partition...

Also, I have rEFIt installed, and when I restart the laptop and hold down Option, I get the typical Mac menu except instead of Macintosh, it has rEFIt as a choice, then Windows and Recovery. If I choose windows I get the No OS message, if I choose rEFIt, I get the rEFIt menu with OS X and Legacy options. OS X of course works well, I am here now.

When I try the command you just gave me, I get:

Code:
Andre-Bulatovs-MacBook-Pro:~ andrebulatov$ dd if=/dev/disk0s4 of=~/4sdisk0s4.bin count=4
dd: /dev/disk0s4: Permission denied

Please advise dear kind wiseman Chris.

- Andre
 
Same as what I asked for the first time.

Code:
dd if=/dev/disk0s4 of=~/4sdisk0s4.bin count=4
hexdump -C ~/4sdisk0.bin

Best if you copy-paste each line, that character after the second equals sign is a tilde.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.