setting the active partition

Discussion in 'Feature Suggestions' started by joevt, Nov 5, 2009.

  1. joevt

    joevt Forum Maven

    Messages:
    1,229
    I'm using Parallels 5. What I would like to see in the virtual machine Boot Camp hard disk "Edit partitions" dialog is a radio button that allows the user to select which partition is the active partition (the one that will be booted).


    I have a disk with 3 partitions - Windows Vista 64, Windows Vista 32, and Windows XP:
    Code:
    diskutil list
    /dev/disk3
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *320.1 GB   disk3
       1:                        EFI                         209.7 MB   disk3s1
       2:       Microsoft Basic Data Windows Vista 64        85.7 GB    disk3s2
       3:       Microsoft Basic Data Windows Vista 32        86.1 GB    disk3s3
       4:       Microsoft Basic Data Windows XP              148.1 GB   disk3s4
    
    fdisk  /dev/disk3
    Disk: /dev/disk3	geometry: 38913/255/63 [625142448 sectors]
    Signature: 0xAA55
             Starting       Ending
     #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
    ------------------------------------------------------------------------
     1: EE    0   0   2 -   25 127  14 [         1 -     409639] <Unknown ID>
     2: 07   25 127  15 - 1023 184  54 [    409640 -  167352736] HPFS/QNX/AUX
     3: 07 1023 254  63 - 1023 254  63 [ 167762376 -  168191584] HPFS/QNX/AUX
    *4: 07 1023 254  63 - 1023 254  63 [ 335953960 -  289188448] HPFS/QNX/AUX
    
    (Note: I believe Windows XP must be listed as the last partition of the MBR on a Boot Camp disk for it to boot properly. Vista can be listed anywhere in the MBR except position 1 which is for the EFI partition. Partitions in the MBR don't need to be ordered by start block so it's possible for the XP partition to start before the other partitions.)

    I've setup the boot config on each partition so that none of them shows the partition selection screen when they boot. I use rEFIt instead to select which partition to boot. rEFIt sets the active partition in the MBR then that partition is booted directly.

    Parallels has a Boot Camp option that lets me select any combination of those partitions. Any partitions that are not selected are hidden from the virtualized Windows environment. To do this, Parallels creates it's own MBR (PhysicalMbr.hds in the .pvm) which includes only the selected partitions.

    There is a problem though. The MBR that Parallels creates has the active partition set the same as the one that is set in the MBR on the disk. If I want to boot my Vista 32 partition in Parallels, then I need to set the active partition to that partition (because it was set to Windows XP):

    Code:
    sudo fdisk -e /dev/disk3
    fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory
    fdisk: 1> flag 3
    Partition 3 marked active.
    fdisk:*1> print
    Disk: /dev/disk3	geometry: 38913/255/63 [625142448 sectors]
    Offset: 0	Signature: 0xAA55
             Starting       Ending
     #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
    ------------------------------------------------------------------------
     1: EE    0   0   2 -   25 127  14 [         1 -     409639] <Unknown ID>
     2: 07   25 127  15 - 1023 184  54 [    409640 -  167352736] HPFS/QNX/AUX
    *3: 07 1023 254  63 - 1023 254  63 [ 167762376 -  168191584] HPFS/QNX/AUX
     4: 07 1023 254  63 - 1023 254  63 [ 335953960 -  289188448] HPFS/QNX/AUX
    fdisk:*1> write
    Writing MBR at offset 0.
    fdisk: 1> exit
    
    If I make sure the active partition is set before I create each virtual machine, then I can make a virtual machine for each partition on the Boot Camp disk and run them all at once. Sometimes, for the Windows XP virtual machine, the selected partitions switches from just #4 to #2 and #4 for some strange reason and then I'll need to reset the selection and maybe also the active partition.
     
  2. joevt

    joevt Forum Maven

    Messages:
    1,229
    If you get the "Missing operating system" error message when trying to boot a Boot Camp partition, it might mean that the active partition in the MBR of the virtual hard disk is set to the wrong partition. Instead of using fdisk on the real hard disk like I mentioned above, you can use fdisk on the virtual MBR:

    1) Run Terminal.app from your Utilities folder.
    2) Type "fdisk -e " on the command line (no quotes, add the trailing space).
    3) Drag the PhysicalMbr.hds file from the .hdd package in your .pvm package to the Terminal.app window.
    4) Press return in Terminal.app to use fdisk to edit that file.
    5) Type "print" to print the current contents of the MBR. The active partition is the one with the * next to it.
    6) Type "flag #" where # is the partition you want to make the active partition.
    7) Type "write" to save the contents of the MBR file.
    8) Start the virtual machine in Parallels to test the new MBR.
    9) Type "exit" in Terminal.app to quit fdisk.

    In the following example, the active partition was set to 4 but my Windows Vista 64 partition is 2:
    Code:
    joevt$ fdisk -e /Users/joevt/Documents/Parallels/Windows\ Vista\ 64.pvm/WDC\ WD3200JD-22KLB0\ \(disk1\).hdd/PhysicalMbr.hds 
    fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory
    Enter 'help' for information
    fdisk: 1> print
    Disk: /Users/joevt/Documents/Parallels/Windows Vista 64.pvm/WDC WD3200JD-22KLB0 (disk1).hdd/PhysicalMbr.hds	geometry: 0/4/63 [1 sectors]
    Offset: 0	Signature: 0xAA55
             Starting       Ending
     #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
    ------------------------------------------------------------------------
     1: EE    0   0   2 -   25 127  14 [         1 -     409639] <Unknown ID>
     2: 07   25 127  15 - 1023 254  63 [    409640 -  167352736] HPFS/QNX/AUX
     3: 07 1023 254  63 - 1023 254  63 [ 167762376 -  168191584] HPFS/QNX/AUX
    *4: 07 1023 254  63 - 1023 254  63 [ 335953960 -  289188448] HPFS/QNX/AUX
    fdisk: 1> flag 2
    Partition 2 marked active.
    fdisk: *1> print
    Disk: /Users/joevt/Documents/Parallels/Windows Vista 64.pvm/WDC WD3200JD-22KLB0 (disk1).hdd/PhysicalMbr.hds	geometry: 0/4/63 [1 sectors]
    Offset: 0	Signature: 0xAA55
             Starting       Ending
     #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
    ------------------------------------------------------------------------
     1: EE    0   0   2 -   25 127  14 [         1 -     409639] <Unknown ID>
    *2: 07   25 127  15 - 1023 254  63 [    409640 -  167352736] HPFS/QNX/AUX
     3: 07 1023 254  63 - 1023 254  63 [ 167762376 -  168191584] HPFS/QNX/AUX
     4: 07 1023 254  63 - 1023 254  63 [ 335953960 -  289188448] HPFS/QNX/AUX
    fdisk:*1> write
    Writing MBR at offset 0.
    fdisk: 1> exit
    
     
  3. Crazy Homeless Guy

    Crazy Homeless Guy Bit poster

    Messages:
    5
    Thank you for posting this. This is the exact problem I am having. I do however need some more help...

    I am not a native OSx user, and I am new to Parallels. Could you please explain where to find the 'PhysicalMbr.hds' file?
    Cheers,
    Travis
     
  4. Crazy Homeless Guy

    Crazy Homeless Guy Bit poster

    Messages:
    5
    I tried the using the terminal app in OSx but it didn't recognize he 'fdisk -e ' command. It simply listed the parameters I was allowed to use, even though what I was typing appeared to be a parameter.

    Here is what I get if I run bcdedit.exe in the windows environment...
     

    Attached Files:

  5. Specimen

    Specimen Product Expert

    Messages:
    3,242
    fdisk is not a command that comes with Windows, in the examples given fdisk was run from OS X Terminal.app (fdisk does come with OS X.)
     
  6. Crazy Homeless Guy

    Crazy Homeless Guy Bit poster

    Messages:
    5
    I tried it in the OSx environemnt. Since there is a FDisk for Windows as well I decided to try it there to see if anything happened. I am not sure if FDisk is still present in Windows 7 though.
     
  7. Crazy Homeless Guy

    Crazy Homeless Guy Bit poster

    Messages:
    5
  8. Specimen

    Specimen Product Expert

    Messages:
    3,242
    Two things VERY wrong:
    * You're doing this with the VM running.
    * fdisk -e and the path to PhysicalMbr.hds are supposed to be written on the SAME LINE. You SHOULD NOT press enter/return after fdisk -e! Joevt clearly says 'press return' only in step 4.

    The instructions are very well detailed down to when you should press return, fdisk is a powerful command and can seriously mess your system if you make an error or you have no idea what you are doing. I'm sorry to say that if you didn't realize you shouldn't have pressed return after fdisk -e and you're doing this with the VM running I have no confidence you can safely follow these instructions. You also tried to use fdisk from windows command prompt. These are all signs you shouldn't be doing this.


    Since this is a Bootcamp VM it's safer to create a new VM using your Bootcamp installation and ditch this one.
    Joevt's instructions are geared towards the fact of having multiple bootcamp partitions as the cause for this error, I don't think that's even your case.
     
    Last edited: Jan 5, 2012
  9. joevt

    joevt Forum Maven

    Messages:
    1,229
    If the problem that Crazy Homeless Guy has is really the same as I describe (where the hard disk has more than one Windows OS and the MBR of the hard disk is set to boot a different partition than the one you want), then creating a new Boot Camp VM will not work until the MBR of the hard disk is setup properly or the new VM includes all disks and partitions involved in booting the Mac into Boot Camp.

    It's possible that the problem might be that his Boot Camp VM's virtual hard disk was set to use a certain disk identifier (e.g. "disk0") for a hard disk but the hard disk's disk identifier may have changed since the Mac has restarted. In that case, creating a new Boot Camp VM would fix that at least until the next restart. You can tell this is the problem if you click the Source popup menu for the Hard Disk in the virtual machine's hardware configuration and see that the last disk is selected and has a manufacturer name (or Disk Description or Name) that is the same as another disk in the popup menu when you know that your computer includes only one disk with that manufacturer name (as seen in Disk Utility.app). If you use Get Info in Disk Utility.app, then you can see the Disk Identifier of a hard disk. In the Source popup menu for the Hard Disk in the virtual machine's hardware configuration, the first hard disk will have the correct Disk Identifier.

    Instead of creating a new Boot Camp VM, it may be sufficient to just change the Source. If not, then it may be sufficient to remove the Hard Disk 1 from the virtual machine's hardware configuration (select Hard Disk 1 then click the [-] button), then adding a new Hard Disk (click the [+] button) to the virtual machine's hardware configuration and point the new Hard Disk at the Boot Camp disk.
     

Share This Page