You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Resized bootcamp. MBR updated. GPT is not. Understanding and fixing.

So I resized my bootcamp partition. I did this through downsizing in diskutil and then using a partition manager in windows to expand to the left. This seemed to work great. I was able to still boot into Windows, but Mac OSX did not see my Bootcamp partition, nor did it recognize the the enlargement of the bootcamp partition.


I reason that this is due to the fact that the MBR has been updated, but the GPT has not. I need to sync my MBR to my GPT.


One speed bump in this was that I synced my GPT to my MBR with rEFIT, which broke my booting into bootcamp. I was able to fix this and get back to booting both windows/mac with incorrect gpt. I did this with fdisk and testdisk, editing my partition 4 to have the same size as the partition in testdisk which was able to list my NTFS files successfully. This worked beautifully.



Now I'm back to need to fix my GPT. However I also want to save my Recovery partition. I'm confused on where my recovery partition was moved to during the resize in Diskutility intiatilly. Does diskutility just move the recovery partition along with the HFS partition but just not show you.


What is also super strange is that I can still mount the recovery partition and examine it and it looks to be intact.


diskutil mount disk0s3


I've dd'ed the partition off (650MB) to a safe place just to be sure.


sudo dd if=/dev/disk0s3 of=/Users/bobharris/Desktop/RecoveryBack.bin




obharriss-mbp:~ bobharris$ diskutil list

/dev/disk0

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *750.2 GB disk0

1: EFI EFI 209.7 MB disk0s1

2: Apple_HFS Macintosh HD 500.0 GB disk0s2

3: Apple_Boot Recovery HD 650.0 MB disk0s3

4: Microsoft Basic Data 148.0 GB disk0s4

/dev/disk1

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *1.0 TB disk1

1: Microsoft Basic Data 1TB 1.0 TB disk1s1


What I did to fix my MBR when I overwrote with GPT so as to fix bootcamp to booting again.


TestDisk 6.14, Data Recovery Utility, July 2013

Christophe GRENIER <grenier@cgsecurity.org>

http://www.cgsecurity.org


Disk /dev/disk0 - 750 GB / 698 GiB - 1465149168 sectors (RO)

Partition Start End Size in sectors

P EFI System 40 409639 409600 [EFI]

Mac HFS 409640 976972135 976562496

MS Data 491339784 978243584 486903801

Mac HFS 976972136 978241679 1269544

>P MS Data 978243584 1465147384 486903801 [BOOTCAMP]

MS Data 1176088576 1465147391 289058816 [BOOTCAMP]

Mac HFS 1463879584 1465149127 1269544


fdisk: 1> edit 4

Starting Ending

#: id cyl hd sec - cyl hd sec [ start - size]

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

*4: 07 1023 254 63 - 1023 254 63 [1176088576 - 289058816] HPFS/QNX/AUX


Partition id ('0' to disable) [0 - FF]: [7] (? for help) 07

Do you wish to edit in CHS mode? [n] n

Partition offset [0 - 1465149168]: [978241680] 978243584

Partition size [1 - 486905584]: [486905584] 486903801

fdisk:*1> write

Device could not be accessed exclusively.

A reboot will be needed for changes to take effect. OK? [n] y

Writing MBR at offset 0.

Some outputs that seem relevant from google searching...This is my computer as is now.


bobharriss-MacBook-Pro:~ bobharris$ sudo gpt -r -vv show disk0

gpt show: disk0: mediasize=750156374016; sectorsize=512; blocks=1465149168

gpt show: disk0: Suspicious MBR at sector 0

gpt show: disk0: Pri GPT at sector 1

gpt show: disk0: Sec GPT at sector 1465149167

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 976562496 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC

976972136 1269544 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC

978241680 197846896

1176088576 289058816 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

1465147392 1743

1465149135 32 Sec GPT table

1465149167 1 Sec GPT header



I might edit this with more command outputs.


