VMware Communities
lensovet
Contributor
Contributor

Can't boot into Windows after shutdown

I have a rather odd scenario that has happened twice now so I'm hoping someone can help me out here. I'm running 10.6.2 and Fusion 3.0.1, and here's what I've done:

-Using Disk Utility, added a new FAT32 partition approximately 17 GB in size. I have 3 additional HFS partitions on the same drive, so BootCamp Assistant won't work, so this is how I set up my Windows "drive."

-Created a new VM and then used the rawdisk utility to map its only HD to the FAT partition

-Inserted a Windows 7 DVD and boot from it

Then I formatted the FAT partition to NTFS, ran setup, and it completed fine. After setup, everything worked great, I ran Windows Update to get the latest patches and restarted a few times. Then I shut down the machine and quit Fusion.

Here's the bizarre part: after this point, the machine will never boot again. Something happens to the drive that makes it unbootable. On the first power up attempt after restarting Fusion, Fusion tells me that the partition map has changed and I need to readd the raw disk. Fine, I do that, and it can't boot off it and goes to the Network Startup screen. I can see all the files on the partition through the Finder just fine. Startup Disk prefpane sees the partition too, and I can select it there and restart to get the following error: "No bootable device -- insert boot disk and press any key."

Thinking something happened, I redid the whole process starting from Inserting the Windows 7 DVD and formatting, installing, etc. Exact same behavior – shut down the machine, now can't boot from the drive.

Any ideas? Why does shutting down the machine somehow corrupt the bootability of the partition?

0 Kudos
22 Replies
WoodyZ
Immortal
Immortal

You need to recreate the rawdisk because you formatted the disk. Just run "/Library/Application Support/VMware Fusion/vmware-rawdiskCreator" aging and create a new raw disk and replace the old one with the new one and not to worry it's just meta-data.

Also does Fusion not recognize the disk by itself as a Boot Camp partition now that you've installed Windows 7?

Also if you're running it as a custom Boot Camp partition Virtual Machine not one normally created automatically by VMware Fusion then you need to disable the ability to Snapshot and Suspend or you could end up in real trouble.

Make sure the .vmx configuration file has the following two parameters and if not add them.

ide0:0.deviceType = "rawDisk"
suspend.disabled="TRUE"

0 Kudos
lensovet
Contributor
Contributor

Woody,

As I stated in my previous post I did do this. I also attempted to use the automatic Boot Camp machine template. The machine isn't the problem – the partition itself has somehow become corrupted such that it is no longer bootable.

Note I said – «Startup Disk prefpane sees the partition too, and I can select it there and restart to get the following error: "No bootable device -- insert boot disk and press any key."»

0 Kudos
WoodyZ
Immortal
Immortal

When you reformatted the FAT32 partition to NTFS did you delete and format of just format?

Message was edited by: WoodyZ

0 Kudos
lensovet
Contributor
Contributor

The installer just had a "Format" option. Note that the formatting from FAT happened only once. During the second install, the partition was (obviously) already in NTFS but had to be formatted so that it could be usable again.

Edit: this Format wipes contents of the disk and the installer warns you of this beforehand.

0 Kudos
WoodyZ
Immortal
Immortal

This may be a case of mis-matched MBR and GPT entries however if this is the case then this is an area that you want to help you with this as he is an expert in this area and I'd drop him a private message and ask him if he'd take a look at this thread for you. What he'll need to see is the output of the following command in a Terminal which redirects the output to a file on the Desktop named "gpt_mbr_info.txt" and then attach the file to a reply post

sudo gpt -r show /dev/disk0 > ~/Desktop/gpt_mbr_info.txt
sudo fdisk /dev/disk0 >> ~/Desktop/gpt_mbr_info.txt
/Library/Application\ Support/VMware\ Fusion/vmware-rawdiskCreator print /dev/disk0 >> ~/Desktop/gpt_mbr_info.txt

Note: Just copy and paste one line at a time into the Termnal (/Applications/Utilities/) and then press Enter after each and the attach the /gpt_mbr_info.txt file from the Desktop.

