0

I have a 2011 iMac that I had used Bootcamp utility to install Windows 7 on. I got overzealous and tried to triple boot Windows, Mac and Linux on the iMac. I no longer need Linux on this iMac but the process corrupted my boot table and now I can't boot into Windows. If I press and hold 'alt/option' key after it reboots it doesn't show me the Windows bootcamp boot entry -- just Mac and Recovery drive.

However, in the file system, I still see all the files for Windows intact. So the file structure is still there, just the boot table entry is messed up somehow. I tried to 'repair' it but Bootcamp utility no longer gives me the optin of making a bootable Windows thumb drive using the Windows ISO that I have. It just asks to download some support software for Windows and that's it.

If this was Linux, I'd use something like 'boot repair' ISO or 'update-grub' to update the boot table but how do I repair the boot entry in Mac?

I have the Windows ISO available and I'm comfortable with command-line.

UPDATE: Details about the system

users-iMac:~ user$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            598.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:       Microsoft Basic Data BOOTCAMP                400.8 GB   disk0s4

/dev/disk1 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *16.0 GB    disk1
   1:                 DOS_FAT_32 FAT32                   16.0 GB    disk1s1

/dev/disk2 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:        CD_partition_scheme Audio CD               *410.5 MB   disk2

GPT:

users-iMac:~ user$ sudo gpt -r show /dev/disk0
Password:
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  1168862256      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  1169271896     1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  1170541432   782721552      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1953262984      262151         
  1953525135          32         Sec GPT table
  1953525167           1         Sec GPT header

Fdisk:

users-iMac:~ user$ sudo fdisk /dev/disk0
Disk: /dev/disk0    geometry: 121601/255/63 [1953525168 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 - 1168862256] HFS+        
 3: AB 1023 254  63 - 1023 254  63 [1169271896 -    1269536] Darwin Boot 
 4: 0B 1023 254  63 - 1023 254  63 [1170541432 -  782721552] Win95 FAT-32

The optical drive on my system works. I was wondering if I could create a bootable thumb drive though. Bootcamp does not give me this option in the 2011 iMac but I was hoping to the edit the 'info.plist' in Bootcamp's contents folder to add my iMac model in there so that Bootcamp gives me the option of booting from thumb drive. This "patch" is described here: Bootcamp - No ISO Option

But is there any other simpler way to create a bootable thumb drive to install Windows on a Mac?

  • I am not sure what you mean by "boot table". I currently have a 2011 iMac with El Capitan, Windows 10 (originally Windows 7) and Fedora (Linux) installed. You really have not provided enough information to diagnose your problem. A good place to start is the partition tables. So update your answer with the output from the following commands: diskutil list, sudo gpt -r show /dev/disk0 and sudo fdisk /dev/disk0. These commands will not change your computer. BTW, does your optical (DVD) drive work? I do not think you can boot the Windows installer from a thumb drive on a 2011 iMac. – David Anderson Oct 12 '16 at 11:45
  • @DavidAnderson Added more details to my question. – learnerX Oct 12 '16 at 18:03
  • I would give this question an upvote if it would be formulated as a question. :) – Ben Feb 1 '17 at 0:50
3

There are ways to create a bootable Windows installer thumb drive. The problem is you can not use this thumb drive with your computer. The software that searches the USB ports for bootable flash drives is part of the the firmware located on the main logic board. This firmware is not part of the OS X (macOS) operating system. Even though the firmware for the 2011 iMac can boot OS X (macOS) and certain Linux versions from a thumb drive, the Windows 7 installer can not be booted this way. The best option is to use original internal optical (DVD) drive. I would recommend a RW DVD which takes longer to burn, but is reusable.

