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.

My issue with bootcamp partition

Directed from the thread: Repairing Boot Camp after creating new partition.


Here's what happens when I type the "v" command:

Command (? for help): v


No problems found. 126900133 free sectors (60.5 GiB) available in 3

segments, the largest of which is 126899792 (60.5 GiB) in size.


The problem (I believe) started when I resized my partitions using MiniPartition Tool Wizard. I am not rebuking this program, because I'm sure it has worked for many others. However, this in combination with resizing my Macintosh HD using disk utility might have proliferated the problem. I have taken these steps:


1. Downloaded and installed GTP gdisk

2. Wrote partition 4 (BootCamp) to a MBR hybrid with EFI System Partition on top


Currently: I can see my bootcamp drive at startup, but when I boot into Windows 7, the OS is not found.

Posted on Jul 13, 2014 9:50 PM

Reply
19 replies

Jul 14, 2014 8:00 AM in response to kemaltalen

I'd like to see the results from the following read-only (they do not modify anything) commands:

sudo gpt -r -v show /dev/disk0

sudo fdisk /dev/disk0


I'd also like an exact sequence of all events, something like: 1. Resized using Disk Utility, shrank from X to Y. 2. Rebooted into Windows used MiniPartition Tool to resize Windows.


If you decided to undo anything or attmpt any repairs I'd like to know what and when it happened in sequence. The details are important because what you've done isn't supported at all, and Apple doesn't do a good job of either preventing users from making modifications with Disk Utility, or informing users they can't do this without the help of 3rd party tools that explicitly support Boot Camp partitions. So this leads users inevitably into making the wrong choices. And MiniPartition Tool does not explicitly support Boot Camp Partitions.

So understand this is a data recovery operation. I recommend making no additional modifications or it could lead to total data loss.


Resize the Windows Partitionis the official Apple recommendation on resizing.

Jul 14, 2014 4:39 PM in response to Christopher Murphy

Results for sudo fdisk gpt -r -v /dev/disk0:

gpt show: /dev/disk0: mediasize=250059350016; sectorsize=512; blocks=488397168

gpt show: /dev/disk0: Suspicious MBR at sector 0

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

184447632 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC

185717168 126899792

312616960 175779840 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

488396800 335

488397135 32 Sec GPT table

488397167 1 Sec GPT header


Results for sudo fdisk /dev/disk0:

Disk: /dev/disk0 geometry: 30401/255/63 [488397168 sectors]

Signature: 0xAA55

Starting Ending

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

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

1: EE 0 0 2 - 1023 254 63 [ 1 - 312616959] <Unknown ID>

*2: 07 1023 254 63 - 1023 254 63 [ 312616960 - 175779840] HPFS/QNX/AUX

3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused

4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused

Jul 14, 2014 4:45 PM in response to kemaltalen

Here are the steps I took to get to this point:

1. Used Mini Partition tool to resize both drives to 90 gigs for BootCamp and 140 gigs for Macintosh HD.

Result: No problems.

2. Resized Macintosh HD from 140 gigs to 80 gigs.

Result: BootCamp did not show up in "Holding Option" startup, or system preferences -> startup disks.

3. Used gdisk with the following commands:

r <enter> go to the recovery & transformation menu

h <enter> create a new hybrid MBR

Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N):Y

5 <enter> add partition 4 to the MBR

<enter> accept the default MBR hex code of 07

y <enter> set the bootable flag

n <enter> do not protect more partitions

o < enter> print (display) the MBR

w <enter> write partition table to disk

Result: BootCamp does show up in "Holding Option" startup, but booting up BootCamp there is no OS detected.

Jul 14, 2014 5:41 PM in response to kemaltalen

In step 1 you say "both drives". Can you clarify this? There's more than one drive involved? Please post the result from

diskutil list


Also in step 1 you suggest Macintosh HD was resized with MiniPartition Tool. As far as I know it doesn't support resizing HFS+ volumes, are you sure you didn't use Disk Utility?