Also note if the target disk is not disk0 then change disk0 to the appropriate disk number.

0 Kudos
lensovet
Contributor
Contributor

In case anyone else is interested, here's the output of the first command:

pauls-macbook-pro:~ paulb$ sudo gpt -r show /dev/disk0
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  527828656      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  528238296     262440         
  528500736   33202176      3  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  561702912     262792         
  561965704   35153784      4  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  597119488     262144         
  597381632   27498632      5  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  624880264     262151         
  625142415         32         Sec GPT table
  625142447          1         Sec GPT header

and the second

pauls-macbook-pro:~ paulb$ sudo fdisk /dev/disk0
Disk: /dev/disk0	geometry: 38913/255/63 [625142448 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 -  527828656] HFS+        
 3: 0B 1023 254  63 - 1023 254  63 [ 528500736 -   33202176] Win95 FAT-32
 4: AF 1023 254  63 - 1023 254  63 [ 561965704 -   35153784] HFS+        

Despite what this output shows, partition 3 shows up in Disk Utility as NTFS.

And the final command:

pauls-macbook-pro:~ paulb$ /Library/Application\ Support/VMware\ Fusion/vmware-rawdiskCreator print /dev/disk0
Nr      Start       Size Type Id Sytem                   
-- ---------- ---------- ---- -- ------------------------
 1          1     409639 BIOS EE Unknown
 2     409640  527828656 BIOS AF HFS+
 3  528500736   33202176 BIOS  B Win95 FAT32
 4  561965704   35153784 BIOS AF HFS+

Woody, I will contact mudaltsov and see if he can provide any help, thanks for the pointer.

0 Kudos
mudaltsov
Expert
Expert

Sorry for the long delay in responding - I was on vacation, and just got back.

Let me make sure I'm understanding the situation correctly - you're installing Windows on a physical partition, but doing the installation inside a Fusion VM? Is there a reason you're not booting from the installation DVD directly? I'm not sure about Windows 7, but earlier versions of Windows would fail to boot natively if you installed them this way, because the physical and virtual hardware is different.

Installing in a VM would also explain the inability to boot. When you create a vmdk file with rawdiskCreator to reference partitions on a physical disk, it makes a copy of the partition table. If anything modifies the partition table while running in a VM, the copy will be modified instead of the physical partition table.

So during the Windows installation, the partition was formatted as NTFS, and also set as bootable, but these changes were not reflected on the physical disk's partition table, only on the copy of it. Afterwards, Fusion detected that the partition tables don't match anymore, and refused to boot. When you re-created the raw disk, the old partition table was used, without the NTFS type, and without the boot flag, which prevents it from booting.


It's possible to fix this by editing the partition table with fdisk. However, I would highly recommend just reinstalling Windows by booting from the installation DVD natively - this would ensure that you can also run Windows natively in Boot Camp when you need to. Unless there's a specific reason you didn't do this?

lensovet
Contributor
Contributor

Aha! Thanks mudaltsov, this makes a lot of sense.

Yes, you understood correctly about my installation process. Your explanation about the way rawdiskCreator works also completely makes sense as far as the results I'm seeing. Now to answer your question about why I was doing this in the first place:

I have obtained a legal ISO of the Windows 7 x64 install disc through the MSDNA program. Thinking that an ISO is just an ISO, I burned it to a DVD and attempted to boot from it. This failed, because apparently Microsoft doesn't quite support native EFI boot, or something along those lines . However since <a href="http://mactyler.com/technology/how-to-make-a-windows-7-64bit-mac-compatible-dvd/">the workaround</a> required burning a new DVD and modifying the ISO in Windows (as opposed to Mac OS X), and I discovered that I could use rawdiskCreator to get direct access to the partition, I decided to just give that a shot. Of course given the amount of time I've already spent on this, it would have been faster to just burn the other, "fixed" copy.

Given where we are now...you mentioned I could just edit the partition with fdisk. How would I go about doing that?

Thanks again for all your help!

0 Kudos
mudaltsov
Expert
Expert