If the Windows partition is intact, there are three main reasons you can not boot Windows. These reasons are listed below and apply to Mac computers which are booting Windows using the BIOS method.

  • The values in the partition tables are wrong. There are two partition tables. The first is the legacy Master Boot Record (MBR) table and the second is the newer GUID Partition Table (GPT). The bootable Windows partition must exist in both of these tables. The MBR table is stored at the beginning of the drive, followed by the GPT header and array of partition entries. There is also a backup copy of this GPT header and array at the end of the drive.
  • The MBR does not contain the correct code needed to boot Windows. The BIOS boot methods reads at least the first 512 bytes stored on the boot drive into memory and execute the code contained in this 512 bytes. These bytes are referred to as the MBR which also contains the MBR table. This code reads the MBR table and determines which partition to boot Window from. If this code is missing or incorrect, Windows will not boot.
  • Finally, the Windows Boot Configuration Data (BCD) is missing or contains the wrong data. If a change is made to your computer or if the Windows partition is moved regardless if within the same or to different computer, the BCD may need to be corrected or simply recreated. As far as I know, this can only be done (without using a third party tool) by booting from proper Windows installation media. In your case this would be a DVD containing the Windows installation software.

The output from the fdisk command shows the MBR table contains some incorrect values. This output should have appeared as shown below.

users-iMac:~ user$ sudo fdisk /dev/disk0
Disk: /dev/disk0    geometry: 121601/255/63 [1953525168 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 - 1168862256] HFS+        
 3: AB 1023 254  63 - 1023 254  63 [1169271896 -    1269536] Darwin Boot 
*4: 07 1023 254  63 - 1023 254  63 [1170541432 -  782721552] HPFS/QNX/AUX

Basically, your forth partition (where Windows resides) has the wrong id (partition type) and is not flaged as active (bootable).

The MBR table can be corrected by using the fdisk command. This command is interactive. An example the the necessary command line entries is shown below.

users-iMac:~ user$ sudo fdisk -e /dev/disk0
Password:
fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory
Enter 'help' for information
fdisk: 1> e 4
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 4: 0B 1023 254  63 - 1023 254  63 [1170541432 -  782721552] Win95 FAT-32
Partition id ('0' to disable)  [0 - FF]: [B] (? for help) 7
Do you wish to edit in CHS mode? [n] 
Partition offset [0 - 1953525168]: [1170541432] 
Partition size [1 - 782721552]: [782721552] 
fdisk:*1> f 4
Partition 4 marked active.
fdisk:*1> q
Writing current MBR to disk.
Device could not be accessed exclusively.
A reboot will be needed for changes to take effect. OK? [n] y
users-iMac:~ user$

NOTE: For you can just hit a return instead of entering values for the entries shown below. This will instruct fdisk to use the default values. This is what I did in the above example.

Do you wish to edit in CHS mode? [n] 
Partition offset [0 - 1953525168]: [1170541432] 
Partition size [1 - 782721552]: [782721552] 

If you have System Integrity Protect (SIP) enabled, you may have to temporarily disable SIP in order to execute the fdisk command.

If after correcting the MBR table your Mac will not boot Windows, we can try to determine if the other causes listed above may also be at fault.

  • Thank you. I ended up using the bootable Windows installation CD with Bootcamp. I had to first remove the previous installation of Windows of course. In short, I did a complete re-install of Windows from the CD. In 2011 iMacs, bootcamp does not support making a bootable thumb drive. There are ways around it as I mentioned in my original question, but I wanted to keep things simple so created a bootable CD instead. – learnerX Oct 16 '16 at 22:16
  • @David Anderson: I had a similiar problem and tried the answer. The error changed from "no bootable device" to "Missing operation system". See my question here: apple.stackexchange.com/questions/271155/… – Ben Feb 1 '17 at 1:19
0

The best solution I found for this problem, which I also ran into on over two separate occasions, is to restore the backed up partition from a partition image. Example: bootcamp volume becomes no longer recognized as "bootcamp", re-partition the drive into Macintosh HD and Bootcamp (NFTS). Install MacOS as per normal, then restore bootcamp image to the new bootcamp partition.

There are several suggestions on how to modify the partition table without reformatting and repartitioning. However, in my own attempts I have yet to find a consistently reproducible method.

Finally, if you do not have a current bootcamp partition image (such as with Acronis True Image), you might find a solution to create an image by finding the NFTS partitioned drive sectors via linux GParted. I do not have a complete answer for this part.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .