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

mfvisuals

macrumors regular
Original poster
Sep 9, 2009
193
71
SacTown, CA
Couldn't find any articles relating to my issue, so here goes:

I recently found the need to resize my bootcamp partition to make it larger.
It's running Windows 7 64bit.

On my Mac side, I have Paragon NTFS 9.5 and Winclone 3.3.

I tried to use Winclone to resize the partition but could never get it to work. It refused to even modify the partition in any way.

Disk Utility would not let me change the size of the drive either and that was AFTER resizing my startup partition to free up some drive space to allocate to the Bootcamp partition.

I tried booting Windows and running a few Windows tools that claim to resize the disk during boot time, but I kept getting error messages about the partition scheme changing during boot and that wouldn't work.

Finally, I downloaded and burned a GParted disk image to a CD and ran that on boot. GParted was able to resize and reallocate all free space to the BootCamp partition.

However, I rebooted after it finished and when I try to boot the BootCamp partition it says no bootable device can be found.

I can still boot to OS X fine. Startup Disk in System Preferences shows the BootCamp partition as a valid system to start up.

Paragon driver is currently disabled.

Any idea how I can fix this?
 
Last edited:

murphychris

macrumors 6502a
Mar 19, 2012
661
2
Apple's Windows support uses an EFI CSM to "emulate" BIOS, which requires an MBR partition scheme. So Apple creates a hybrid MBR/GPT partition scheme in order to support Windows. Gparted depends on parted, which upon resizing a volume, rewrites the GPT and obliterates the MBR.

The CSM-BIOS thus can't find a valid MBR partition to boot from.

So what you need to do is download GPT fdisk (also known as gdisk) off SourceForge. It's a command line only application. You will need to learn how to use gdisk is interactive mode, go to the recovery menu, create a new hybrid MBR, add the Windows partition to the MBR, and set its boot flag, write out the new partition. Now you'll be able to boot Windows.

Before you begin, if you want, you can go to Terminal and type this command

Code:
sudo gpt -r -vv show /dev/rdisk0

This is a read only command and will display information on the MBR and GPT on the disk. Post that. Please highlight the pasted result in the forum entry window and use the # button in advanced editing to add code tags so the result formats legibly.
 

mfvisuals

macrumors regular
Original poster
Sep 9, 2009
193
71
SacTown, CA
Code:
gpt show: /dev/rdisk0: mediasize=500107862016; sectorsize=512; blocks=976773168
gpt show: /dev/rdisk0: PMBR at sector 0
gpt show: /dev/rdisk0: Pri GPT at sector 1
gpt show: /dev/rdisk0: Sec GPT at sector 976773167
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  853515624      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  853925264    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  855194800        848         
  855195648  121575424      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  976771072       2063         
  976773135         32         Sec GPT table
  976773167          1         Sec GPT header

Info requested provided above. I've also installed GPT fdisk onto my Mac. It says it includes something called "fixparts" which, based on the description, sounds like it might fix my issue.

In any case, I'll wait for your response first, and I appreciate the help.
 
Last edited:

murphychris

macrumors 6502a
Mar 19, 2012
661
2
I've also installed GPT fdisk onto my Mac. It says it includes something called "fixparts" which, based on the description, sounds like it might fix my issue.

No fixparts is going to make repairs on the GPT, and the problem is not with the GPT on your drive. The problem is the MBR only contains a single entry that basically says "this is a GPT disk only" and the CSM-BIOS doesn't know how to deal with that.

So first you're going to make backups of all important data, just in case. Then you're going to run gdisk in interactive mode:
Code:
sudo gdisk /dev/disk0
? gets you a list of commands
r will take you to the recovery menu
? lists recovery commands
h to create a new hybrid MBR

If you want to do it Apple's way, you can enter 2 3 4 to add all of your partitions to the MBR. Gdisk will then ask for each of those partitions if you want to accept the default partition type, which you do by just hitting return, and if you want to set the boot flag for that partition. You do not want the boot flag set for partitions 2 and 3, just for 4 - the Windows partition.

When done, you'll use the w command to write the new partition maps to disk.

So now I bet it either works, or you get a totally different error. We'll cross the totally different error bridge if you get to it.
 

mfvisuals

macrumors regular
Original poster
Sep 9, 2009
193
71
SacTown, CA
Not sure if this is related, but I just noticed that my Recovery HD partition (although still bootable) is now showing up in my Finder window... is there a way to hide that again?

Anyway, I ran through the steps with gdisk, didn't get any errors.

I restarted my Mac and tried to load the BootCamp partition and got the message:

Code:
BOOTMGR is missing
Press Ctrl+Alt+Del to restart

Can I repair that using Windows Install DVD?
 

murphychris

macrumors 6502a
Mar 19, 2012
661
2
Not sure if this is related, but I just noticed that my Recovery HD partition (although still bootable) is now showing up in my Finder window... is there a way to hide that again?

Weird. What are the results from:
Code:
sudo fdisk /dev/disk0


Can I repair that using Windows Install DVD?

Yes. You'll get an option to "Repair your computer" and then a System Recovery Options where you choose Startup Repair. That will replace the boot loaders on the disk. Likely the one in the first 440 bytes of the MBR is either toast or pointing to the wrong location. This should fix it.
 

mfvisuals

macrumors regular
Original poster
Sep 9, 2009
193
71
SacTown, CA
I tried running the auto repair option from the Windows 7 disc several times but it kept saying there was corrupt data on the partition and didn't indicate whether anything had actually been fixed.

I attempted to start the Windows partition, got the Windows 7 animated loading icon and then got a BSOD followed by an immediate, automatic reboot of the computer.

I decided to go ahead and just erase the BootCamp partition, reallocate the space to my Macintosh HD, and then recreate the BootCamp partition.

Naturally, however, it didn't go all to plan.

After I deleted the BootCamp partition via Disk Utility, the only partitions leftover were Macintosh HD and Recovery HD. I could not expand the Macintosh HD to reclaim the unallocated space and the unallocated space doesn't even show up in Disk Utility.

I booted GParted just to confirm that the unallocated space did, in fact, exist. And it does. All 59 gigs of it.

However, I cannot figure out how to reallocate that space back to the Macintosh HD partition.

Macintosh HD and Recovery HD are still operating normally. I even ran Disk Utility from the Recovery HD and did a repair disk operation, which indicated that some EFI errors had been fixed, but did nothing to reveal the unallocated HDD space.

Ideas?

PS - In case it helps, upon running reFit Partition Inspector got this:

Code:
*** Report for internal hard disk ***

Current GPT partition table:
 #      Start LBA      End LBA  Type
 1             40       409639  EFI System (FAT)
 2         409640    853663119  Mac OS X HFS+
 3      853925264    855194799  Mac OS X HFS+

Current MBR partition table:
 # A    Start LBA      End LBA  Type
 1              1    976773167  ee  EFI Protective

MBR contents:
 Boot Code: Unknown, but bootable

Partition at LBA 40:
 Boot Code: None (Non-system disk message)
 File System: FAT32
 Listed in GPT as partition 1, type EFI System (FAT)

Partition at LBA 409640:
 Boot Code: None
 File System: HFS Extended (HFS+)
 Listed in GPT as partition 2, type Mac OS X HFS+

Partition at LBA 853925264:
 Boot Code: None
 File System: HFS Extended (HFS+)
 Listed in GPT as partition 3, type Mac OS X HFS+
 

murphychris

macrumors 6502a
Mar 19, 2012
661
2
Code:
diskutil resizevolume disk0s2 limits
Code:
diskutil info disk0s2


----------

Please post the results for those two commands. They are read only commands and do not modify anything.
 

mfvisuals

macrumors regular
Original poster
Sep 9, 2009
193
71
SacTown, CA
Ok, so that resized the partition, but now I've hit one final snag.

Upon running Boot Camp Assistant, I got the message:

The startup disk cannot be partitioned or restored to a single partition.

The startup disk must be formatted as a single Mac OS Extended (Journaled) volume or already partitioned by Boot Camp Assistant for installing Windows.

I'm going to attempt to repair the disk again via Disk Utility in Recovery HD.
I also read somewhere that defragging the drive can help...
 

murphychris

macrumors 6502a
Mar 19, 2012
661
2
Ok, so that resized the partition,

No it did not. "diskutil resizevolume disk0s2 limits" only reports back the minimum and maximum resizing possible.

I'm going to attempt to repair the disk again via Disk Utility in Recovery HD. I also read somewhere that defragging the drive can help...

This is why I find native booting of Windows to be irritating. VM is so much easier.
 

mfvisuals

macrumors regular
Original poster
Sep 9, 2009
193
71
SacTown, CA
murphychris said:
mfvisuals said:
Ok, so that resized the partition,
No it did not. "diskutil resizevolume disk0s2 limits" only reports back the minimum and maximum resizing possible.

You're correct. I had a brain fart there during that response.
I did run those commands to display the extra space, but then used iPartition to resize the partition myself manually. That worked fine, and then of course I got the message that I mentioned before from Boot Camp Assistant.