Ah yes, I've hit that DVD boot issue myself. I highly recommend making a modified ISO even if you don't use it now, in case you ever need it later.

Are you able to boot Windows 7 natively, or does it fail to boot as well? Or are you not planning on doing that? (though why not just use a regular VM instead of a raw disk then?)

I haven't tried these steps myself on a physical disk, but I think they should work. You basically need to change the partition type to 7 (NTFS), and mark it as bootable. Afterwards, you'll need to re-create the raw disk VMDK file with the updated partition table.

The partition table can be modified with fdisk's interactive mode, fdisk -e /dev/disk0 with these commands:

  • print to get a printout of the current partition table (should be the same as what you posted above).

  • edit 3 to edit the third partition.

  • 7 for the partition type.

  • n to not use CHS mode.

  • specify the original partition offset and size (fdisk will incorrectly suggest values that fill the whole disk).

  • flag 3 command to mark the partition as bootable.

  • print to verify that the changes were correct - make sure only the Windows partition was modified, and it remained at the same sectors.

  • Finally, write to write the partition table to the disk (and y if it complains about exclusive access).

  • quit to quit (either at the end, or earlier, if any of the edits were incorrect).

Here's an example of all the fdisk prompts and the commands that need to be typed, along with a printout of the partition table before and after the changes:

$ sudo fdisk -e /dev/disk0
fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory
Enter 'help' for information
fdisk: 1> print 
Disk: /dev/disk0	geometry: 38913/255/63 [625142448 sectors]
Offset: 0	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 -  527828656] HFS+        
 3: 0B 1023 254  63 - 1023 254  63 [ 528500736 -   33202176] Win95 FAT-32
 4: AF 1023 254  63 - 1023 254  63 [ 561965704 -   35153784] HFS+        
fdisk: 1> edit 3
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 3: 0B 1023 254  63 - 1023 254  63 [ 528500736 -   33202176] Win95 FAT-32
Partition id ('0' to disable)  [0 - FF]: [B] (? for help) 7
Do you wish to edit in CHS mode? [n] n
Partition offset [0 - 625142448]: [528238296] 528500736
Partition size [1 - 96641712]: [96641712] 33202176
fdisk:*1> flag 3
Partition 3 marked active.
fdisk:*1> print
Disk: /dev/disk0	geometry: 38913/255/63 [625142448 sectors]
Offset: 0	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 -  527828656] HFS+        
*3: 07 1023 254  63 - 1023 254  63 [ 528500736 -   33202176] HPFS/QNX/AUX
 4: AF 1023 254  63 - 1023 254  63 [ 561965704 -   35153784] HFS+        
fdisk:*1> write
Device could not be accessed exclusively.
A reboot will be needed for changes to take effect. OK? [n] y
Writing MBR at offset 0.
fdisk: 1> quit

0 Kudos
lensovet
Contributor
Contributor

well, since as you described, the actual partition map of the disk is unchanged, and the bootable bit is not set, i can select the partition from Startup Disk prefpane but booting from it fails.

I will run the commands you provided once this time machine backup is complete and will then report the results. thanks again!

0 Kudos
lensovet
Contributor
Contributor

nope, no dice. I still get a black screen with a blinking underscore if I try to boot directly, and a network boot screen if I try to boot the vm.

Just to make sure, here's the current output of rawdiskCreator:

Nr      Start       Size Type Id Sytem                   
-- ---------- ---------- ---- -- ------------------------
 1          1     409639 BIOS EE Unknown
 2     409640  527828656 BIOS AF HFS+
 3  528500736   33202176 BIOS  7 HPFS/NTFS
 4  561965704   35153784 BIOS AF HFS+

FWIW, creating a new VM via the Boot Camp Getting Started item on the home screen provides equivalent results.

Any more ideas? It looks like I'm stuck with reinstalling for a third time with a bootable DVD...

0 Kudos
continuum
Immortal
Immortal

the NTFS partition is not activated




___________________________________

VMX-parameters- VMware-liveCD - VM-Sickbay


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
lensovet
Contributor
Contributor

my understanding is that it is, as denoted by the star next to the partition when running fdisk:

