MacOS – Bootcamp cannot be selected through option key after patitioning using recovery

bootcampmacospartitionwindows

I have installed windows 10 on my Macbook late 2009 unibody and thus far have worked well.
I wanted to increase the capacity of my Bootcamp partition so I used recovery to reduce the size of Macos and allocate that space to windows 10, upon restarting the device I was unable to boot in Bootcamp and macos, Bootcamp does not show up when pressing the option key through resetting pram [
After resetting Pram I am able to boot into Macos but not into bootcamp1I was able to boot through macos and see that macos can still detect the Bootcamp partition2

But by Opening bootcamp through this way it shouwed "No bootable device, insert boot disk and press enter"enter image description here

Results from diskutil list:

Apples-MacBook:~ apple$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *250.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Untitled                119.8 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:       Microsoft Basic Data unti                    49.2 GB    disk0s4
   5:       Microsoft Basic Data BOOTCAMP                80.0 GB    disk0s5

Results From sudo fdisk /dev/disk0/ :

Apples-MacBook:~ apple$ sudo fdisk /dev/disk0
Password:
Disk: /dev/disk0    geometry: 30401/255/63 [488397168 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 -  234038808] HFS+        
 3: AB 1023 254  63 - 1023 254  63 [ 234448448 -    1269536] Darwin Boot 
 4: 0B 1023 254  63 - 1023 254  63 [ 235717984 -   96168608] Win95 FAT-32

Results from gpt show:

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  234038808      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  234448448    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  235717984   96168608      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  331886592     262144         
  332148736  156248064      5  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  488396800        335         
  488397135         32         Sec GPT table
  488397167          1         Sec GPT header

Best Answer

The error message appears when there is no partition flagged as active in the Master Boot Record (MBR) partition table. The sudo fdisk /dev/disk0 command prints out the contents of the MBR table. The active partition is indicated by an * character. This is absent in your posted output. If the fourth partition contains Windows, then you can use the fdisk command to flag the fourth partition as active. If the fifth partition contains windows, then you would need to first put the fifth partition in the MBR. Most users opt to download and use the gdisk command do this.

I should warn you that if you fix this problem, there still exists the possibility that Windows may interpret your repartitioning actions as an attempt to illegally clone Windows to a new machine. If this happens, then the easiest solution to this problem would be to rebuild the BCD.

The commands below can be entered to put the fifth partition back in the MBR partition table and make the partition active. Hopefully Windows will boot. You probably will need to enter the commands while booted to OS X Recovery. The sudo may not be needed. Note also that the fdisk command is interactive.

sudo fdisk -e /dev/disk0
e 4
7
n
332148736
156248064 
f 4
q
y

If entered correctly, then the MBR partition table should appear as shown below.

Apples-MacBook:~ apple$ sudo fdisk /dev/disk0
Password:
Disk: /dev/disk0    geometry: 30401/255/63 [488397168 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 -  234038808] HFS+        
 3: AB 1023 254  63 - 1023 254  63 [ 234448448 -    1269536] Darwin Boot 
*4: 07 1023 254  63 - 1023 254  63 [ 332148736 -  156248064] HPFS/QNX/AUX

If the values in the cyl, hd or sec columns are different, don't worry. These values are no longer used.