Since I already had the Boot Camp 4.0 software saved to a flash drive, I ended up shrinking my Macintosh HD partition again with Disk Utility, then formatted the empty space (now that it was showing in Disk Utility) to a FAT partition onto which I reinstalled Windows 7.

After reinstalling the Boot Camp 4.0 software and installing 2 trillion (sarcasm, really about 116) Windows updates, everything is working good again.

Thanks for your help. I might not have been able to repartition the drive prior to following your instructions for gdisk.

murphychris said:
This is why I find native booting of Windows to be irritating. VM is so much easier.

I have opted for this BootCamp type installation because it yields far better performance in my experience for gaming and the system overall, provided I have all the right drivers installed.
 
Last edited:

selladore

macrumors newbie
Oct 29, 2013
4
0
First of all, sorry for getting this old thread up. I've got here through intense google search as I searched for a solution to get my windows partition to work again.

I had a pretty similar problem resizing my OS X partition, to add a new ntfs partition for use with Windows. Now I ended up not being able to boot Windows anymore, then I tried the way murphychris recommended and voilá I could boot Windows again, but.. not entirely - it was in an endless circle in the bootup screen of Windows.

The next thing I've tried was to delete the new partition I made and let it be as it was before, but I guess I messed something up and I don't know how to explain it (english isn't my native language) but here is what I ended up with now:

GdgkByt.png

lcB7D5N.png


The 132GB sized "disk0s3" should be my Windows 7 partition formated in ntfs. Is there some way to rescue it? There are some important files of mine and stupid as I am, I didn't make a backup before all of this, because of the lack of an external harddrive.

I really hope someone here can help me with the mess I made :x
 
Last edited:

selladore

macrumors newbie
Oct 29, 2013
4
0
Code:
Disk: /dev/rdisk0	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 - 1694500824] HFS+        
*3: FF 1023 254  63 - 1023 254  63 [1695172608 -  258351104] Xenix BBT   
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused
 

murphychris

macrumors 6502a
Mar 19, 2012
661
2
@selladore

The MBR and GPT are the same, so that's good. The problem is the partitiontypeGUID for partition 3 is incorrect, it's all F's, and when you created the hybrid MBR most recently it also inherited the FFs from the GPT.

So you need to change the partition type code for the 3rd partition, using gdisk, to 0700. And then create a new hybrid MBR just as you have before, and by default it'll get the right type code also.
 

o2themar

macrumors newbie
Oct 26, 2013
13
0
I am having a similar problem to this. So when I first created my windows partition I allocated 50GB for it. Later I realized I needed more space so I shrunk my mac partition and used a third party tool to increase my windows partition without erasing and reinstalling windows. So what happened then is I recently decided to upgrade to Mavricks and that completely removed my windows partition at boot. The partition is there but it doesn't appear at boot and disk utility doesn't recognize it. So using the command you said to you this is what I got:
gpt show: /dev/rdisk0: mediasize=500107862016; sectorsize=512; blocks=976773168
gpt show: /dev/rdisk0: Suspicious MBR at sector 0
gpt show: /dev/rdisk0: Pri GPT at sector 1
gpt show: /dev/rdisk0: 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 776880976 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
777290616 199482519
976773135 32 Sec GPT table
976773167 1 Sec GPT header

----------


The above information is produced using sudo gpt -r -vv show /dev/rdisk0


Below are the contents produced using fdisk
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 - 776880976] HFS+
3: EE 1023 254 63 - 1023 254 63 [ 777290616 - 199482552] <Unknown ID>
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
 
Last edited:

murphychris

macrumors 6502a
Mar 19, 2012
661
2
@o2themar

No you have a different problem. Everyone else had four partitions, you have two. You're actually missing the Windows partition entirely as well as Recovery HD. But it's likely due to the same reasons as this problem.

Provide the result from
Code:
sudo fdisk /dev/rdisk0


----------

@o2themar

No you have a different problem. Everyone else had four partitions, you have two. You're actually missing the Windows partition entirely as well as Recovery HD. But it's likely due to the same reasons as this problem.

Provide the result from
Code:
sudo fdisk /dev/rdisk0

Ahh OK it got posted after I already replied.

So the MBR has 3 partitions, compared to the GPT which has 2. The MBR 3rd partition is 0xEE and there should only be one of those, so I don't know how you ended up with that, and therefore I have no idea how to help you fix this problem other than to suggest the link above, which in turn mentions a 52 page thread on Apple's forums. You can start on page 48 to work on the testdisk stuff and see if you can find the true start of the Windows partition. It will have a start sector after 777290616, maybe 777291776 since that's the closest 1MB aligned value.