Disk: /dev/disk0	geometry: 38913/255/63 [625142448 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 -  527828656] HFS+        
*3: 07 1023 254  63 - 1023 254  63 [ 528500736 -   33202176] HPFS/QNX/AUX
 4: AF 1023 254  63 - 1023 254  63 [ 561965704 -   35153784] HFS+

0 Kudos
continuum
Immortal
Immortal

yes - now it is active - in last post it was not




___________________________________

VMX-parameters- VMware-liveCD - VM-Sickbay


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
lensovet
Contributor
Contributor

um, please drop the attitude and read more carefully. those two posts list outputs from two different programs. they were run at the same time.

rawdiskcreator does not seem to denote active volumes in any particular fashion.

0 Kudos
continuum
Immortal
Immortal

sorry - I missread - only noticed the blinking cursor which usually means not activated partition.

Bye - I wont bother you again




___________________________________

VMX-parameters- VMware-liveCD - VM-Sickbay


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
mudaltsov
Expert
Expert

Sorry, I forgot about the most important part - the actual MBR boot code. The base MBR sector only has the partition table without any code to boot the OS, and just as before, Windows only updated the copy of the MBR that has since been erased.

Reboot from the Windows ISO/DVD in the VM, and use the recovery command prompt to run bootrec /FixMbr. The steps to boot into recovery mode are explained in http://support.microsoft.com/kb/927392.

This will write the MBR code to the partition table copy (*-pt.vmdk). This should allow you to boot the VM again.


If you want to try to boot natively, you will need to copy the MBR code to the physical disk as well. Since the disk has mounted partitions while you're running OS X from it, regular dd won't work to copy the data. However, fdisk has all the necessary options to update just the MBR code, without touching the partition table. Use the following command:

sudo fdisk -u -f /path/to/rawdisk-pt.vmdk /dev/disk0

This should allow you to reboot natively in Boot Camp as well. However, I'm not certain that Windows will be able to boot natively because of the hardware differences. It may have to be repaired first.

lensovet
Contributor
Contributor

WOHOOOO! My machine boots in VM mode. I was able to create a new machine via the Boot Camp option on the home screen and it booooooots!

Thanks mudaltsov. However for the record I will say that the process was a little more involved. Namely, here's what happened:

-Booted from ISO

-Entered repair mode of the installer. Upon finding my W7 installation, it offered to automatically repair issues (and showed the installation on a 0-byte partition). I declined.

-Ran the bootrec command and rebooted

-Upon reboot, got a required device is inaccessible error

-Rebooted into installer again

-Repair mode offered to make some repairs again. This time I accepted and restarted.

-Upon reboot, no errors or attempts to load from the HD were made (seemingly) and the installer started on its own

-Went into repair mode again. This time the W7 installation it found was shown to be on a partition which was the correct size.

-Opened command prompt and ran bootrec command

-Restarted, and successfully booted off the HD!

Then, after verifying that everything was ok, I used the fdisk command you specified to copy the partition table to the physical disk. After this I created a new Boot Camp machine using the item on the home screen, and that booted successfully!

I have not had a chance to try a native boot. However my guess is that it should work ok.

Thanks again for your help!

Message was edited by: lensovet

0 Kudos
lensovet
Contributor
Contributor

And now I can confirm that I was able to boot without problems natively as well. Of course immediately after boot I had to wait a good 10 minutes for Windows to install the drivers (on its own) of all the new hardware it detected, then I used the drivers supplied on the Boot Camp Snow Leopard disc to bring the rest of the hardware into usable form. Windows Update even updated the Ethernet and WiFi drivers afterwards! The drive also shows up properly if you hold option during startup.

The only downer at this point is that the Boot Camp install wizard refuses to run on my machine, claiming that x64 is not supported on it. For the most part this means that the function keys don't work the same way they do in Mac OS, and the trackpad is somewhat useless – no right-clicking or scrolling. My machine is a late-2007 15" Macbook Pro.

Thanks mudltsov, again, for your help! The remaining issues are now in Apple's court...

0 Kudos