So resizing partitions in fdisk and gdisk, seem different. One is MBR. The other GPT. In fdisk you can edit a partition. However in gdisk, it seems I must delete and rebuild my 3 partitions. Not so bad given a constant offset that I now know. However I can't account for the recovery partition that is still mounting. I would have thought it would be lost, essentially shifted by the new free space.


So. How can I resize my GPT too account for new sizes. How can I save my recovery partition. Why can I still somehow mount my recovery partition with diskutil? Many thank for taking the time to look at this post and putting up with some typos.

MacBook Pro, OS X Mavericks (10.9)

Posted on Feb 7, 2014 10:15 PM

Reply
9 replies

Feb 28, 2014 7:30 PM in response to bob_harris

Solved!


Use gdisk. Go into Recovery Menu. Execute

f load MBR and build fresh GPT from it

and then do a

w on the main menu

to write changes.



Fixed. That was easy! So essentially, You can resize in Mac OS. Grow the partition to the left with an MBR aware utility, then run gdisk back in OSX to refresh GPT so that Bootcamp is once again seen from OSx.


Hope this helps someone someday.

Mar 1, 2014 6:39 PM in response to Number88

My post 2 up ended up not working. While MacOSX now sees the bootcamp partition, I can no longer boot into it. The boot up process complains of no media. So I restored my partition back I made in gdisk. These outputs are from after I restored my backup, and can again boot into Windows, but MacOSX does not see bootcamp and the disk manager reports wrong partition sizes.



bobharriss-mbp:~ bobharris$ sudo gpt -r -vv show disk0

gpt show: disk0: mediasize=750156374016; sectorsize=512; blocks=1465149168

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

bobharriss-mbp:~ bobharris$ sudo fdisk /dev/disk0

Disk: /dev/disk0 geometry: 91201/255/63 [1465149168 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 - 976562496] HFS+

3: AB 1023 254 63 - 1023 254 63 [ 976972136 - 1269544] Darwin Boot

*4: 07 1023 254 63 - 1023 254 63 [ 978243584 - 486903801] HPFS/QNX/AUX

bobharriss-mbp:~ bobharris$

Mar 2, 2014 12:20 PM in response to Number88

Okay. W/O CampTune OR reformating my entire computer, I've fixed it. Using GDISK and my brain, w/o paying $$$ for camptune.



sudo gdisk /dev/disk0

Command (? for help): d

Partition number (1-4): 4


Command (? for help): n

Partition number (4-128, default 4): 4

First sector (34-1465149134, default = 978241680) or {+-}size{KMGTP}: 978243584

Last sector (978243584-1465149134, default = 1465149134) or {+-}size{KMGTP}: 1465147384

Current type is 'Apple HFS/HFS+'

Hex code or GUID (L to show codes, Enter = AF00): 0700

Changed type of partition to 'Microsoft basic data'


Bootcamp is now bootable and viewable from Mavericks. Ending sector 1465147384 being the sector which the MBR aware utilities produced inside windows....but no longer reflected in the GPT. I probably would have gotten start and end sectors from an fdisk command, but instead I had to get them from testdisk as I had accidentally overwritten MBR with GPT info after resizing the MBR in Windows. This error occured in by using an option in rEFit without knowing what I was doing. Of note, no mods to Hybrid MBR were needed in total. Also of note. BACK UP your partitions in GDISK before you do anything. I had to reload my backup a couple of times before I got it right.


How to resize your bootcamp partition!

1) Shrink your MACOSx partition in Disk Utility [OSX]

2) Grow your Windows partition to the left using a utility [Win7] [Blanking on what I used.But it was a free windows based partition manager, not gparted.]

3) Delete and Recreate the Bootcamp parition using GDISK, using values reflected by an MBR aware usility, FDISK. [OSX]

4) Done.


Thanks to Rod Smith for his awesome utliity.



Found the utility I used for grow to the left in Windows 7 in step 2.

http://www.partitionwizard.com/free-partition-manager.html

Resized bootcamp. MBR updated. GPT is not. Understanding and fixing.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.