Since everyone else has a Recovery HD and you don't, instead of deleting and then creating a new 4th partition, you have nothing to delete and you'll create a 3rd partition with the information you find from testdisk. When it comes time to make the hybrid MBR with gdisk, you'll only add partitions 2 3 rather than 2 3 4. Enter them just like that, with only space between.
 

selladore

macrumors newbie
Oct 29, 2013
4
0
@murphychris

I don't even understand what I just did, but you saved my ass! Thanks.
 
Last edited:

selladore

macrumors newbie
Oct 29, 2013
4
0
Just out of curiosity, as now I'm back from where I've started - is there some "secure" way of splitting my OS X partition into two, while the new one gets a ntfs formated "D:" partition, I could use with windows?

Or alternatively: Could I use Paragon HFS+ to use my OS X partition just as a second partition to Windows or are there some restrictions?
 

o2themar

macrumors newbie
Oct 26, 2013
13
0
So @murphychris
I would like to turn your attention to the results I got from testdisk. As you can see from the image that highlighted MS data is the one I want. It has the 101GB that I allocated for my windows partition. If this is correct how can I fix the partition table using this.
 

Attachments

  • Screen Shot 2013-10-30 at 1.32.11 AM.png
    Screen Shot 2013-10-30 at 1.32.11 AM.png
    51.9 KB · Views: 548

murphychris

macrumors 6502a
Mar 19, 2012
661
2
Just out of curiosity, as now I'm back from where I've started - is there some "secure" way of splitting my OS X partition into two, while the new one gets a ntfs formated "D:" partition, I could use with windows?

The nearly secure way of anything is multiple backups with a tested restore method, so that your penalty for an irreversible mistake is near zero. And I also haven't tested this, but it should be possible in your case because you're in the unique situation without a Recovery HD partition taking up one of only 4 slots in the MBR.

But the other question what's the point of separate partitions on the same disk? It tends to just increase seek times.

It's an open question how to do it though. I'd use diskutil resizevolume <device> limits to see the min-max sizes available. If the OS X volume is highly fragmented or full you won't be able to shrink it by much anyway.

And then you either need to take a blind leap of faith doing this with Disk Utility. Or diskutil resizevolume. And just check both MBR and GPT after each step to make sure things aren't getting out of sync. And for sure have current backups.

----------

@o2themar

Press P to list files. Make sure it doesn't say the filesystem is damaged/corrupt and you can actually navigate folders/files. You can even extract files at this point so you might consider doing that if there's something important you want.

Make a new window so you can keep the testdisk one up. And you'll need to use gdisk to create a new partition using the Start and End values from testdisk, when gdisk asks for First and Last sector values for the new partition. And use partition type code 0700. And then w to write out the change to disk. Reboot.

At this point you should have read only access of the Windows volume from the OS X Finder. Another opportunity to get at your files.

Next, you'll go back to gdisk and create a new hybrid MBR, adding, in your case, partitions 2 3, say yes to putting the EFI GPT in the first MBR entry, accept the default values for type/hex codes by just hitting return when asked, and don't make partition 2 bootable, but do make 3 bootable.
 

o2themar

macrumors newbie
Oct 26, 2013
13
0
Ok so I am able to retrieve files from using the p command on that volume. So you said to first create a new partition using the start and end values from testdisk using gdisk. Do I use the o command to create a new empty GUID partition table (GPT) or do I use the n command to add a new partition? Also ,even though I am not at that part yet, when I have read access in Windows would I do the second part in Windows or OSX?
 

murphychris

macrumors 6502a
Mar 19, 2012
661
2
Do I use the o command to create a new empty GUID partition table (GPT) or do I use the n command to add a new partition?

New partition. NOT new partition table! :eek: If you make a new partition table you'll nuke all of your data on the disk.

Also ,even though I am not at that part yet, when I have read access in Windows would I do the second part in Windows or OSX?

You will NOT have read access in Windows. You will have read-only access when rebooting OS X, in the Finder. And the 2nd part, to create the new hybrid MBR is done in OS X also in gdisk in its recovery menu.


-------

OK actually, since you posted your GPT to this forum, if you were to accidentally create a whole new GPT, while you would lose access to all of your data, it is recoverable. The partition table is not stored in the same location as your data so the data is completely intact.
 

o2themar

macrumors newbie
Oct 26, 2013
13
0
Ok so after doing the first part this is what I got:
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: Devices opened with shared lock will not have their
partition table automatically reloaded!

Caution: More than one 0xEE MBR partition found. This can cause problems
in some OSes.
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.

When I rebooted and held down the options key windows wasn't there. I am assuming that it shouldn't appear until I complete the second part is that correct? Also I do not see Windows in my finder. Did I do something wrong or did it just not work?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.