Bootcamp partition not Bootable and Master Boot Record Problem
I have successfully installed Bootcamp and Windows 7 on my old MacbookPro7.1 (mid 2010, High Sierra) for a special project. However, I currently cannot boot into Windows since the bootcamp partition is no longer appearing in the boot menu. Furthermore, attempts to fix the Master Boot Record (MBR) using fdisk have now resulted in normal boot not even booting into MacOS normally. I have to go through the boot menu (Alt key) to select the MacOS partition explicitly. Before attempting any further fixes to this situation, and making it worse, I am asking for help here to do the following:
1) Recover normal boot function for the MacOS partition, and
2) Recover a bootable Bootcamp partition, if possible.
Background (How did I get to this point):
After installing and updating Windows 7, I ran out of space in the Bootcamp partition. I attempted (unwisely?) to expand the Bootcamp partition using a workaround: Create a 3rd partition using MacOS Disk Utility with the intention to merge that space into the Windows partition using a Windows application (MiniTool Partition Wizard). However, after creating the 3rd partition, the boot menu no longer had the Bootcamp partition as an option. I unfortunately had not created a backup yet for the new Windows installation so I am trying to avoid the long and tedious re-installation process if possible.
I researched the issue and discovered that the problem was loss of the Bootcamp partition bootable status likely due to the Disk Utility repartitioning process and its affects on the Master Book Record. The solutions pointed to the use of gdisk or fdisk in Terminal to make my Bootcamp partition bootable again.
I attempted these commands in the MacOS session Terminal:
sudo gpt show /dev/disk0
sudo fdisk /dev/disk0
The system generated the following errors:
gpt show: unable to open device '/dev/disk0': Operation not permitted
fdisk: /dev/disk0: Operation not permitted
I shifted efforts to a Terminal session in Recovery Mode (cmd+R), which now worked:
"gpt show /dev/disk0" now gave the correct report showing MacOS in partition 2 and Bootcamp in partition 4
"fdisk /dev/disk0" allowed me to see the partition map (EE type in partition 1, 00 in partitions 2-4)
Additional fdisk commands allowed me to change partition 4 type to 07, set the bootable flag to yes and write the changes.
Attempt to reboot with these changes resulted in boot to a black screen with flashing underscore (not good). Restart with Alt to boot menu and explicit selection of MacOS partition worked okay.
Disk Utility shows the Bootcamp partition still not bootable.... I went into Terminal and removed the MBR edits as much as I could, but I did not see a way to remove the bootable flag and left it pointing to Partition 1.
Reboot resulted in startup to a gray screen with no advance. I restarted through the boot menu again.
Any help anyone can offer is appreciated.
MacBook Pro