Recovering Windows 7 Bootcamp Partition

Hi, I have a problem similar to many others on the forum. It has been a couple of weeks before I have used my Windows partition, so I am not sure the root of the problem, however I had used iPartition at some point to resize my partition and retake some space. I have a MBP Mid 2009 running 10.10.3. Yesterday, Windows stopped working although Bootcamp did mount but booting into it would get stick on the windows logo and sit there.

I went through the initial steps as Loner T has so nicely outlined for some other folks. My partition numbers are a bit different from other people (The Microsoft Basic Data has always been #1 as opposed to number #4 (EFI)) so I wanted to verify with the crowd before I went too far and regretted it. I had started part 1, but wanted to ask about what to delete in step 4, and in part 2, step 6 about which to hybridize since mine look slightly different. I wrote the commands for part 1 but never for the second set of steps out of fear.

I am attaching all of the screenshots outlining my steps. Any and all help would be appreciated.

User uploaded file

User uploaded file

User uploaded file

User uploaded file

Text of part of last night's attempt before I got worried.

User uploaded file

MacBook Pro, OS X Yosemite (10.10.3)

Posted on Jul 9, 2015 8:35 AM

Reply
18 replies

Jul 9, 2015 9:12 AM in response to Loner T

Thanks for the quick reply Loner T. You do seem to be the resident expert on the situation. In regards to your comments above, is there anyway to correct this? I will be away from the affected computer for a while, but would love to hear your thoughts and any possible solutions to the matter. And I am relatively new to terminal so step by step instructions would be best for me.


Thanks in advance.

Jul 9, 2015 8:10 PM in response to wbb44

Your GPT also has issues. Your Testdisk output shows NTFS header at sector 34. Your Gdisk steps, due to the 8-secor alignment default, move it to sector 40, so your GPT1 starts at 40, not 34. The 6-sectore difference is causing your dd to output incorrect information.


Correct your GPT first, using the same Gdisk steps, but first go into the e'x'perts menu and use 'l' to change the sector alignment to 1 sector, use 'm' to go back to the menu, and then run your d,1,n,1 sequence with 34 as start sector. If it moves to 40, start over again. Once you can make it to stick to 34, reboot, and post the output of the dd command so it can be confirmed that you have a valid NTFS header.


It makes me nervous when partitioning tools so nonchalantly play havoc on user data, without a smidgen of a warning, and that includes Bootcamp and Apple Software upgrades, not just third-party tools like iPartition. If a future OS X upgrade considers this non-standard, it can result in catastrophic data loss.


I would strongly recommend regular external disk backups of both OS X and Windows using built-in tools which are part of the respective OSes.

Jul 10, 2015 9:38 AM in response to Loner T

Great, good to be making progress. Step by step instructions would be very helpful, or at least will you update your go-to list based on which partitions I should hybridize, this tripped me up last time. I will try later today and let you know.


If you already have GPT Fdisk (aka gdisk) installed, then rebuild MBR to match the new GPT information thus resetting the Hybrid MBR. Use defaults for other questions (like partition codes). The only values that need modifications are the Boot flags and step 10. Accept all other defaults that Gdisk offers.

  1. Sudo gdisk /dev/disk0
  2. P (Print list of parts)
  3. R (Recover)
  4. O (print current Hybrid MBR)
  5. H (chooses Hybrid)
  6. Partitions numbers to be hybridized:2 3 4?
  7. Y (Good for GRUB question)
  8. N (part 2 boot flag)
  9. N (part 3 boot flag)
  10. Y (part 4 boot flag make NTFS bootable partition)
  11. O (print current Hybrid MBR)
  12. W (Write the new MBR)
  13. Y (Yes! write the new MBR)
  14. Reboot


Here is sample Q&A for this section. Please notice the Press Enter/Return.


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): Press Enter/Return

Set the bootable flag? (Y/N): N


Creating entry for GPT partition #3 (MBR partition #3)

Enter an MBR hex code (default AB): Press Enter/Return

Set the bootable flag? (Y/N): N


Creating entry for GPT partition #4 (MBR partition #4)

Enter an MBR hex code (default 07): Press Enter/Return

Set the bootable flag? (Y/N): Y


Test 1 - Does Bootcamp Volume show up in Finder?

Test 2 - Can you see files in Bootcamp Volume?

Test 3 - Can you select Bootcamp in System Preferences -> Startup Disk?

Test 4 - If Test 3 is successful, select Bootcamp and Click Restart.

Jul 12, 2015 10:55 PM in response to Loner T

I tried to follow the steps as best I could. I am posting my terminal commands below. My bootcamp hard drive shows up and I pass all 4 tests at the bottom of your instructions, but unfortunately, when I boot into Windows, it still goes into repair mode and then freezes on normal startup. Not sure if there are any mistakes in there, but if you have any other ideas, I would appreciate your insight.