Please post the result from this read-only command which displays the 1st sector of the 4th GPT partition. It should contain an NTFS boot sector if the resize worked correctly. The first line should contain something similar to this, with .R.NTFS... visible. Either post the actual result or confirm/deny it contains R.NTFS.


sudo dd if=/dev/rdisk0s4 count=1 2>/dev/null | hexdump -C


If it contains NTFS, then booting the Windows install media and running Windows Startup Repair may find and fix the problem automatically.


If it doesn't, then you should use the option on the install media to get to a command prompt and run chkdsk C: on the drive. If that goes OK, then chkdsk C: /f and if that goes OK then you can proceed with bootrec.exe.I'd use the /FixMbr and /FixBoot options for starters and see if that fixes the problem.


If chkdsk fails, then you're probably in testdisk territory. The gist is that MiniPartition tool updated the MBR partition map but not the GPT. And then DiskUtility updated the GPT but not the MBR. And then the use of gdisk removed the hybrid MBR which would have given some indication of what MiniPartition tool did, and where the NTFS volume actually is.

Jul 14, 2014 6:38 PM in response to Christopher Murphy

Results from diskutil list:

/dev/disk0

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *250.1 GB disk0

1: EFI EFI 209.7 MB disk0s1

2: Apple_HFS Macintosh HD 94.2 GB disk0s2

3: Apple_Boot Recovery HD 650.0 MB disk0s3

4: Microsoft Basic Data 90.0 GB disk0s4

/dev/disk1

#: TYPE NAME SIZE IDENTIFIER

0: USB DISK *2.0 GB disk1

/dev/disk2

#: TYPE NAME SIZE IDENTIFIER

0: CD_partition_scheme *2.7 GB disk2

1: CD_ROM_Mode_1 INSIDE_APL 2.4 GB disk2s0


Yes you're right about mini-partition tool. What I did was I deleted items on Macintosh HD and then resized the Macintosh HD using disk utility. Then I resized my bootcamp partition using mini-partition tool. At this point there were no problems (this was a year ago). Then I resized my Macintosh HD again. As a result, my bootcamp would not show up. So here's the updated steps in chronological order.

1. Resized Macintosh HD from about 180 gigs to 140 gigs using Disk Utility

2. Resized BootCamp partition from 50 gigs to 90 gigs using mini-partition tool

3. Resized Macintosh HD (a year later) from 140 gigs to 80 gigs.

PROBLEM OCCURS: BootCamp is not visible at boot up.

MY SOLUTION: Did the steps in gfdisk stated in my previous post.

NEW PROBLEM: BootCamp is visible, but will not boot up with OS.


Results from sudo dd if=/dev/rdisk0s4 count=1 2>/dev/null | hexdump -C:

00000000 5b b7 1a 02 88 b7 1a 02 27 b8 1a 02 05 b9 1a 02 |[.......'.......|

00000010 38 b9 1a 02 8b b9 1a 02 b8 b9 1a 02 0b ba 1a 02 |8...............|

00000020 38 ba 1a 02 8b ba 1a 02 b8 ba 1a 02 57 bb 1a 02 |8...........W...|

00000030 35 bc 1a 02 68 bc 1a 02 bb bc 1a 02 e8 bc 1a 02 |5...h...........|

00000040 3b bd 1a 02 68 bd 1a 02 bb bd 1a 02 e8 bd 1a 02 |;...h...........|

00000050 87 be 1a 02 65 bf 1a 02 98 bf 1a 02 fb bf 1a 02 |....e...........|

00000060 28 c0 1a 02 7b c0 1a 02 a8 c0 1a 02 fb c0 1a 02 |(...{...........|

00000070 28 c1 1a 02 c7 c1 1a 02 a5 c2 1a 02 d8 c2 1a 02 |(...............|

00000080 2b c3 1a 02 58 c3 1a 02 ab c3 1a 02 d8 c3 1a 02 |+...X...........|

00000090 2b c4 1a 02 58 c4 1a 02 f7 c4 1a 02 d5 c5 1a 02 |+...X...........|

000000a0 08 c6 1a 02 5b c6 1a 02 88 c6 1a 02 db c6 1a 02 |....[...........|

000000b0 08 c7 1a 02 5b c7 1a 02 88 c7 1a 02 27 c8 1a 02 |....[.......'...|

000000c0 05 c9 1a 02 38 c9 1a 02 8b c9 1a 02 b8 c9 1a 02 |....8...........|

000000d0 0b ca 1a 02 38 ca 1a 02 8b ca 1a 02 b8 ca 1a 02 |....8...........|

000000e0 57 cb 1a 02 35 cc 1a 02 68 cc 1a 02 bb cc 1a 02 |W...5...h.......|

000000f0 e8 cc 1a 02 3b cd 1a 02 68 cd 1a 02 bb cd 1a 02 |....;...h.......|

00000100 e8 cd 1a 02 87 ce 1a 02 65 cf 1a 02 98 cf 1a 02 |........e.......|

00000110 fb cf 1a 02 28 d0 1a 02 7b d0 1a 02 a8 d0 1a 02 |....(...{.......|

00000120 fb d0 1a 02 28 d1 1a 02 c7 d1 1a 02 a5 d2 1a 02 |....(...........|

00000130 d8 d2 1a 02 2b d3 1a 02 58 d3 1a 02 ab d3 1a 02 |....+...X.......|

00000140 d8 d3 1a 02 2b d4 1a 02 58 d4 1a 02 f7 d4 1a 02 |....+...X.......|

00000150 d5 d5 1a 02 08 d6 1a 02 5b d6 1a 02 88 d6 1a 02 |........[.......|

00000160 db d6 1a 02 08 d7 1a 02 5b d7 1a 02 88 d7 1a 02 |........[.......|

00000170 27 d8 1a 02 05 d9 1a 02 38 d9 1a 02 8b d9 1a 02 |'.......8.......|

00000180 b8 d9 1a 02 0b da 1a 02 38 da 1a 02 8b da 1a 02 |........8.......|

00000190 b8 da 1a 02 57 db 1a 02 35 dc 1a 02 68 dc 1a 02 |....W...5...h...|

000001a0 bb dc 1a 02 e8 dc 1a 02 3b dd 1a 02 68 dd 1a 02 |........;...h...|

000001b0 bb dd 1a 02 e8 dd 1a 02 87 de 1a 02 65 df 1a 02 |............e...|

000001c0 98 df 1a 02 fb df 1a 02 28 e0 1a 02 7b e0 1a 02 |........(...{...|

000001d0 a8 e0 1a 02 fb e0 1a 02 28 e1 1a 02 c7 e1 1a 02 |........(.......|

000001e0 a5 e2 1a 02 d8 e2 1a 02 2b e3 1a 02 58 e3 1a 02 |........+...X...|

000001f0 ab e3 1a 02 d8 e3 1a 02 2b e4 1a 02 58 e4 1a 02 |........+...X...|

00000200

Jul 14, 2014 7:22 PM in response to kemaltalen

So the event and problem it caused in order looks like:

1. Disk Utility permits modification of the partition layout on a drive with a hybrid MBR in violation of this technote.Specifically "If block 0 contains any other form of MBR, it should refuse to manipulate the disk." This fools the user into thinking such a resize operation is sanctioned.

2. MiniPartition Tool, like Windows when booted on BIOS systems (including Apple hardware), only honors the MBR, while ignoring the GPT. It resizes Windows successfully but only updates the MBR. This doesn't cause an immediate Windows problem because Windows uses only the MBR, which is correct for Windows, and OS X only uses the GPT which is correct for OS X. The only noticeable problem that occurs is that the Windows volume no longer mounts in OS X because the GPT partition for it is incorrect.

3. Using Disk Utility again has two problems. First since it shows the stale GPT it can actually permit you to resize the OS X volume in a way that overwrites part of the Windows volume. Only if you shrank the OS X volume are you maybe in the clear for this problem. If it allowed you to increase the size of the OS X volume, you probably actually overwrote important file system information on the Windows volume, and recovering from this is in the realm of professional data recovery services. Second, it causes the correct partition information for Windows, stored in the MBR, to be removed in favor of the same (stale) information that was in the GPT.

So assuming your last Disk Utility resize was to shrink, testdisk should find the NTFS volume somewhere in the 62GB of free space (it's free space according to the GPT, obviously this is wrong). Because you've done multiple resizings, testdisk will likely find more than one candidate for a Windows volume. You'll need to use the option to list files to determine which candidate actually contains your files. Once you've found the correct candidate, you have two choices, testdisk can extract your files (to OS X) and then you can use Boot Camp Assistant to obliterate Windows, and reinstall it; or you can use gdisk to delete partition 4 (for Windows), create a new partition 4 plugging in the testdisk start and end sector values for the Windows volume, and reboot. If the values are correct, the OS X Finder will read-only mount the Windows volume and within OS X you'll be able to see your files. Next you'd use gdisk to create a new hybrid MBR similar to what you did before, but instead of just adding GPT #4, you should add 2 3 and 4 - only because that's how Apple does it and doing it their way will probably save you grief down the road.


Alternatively if you have backups for OS X and Windows, is to completely start from scratch: new OS X install, resize with Boot Camp Assistant, update OS X and restore from backup, reinstall Windows, restore Windows backup. This will take longer, but is the easiest to do.

Jul 14, 2014 7:40 PM in response to Christopher Murphy

I do not have a backup of my windows partition yet, only OSX. When I do back the whole disk up to an external, is having a copy of my current drive a problem if I want to start from scratch? (wiping the whole disk and reinstalling windows and MacOSX from the back up of this current drive ). Will it be readable even though the partition tables seem to be out of sync?

Jul 14, 2014 8:24 PM in response to Christopher Murphy

I only have a back up of my OSX partition. I've never backed up my Windows partition.


Would backing up my whole drive even matter at this point? I'm inclined to proceed to use test disk to find the NTFS volume and copy it to OSX. This may seem like a stupid question, but if I extract the files to OSX and there's not enough room on my Macintosh HD partition for all the files, will it damage my disk even more?


Also should I add the EFI partition first when using gdisk to erase the windows partition and rewrite it to a hybrid MBR using the new sectors.

Jul 14, 2014 9:36 PM in response to kemaltalen

Would backing up my whole drive even matter at this point?

I don't know what you mean by "whole drive" because this implies both OS X and Windows, and off hand I'm not aware of a tool that does this in a friendly manner.

I'm inclined to proceed to use test disk to find the NTFS volume and copy it to OSX. This may seem like a stupid question, but if I extract the files to OSX and there's not enough room on my Macintosh HD partition for all the files, will it damage my disk even more?

No. But you won't be copying everything from Windows anyway, just data files.


Also should I add the EFI partition first when using gdisk to erase the windows partition and rewrite it to a hybrid MBR using the new sectors.


a.) delete the Windows partition b.) add a new partition with the testdisk start/end sector values, this is a new Windows partition c.) create a hybrid MBR and when you do this you'll answer yes to the question "Place EFI GPT (0xEE) partition first in MBR (good for GRUB)?" And you'll only make the Windows partition (#4) bootable.


And yes LonerT makes a good suggestion to restore Windows files to an external disk. I think if it's just user data files, it's fine to do this to the OS X volume. You just don't want to copy so much out of Windows (like programs) that you fill up the OS X volume; plus it's really unlikely those copied programs will work once put back on a new Windows installation; you'll have to reinstall programs if you end up starting over with Windows.

Jul 15, 2014 12:42 PM in response to Christopher Murphy

Hi Christopher,


sorry for hijacking this thread but I haven't found another way to contact you directly. Can you please take a look at this threadWindows 7 hangs from boot menu and give some advice? I've read your answer on this thread Repairing Boot Camp after creating new partition and hope that the solution to my problem is easy, too. The partition is visible and accessible from OS X, from what I understand of what has been posted, there might be 5 partitions, but only 4 are usable with MBR and that might cause problems because of a GPT/MBR mismatch?


thanks for your comments,

jk

Jul 20, 2014 6:27 PM in response to Christopher Murphy

Thank you! Using your advise I was able to recover all my data and programs!


Here's what I did:

1. Used test drive to quick search my GPT/EFI drive

2. Found the old sector numbers and wrote them down on paper

3. Used gdisk to delete the old windows partition. Then, I added a new windows partition( type 0700 ) with the new sector numbers.

4. Used the r command (recovery and transformation) to create a new hybrid MBR with partitions 2 3 and 4 (2 is my Mac OSX, but I have no idea what 3 is...I think it's the recovery partition) and set partition 4 as bootable.

5. Restarted my computer in Windows. Windows then prompted me to insert the installation CD and select "repair" after booting.

6. Clicked repair and was prompted to restart.

7. Restarted and logged into my account successfully.


To anyone else that needs to recover a partition, testdrive is very useful for finding the partition and/or lost data. You can then use gdisk to edit your partition table. In the future to anyone resizing your bootcamp partition, DO NOT USE DISK UTILITY TO RESIZE YOUR MAC OSX PARTITION AFTER USING MINI PARTITION TOOL OR SIMILAR PROGRAMS TO RESIZE YOUR BOOTCAMP PARTITION!!!!!


Thanks Christopher Murphy for the advise again.



Cheers,

Kemal

Jul 20, 2014 7:38 PM in response to kemaltalen

Ok, here's a minor issue that I found with my disk that may or may not be an actual problem.


When I view the partition sizes in the terminal by typing "diskutil list" it shows the BOOTCAMP partition having a volume of 114 Gigs. But, when I view the partition table in gdisk (and Windows), it shows the volume of the same partition as 106 gigs. I thought the partitions are the same, but my mac and windows OS's don't agree on the size of the partition. I still want to resize (increase the size of my bootcamp partition), but I don't know what the actual size is. How do I make the size of the partition consistent between operating systems?

Jul 20, 2014 7:53 PM in response to kemaltalen

Notice the difference...


As long as the start/end points are the same, your are fine. Utilities will round up numbers for display purposes.


diskutil list

/dev/disk0

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *1.0 TB disk0

1: EFI EFI 209.7 MB disk0s1

2: Apple_HFS Macintosh HD 743.7 GB disk0s2

3: Apple_Boot Recovery HD 650.0 MB disk0s3

4: Microsoft Basic Data BOOTCAMP 256.0 GB disk0s4


sudo gdisk /dev/disk0

GPT fdisk (gdisk) version 0.8.9


Warning: Devices opened with shared lock will not have their

partition table automatically reloaded!

Partition table scan:

MBR: hybrid

BSD: not present

APM: not present

GPT: present


Found valid GPT with hybrid MBR; using GPT.


Command (? for help): p

Disk /dev/disk0: 1954210120 sectors, 931.8 GiB

Logical sector size: 512 bytes

Disk identifier (GUID): 6ED0C429-00D1-4759-B50E-04B6FB80D0E3

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 1954210086

Partitions will be aligned on 8-sector boundaries

Total free space is 1293 sectors (646.5 KiB)


Number Start (sector) End (sector) Size Code Name

1 40 409639 200.0 MiB EF00 EFI System Partition

2 409640 1452940543 692.6 GiB AF00 Customer

3 1452940544 1454210079 619.9 MiB AB00 Recovery HD

4 1454211072 1954209791 238.4 GiB 0700 BOOTCAMP


Command (? for help): q


sudo gpt -vv -r show /dev/disk0

Password:

gpt show: /dev/disk0: mediasize=1000555581440; sectorsize=512; blocks=1954210120

gpt show: /dev/disk0: Suspicious MBR at sector 0

gpt show: /dev/disk0: Pri GPT at sector 1

gpt show: /dev/disk0: Sec GPT at sector 1954210119

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

1452940544 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC

1454210080 992

1454211072 499998720 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

1954209792 295

1954210087 32 Sec GPT table

1954210119 1 Sec GPT header

My issue with bootcamp partition

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