My DVD drive does not work well and cannot read my windows install disk, but unless I can find a solution, I am pondering just doing a clean bootcamp install as a last resort.



sudo gdisk /dev/disk0

Password:

GPT fdisk (gdisk) version 1.0.0


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: 1465149168 sectors, 698.6 GiB

Logical sector size: 512 bytes

Disk identifier (GUID): EF1BF31C-82F1-4247-9ECB-4893C19B1C67

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 1465149134

Partitions will be aligned on 8-sector boundaries

Total free space is 262148 sectors (128.0 MiB)


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

1 34 492830746 235.0 GiB 0700 Microsoft basic data

2 492830747 1462944290 462.6 GiB AF00 WBB 2.0

3 1463206435 1464739530 748.6 MiB AB00 Recovery HD

4 1464739531 1465149130 200.0 MiB EF00 EFI


Command (? for help): r


Recovery/transformation command (? for help): o


Disk size is 1465149168 sectors (698.6 GiB)

MBR disk identifier: 0x57E5FD58

MBR partitions:


Number Boot Start Sector End Sector Status Code

1 1 492830746 primary 0xEE

3 492830747 1462944290 primary 0xAF

4 * 1463206435 1464739530 primary 0x07


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 1

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 #1 (MBR partition #4)

Enter an MBR hex code (default 07):

Set the bootable flag? (Y/N): y


Recovery/transformation command (? for help): p

Disk /dev/disk0: 1465149168 sectors, 698.6 GiB

Logical sector size: 512 bytes

Disk identifier (GUID): EF1BF31C-82F1-4247-9ECB-4893C19B1C67

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 1465149134

Partitions will be aligned on 8-sector boundaries

Total free space is 262148 sectors (128.0 MiB)


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

1 34 492830746 235.0 GiB 0700 Microsoft basic data

2 492830747 1462944290 462.6 GiB AF00 WBB 2.0

3 1463206435 1464739530 748.6 MiB AB00 Recovery HD

4 1464739531 1465149130 200.0 MiB EF00 EFI


Recovery/transformation command (? for help): o


Disk size is 1465149168 sectors (698.6 GiB)

MBR disk identifier: 0x57E5FD58

MBR partitions:


Number Boot Start Sector End Sector Status Code

1 1 33 primary 0xEE

2 492830747 1462944290 primary 0xAF

3 1463206435 1464739530 primary 0xAB

4 * 34 492830746 primary 0x03


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: Devices opened with shared lock will not have their

partition table automatically reloaded!

Warning: The kernel may continue to use old or deleted partitions.

You should reboot or remove the drive.

The operation has completed successfully.

Jul 13, 2015 8:14 AM in response to Loner T

I followed the steps and unfortunately, it is still refusing to fully boot up. Any other thoughts? Thanks for your patience.


sudo fdisk -e /dev/rdisk0

Password:

fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory

Enter 'help' for information

fdisk: 1> p

Disk: /dev/rdisk0 geometry: 91201/255/63 [1465149168 sectors]

Offset: 0 Signature: 0xAA55

Starting Ending

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

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

1: EE 0 0 2 - 0 0 34 [ 1 - 33] <Unknown ID>

2: AF 1023 254 63 - 1023 254 63 [ 492830747 - 970113544] HFS+

3: AB 1023 254 63 - 1023 254 63 [1463206435 - 1533096] Darwin Boot

*4: 03 0 0 35 - 1023 254 63 [ 34 - 492830713] XENIX /usr

fdisk: 1> setpid 4

Starting Ending

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

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

*4: 03 0 0 35 - 1023 254 63 [ 34 - 492830713] XENIX /usr

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

fdisk:*1> flag 4

Partition 4 marked active.

fdisk:*1> p

Disk: /dev/rdisk0 geometry: 91201/255/63 [1465149168 sectors]

Offset: 0 Signature: 0xAA55

Starting Ending

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

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

1: EE 0 0 2 - 0 0 34 [ 1 - 33] <Unknown ID>

2: AF 1023 254 63 - 1023 254 63 [ 492830747 - 970113544] HFS+

3: AB 1023 254 63 - 1023 254 63 [1463206435 - 1533096] Darwin Boot

*4: 07 0 0 35 - 1023 254 63 [ 34 - 492830713] HPFS/QNX/AUX

fdisk:*1> w

Device could not be accessed exclusively.

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

Writing MBR at offset 0.

Aug 1, 2015 12:13 AM in response to Loner T

Thanks, sorry I have been incredibly busy and had put off solving this. Here is the output of the hex dump.

00000000 eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00 |.R.NTFS .....|

00000010 00 00 00 00 00 f8 00 00 3f 00 ff 00 22 00 00 00 |........?..."...|

00000020 00 00 00 00 80 00 80 00 f8 ff 5f 1d 00 00 00 00 |.........._.....|

00000030 00 00 0c 00 00 00 00 00 02 00 00 00 00 00 00 00 |................|

00000040 f6 00 00 00 01 00 00 00 20 2b b3 5c 53 b3 5c 58 |........ +.\S.\X|

00000050 00 00 00 00 fa 33 c0 8e d0 bc 00 7c fb 68 c0 07 |.....3.....|.h..|

00000060 1f 1e 68 66 00 cb 88 16 0e 00 66 81 3e 03 00 4e |..hf......f.>..N|

00000070 54 46 53 75 15 b4 41 bb aa 55 cd 13 72 0c 81 fb |TFSu..A..U..r...|

00000080 55 aa 75 06 f7 c1 01 00 75 03 e9 dd 00 1e 83 ec |U.u.....u.......|

00000090 18 68 1a 00 b4 48 8a 16 0e 00 8b f4 16 1f cd 13 |.h...H..........|

000000a0 9f 83 c4 18 9e 58 1f 72 e1 3b 06 0b 00 75 db a3 |.....X.r.;...u..|

000000b0 0f 00 c1 2e 0f 00 04 1e 5a 33 db b9 00 20 2b c8 |........Z3... +.|

000000c0 66 ff 06 11 00 03 16 0f 00 8e c2 ff 06 16 00 e8 |f...............|

000000d0 4b 00 2b c8 77 ef b8 00 bb cd 1a 66 23 c0 75 2d |K.+.w......f#.u-|

000000e0 66 81 fb 54 43 50 41 75 24 81 f9 02 01 72 1e 16 |f..TCPAu$....r..|

000000f0 68 07 bb 16 68 70 0e 16 68 09 00 66 53 66 53 66 |h...hp..h..fSfSf|

00000100 55 16 16 16 68 b8 01 66 61 0e 07 cd 1a 33 c0 bf |U...h..fa....3..|

00000110 28 10 b9 d8 0f fc f3 aa e9 5f 01 90 90 66 60 1e |(........_...f`.|

00000120 06 66 a1 11 00 66 03 06 1c 00 1e 66 68 00 00 00 |.f...f.....fh...|

00000130 00 66 50 06 53 68 01 00 68 10 00 b4 42 8a 16 0e |.fP.Sh..h...B...|

00000140 00 16 1f 8b f4 cd 13 66 59 5b 5a 66 59 66 59 1f |.......fY[ZfYfY.|

00000150 0f 82 16 00 66 ff 06 11 00 03 16 0f 00 8e c2 ff |....f...........|

00000160 0e 16 00 75 bc 07 1f 66 61 c3 a0 f8 01 e8 09 00 |...u...fa.......|

00000170 a0 fb 01 e8 03 00 f4 eb fd b4 01 8b f0 ac 3c 00 |..............<.|

00000180 74 09 b4 0e bb 07 00 cd 10 eb f2 c3 0d 0a 41 20 |t.............A |

00000190 64 69 73 6b 20 72 65 61 64 20 65 72 72 6f 72 20 |disk read error |

000001a0 6f 63 63 75 72 72 65 64 00 0d 0a 42 4f 4f 54 4d |occurred...BOOTM|

000001b0 47 52 20 69 73 20 6d 69 73 73 69 6e 67 00 0d 0a |GR is missing...|

000001c0 42 4f 4f 54 4d 47 52 20 69 73 20 63 6f 6d 70 72 |BOOTMGR is compr|

000001d0 65 73 73 65 64 00 0d 0a 50 72 65 73 73 20 43 74 |essed...Press Ct|

000001e0 72 6c 2b 41 6c 74 2b 44 65 6c 20 74 6f 20 72 65 |rl+Alt+Del to re|

000001f0 73 74 61 72 74 0d 0a 00 8c a9 be d6 00 00 55 aa |start.........U.|

00000200


Some things I have tried since we last spoke. My DVD drive no longer works so I borrowed an external to get the windows 7 disk in there to try to see if I could do something with windows startup repair as you mentioned. The repair failed and said that the disk could not be repaired. I put off anything else until recently and then was thinking of just removing the bootcamp partition, reinstalling windows 7 and restoring the windows 7 from a windows backup file that I have on an external. However, when I try to use bootcamp assistant to remove the partition, the option to remove is grayed out and gives the error that the startup disk cannot be partitioned. After a quick google search, it seems to be another problem which others have unfortunately ran into as well and many seems to solve with a reinstall.


Are there any other solutions you can think of before I erase and reinstall from the Apple Repair Site in order to restore Time Machine and eventually, my original windows backup? Any help would be much appreciated.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Recovering Windows 7 Bootcamp Partition

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