Sunday, August 12, 2012

Multi-Booting Windows 7, Windows 8, Mac OS X Lion and Ubuntu

Getting Started

Things you need:
- Lion USB prepared with UniBeast (see
- Win7 install media (preferably USB stick with Win7 SP1)
- Win8 install media (USB stick)
- Ubuntu 12.04LTS (USB stick) (see
- A blank HDD or SSD ready as install target

Section A (plan your partition scheme)

When setting up a multi-boot system involving Windows it is important to realize you will need to create what is known as a hybrid MBR/GPT partition scheme.  It is necessary to place all partitions intended to be accessed by Windows such that they are in sync’d MBR table.  This means they should be placed first.  For this guide, I will be setting up the following partitions on a 320GB hard drive:
EFI: 200MB, created by Mac OS X Disk Utility when partitioning
Win7: ~60GB, NTFS
Win8: ~60GB, NTFS
Transfer: ~60GB, exFAT (could use FAT32 as well)
Lion:~60GB, Mac OS X Extended (journaled)
Linux-Swap: 8GB (my computer has 8GB memory)
Linux: a bit less than 60GB (amount left), ext4
As a result, the Win7, Win8, and Transfer partitions are accessible to MBR based Windows.  Lion and Linux can access all of the partitions.  The Transfer partition can be used to move data between systems.

Section B (create initial partition scheme)

  1. Boot from the Lion USB key.
  2. Go into Disk Utility
  3. Select Partition tab
  4. Select to repartition as GPT the entire drive.  In my case, I use 5 partitions here (this will give you 5 equal sized partitions, if you want something different, you can do that).  Label, and set the file system type as follows:
    Win7, FAT32
    Win8, FAT32
    Transfer, exFAT
    Lion, Mac OS X Journaled
    Linux, FAT32
  5. Apply your changes, and Quit Disk Utility
  6. Shutdown your computer
  7. Remove Lion USB key.
  8. Insert the Ubuntu USB key, turn on computer and boot from Ubuntu USB
  9. Connect to wireless if necessary (if you don’t have the ethernet cable plugged in)
  10. Open the Ubuntu Software Center application
  11. Go to the Edit menu, and select “Software Sources…”
  12. Check the box for “universe”, then click Close
  13. Run Terminal (easiest way is Ctrl+Alt+T)
  14. Run the following commands:
    sudo apt-get update
    sudo apt-get install gptsync
  15. Copy gptsync to your Linux USB for later use (that way if you have to run it again, you don’t have to reinstall using apt-get above):
    sudo cp /sbin/gptsync /cdrom/gptsync
  16. Now run gparted (go to Ubuntu Home and type gparted, then click on it)
  17. gparted will scan your drives and display the first one
  18. If you have multiple drives in your system, make sure the target drive is displayed (for this guide I have one HDD known under Linux as /dev/sda)
  19. The last partition in the list should be the Linux/FAT32 partition… Delete that partition
  20. Create a new partition (select the unallocated space, then select Partition –> New from the menu)
  21. Make the size 8192 (smaller or larger depending on how much RAM you have)
  22. Set the file system type to ‘Linux-Swap’, and set the Label to ‘Linux-Swap’
  23. Now create another new partition, this time use all remaining space, and set the file system type to ‘ext4′ and Label to ‘Ubuntu’
  24. Select the Win7/FAT32 partition, and Format it as NTFS
  25. Select the Win8/FAT32 partition, and Format it as NTFS
  26. Apply the changes
  27. Select the first NTFS partition (the one that was Win7/FAT32) and label it Win7
  28. Select the second NTFS partition (the one that was Win8/FAT32) and label it Win8
  29. Apply the changes… You should now have a complete partition setup that matches our plan in Section A
  30. Now go back to the Terminal window that you launched earlier, and type the following:
    sudo /cdrom/gptsync /dev/sda
    (note: /dev/sda is the target drive)
  31. Shutdown the computer, and remove the Ubuntu USB key

Section C (Install Windows 7)

  1. Insert your Windows 7 USB key, and boot from it (alternatively, use your Win7 DVD)
  2. Choose your language, click Install Now, accept the license then choose ‘Custom’
  3. You should be able to select the Win7/NTFS partition and click Next.  If you can’t, format that partition (Drive Options within the Windows 7 installer).  If you still can’t install to that partition after formatting, close the Windows 7 Installer, and restart the computer, restarting the Windows 7 installer.
  4. Proceed to completely install Windows 7
  5. At the end of the Install sequence you now have Windows 7 installed with the Windows 7 boot loader
  6. Shutdown the computer, and remove the Windows 7 USB key

Section D (Install Windows 8)

  1. Insert your Windows 8 USB key, and boot from it
  2. Choose your language, then choose ‘Custom’
  3. You should be able to select the Win8/NTFS partition and click Next
  4. Proceed to completely install Windows 8
  5. At the end of the Install sequence you now have Windows 7 and Windows 8 installed using the Windows 8 boot loader (dual boot Win7/Win8 — this will cause trouble when we go to use the Chimera boot loader, but we’ll fix it later)
  6. Shutdown the computer, and remove the Win8 USB key

Section E (Install Lion)

  1. Insert your UniBeast prepared Lion install USB key, and boot from it.
  2. Choose your language
  3. If you proceed to the target selection page, you will probably notice that it won’t allow you to install to the Lion partition created earlier (I’m not sure why, but we fix that in the next step)
  4. Run ‘Disk Utility’ (again).
  5. Choose the ‘Lion’ partition on the left, then ‘Erase’ tab on the right.
  6. Erase (format) it as Mac OS X Extended (journaled)
  7. Quit Disk Utility
  8. You can now select ‘Lion’ as the target partition for Mac OS X install.
  9. Do that and run through the install like normal.
  10. After install, do any post-install stuff you need to do (in my case running HP ProBook Installer v4 to install, among other things, Chimera boot loader)
  11. Shutdown the computer, and remove the Lion USB key.
  12. You should be able to boot from the hard disk now and see the Chimera boot loader (or whatever boot loader you’re using)

Section F (Cleanup Windows BCD bootmgr)

First of all, if you are only installing one Windows operating system (just Windows 7 or just Windows 8), you can skip this section.  Otherwise, read on.

Now that you have Chimera installed, you can use it exclusively to boot between Windows 7 (although it is cumbersome), Windows 8, and Lion.  For now, if you attempt to boot the Win8 partition using Chimera, it will not work, but if you boot Win7 partition using Chimera, you will get the Windows 8 boot menu and you’ll be able to boot either Win7 or Win8 (Chimera is loading the Windows 8 boot loader).  The goal of this section is to fix that so, you can boot directly into the Win7 and Win8 partitions.

Basically what is going on here is that Windows 8 installed the Windows 8 boot loader into the Win7 partition and set up a dual boot between Win7/Win8.  There is no Windows boot loader on the Win8 partition.

Here’s how we fix this mess:
  1. Using Chimera, boot the Win7 partition
  2. You will now see the Windows 8 boot loader with selections for Windows 7 and Windows 8
  3. Choose to boot Windows 8 (Note: If you instead select Windows 7, the Windows 8 boot loader will reboot the computer, you will see the Chimera screen again, and should you select the Win7 partition from there, you will then boot directly to Windows 7)
  4. Once in Windows 8, go to the Desktop, then right click on the bottom-left corner of the screen, from the menu, choose “Command (Admin)”
  5. OK the UAC prompt
  6. You are now in the Windows 8 command line
  7. Some explanation might be handy here if your drive configuration is different than mine.  In my case there is only one HDD, so at this point in Windows 8, the C: drive is the Win8 partition and the D: drive is the Win7 partition.  We need to copy the necessary files for boot from the Win7 partition to the Win8 partition, as the Win8 partition doesn’t have a complete boot loader.  To do this we execute the following commands:
    robocopy d:Boot c:Boot /mir /xf bcd.*
    bcdedit /export c:BootBCD
  8. Now we have a copy of the necessary boot files on both the Win7 and Win8 partitions, which will allow us to boot either one from Chimera.  Next we have to make it such that each boot menu contains only Windows 7 or Windows 8, and make it such that the boot menu does not appear.  To do so, you need to follow these instructions carefully.  First of all let’s fix up the Windows 8 boot menu.
  9. First you need to determine the identifier used for the Windows 7 entry in the boot loader.  Run the following:
    bcdedit /store c:BootBCD
  10. This displays information about the BCD menu on the Win8 partition.  You want to look for the second “Windows Boot Loader” entry where it says “identifier”.  That is the entry you want to delete.
  11. In my case the identifier is {408f7757-c9e3-11e0-8a2d-b7f526558aef}, so the command required is:
    bcdedit /store c:BootBCD /delete {408f7757-c9e3-11e0-8a2d-b7f526558aef} /cleanup
  12. We also need to fix up the {bootmgr} device entry:
    bcdedit /store c:BootBCD /set {bootmgr} device partition=C:
  13. After that, you are done with the boot loader on the Win8 partition.  To check your results, type:
    bcdedit /store c:BootBCD
  14. Now you have to fix up the Win7 boot entries, such that they do not include Windows 8. First determine which entry must be deleted:
    bcdedit /store d:BootBCD
  15. It will probably look exactly like the one above before we changed it.  The Windows 8 identifier should be {default}, so to delete it, we use:
    bcdedit /store d:BootBCD /delete {default} /cleanup
  16. Now we need to make it such that the menu doesn’t display in either case:
    bcdedit /store c:BootBCD /set {bootmgr} displaybootmenu no
    bcdedit /store d:BootBCD /set {bootmgr} displaybootmenu no
  17. At that point, we should be done.  You can display your work and double-check it with:
    bcdedit /store c:BootBCD
    bcdedit /store d:BootBCD
  18. Each boot menu should have only one boot menu entry, and they should be pointing to the appropriate partition… Win8 to C:, and Win7 to D:
  19. Restart the computer and try booting into each Win7 and Win8 partitions from Chimera.  It should work with no intervening Windows boot loader menu now.

Section G (Cleanup the Chimera menu)

When you boot your computer, you will notice that the Chimera boot loader picks up on the Transfer/exFAT partition and shows ‘GPT unknown’.  It would be nice to eliminate this from the menu.

  1. To do so, use Chimera to boot into Lion
  2. Once there, bring up a Terminal to determine which partition the exFAT partition is by typing: diskutil list
  3. Look under the IDENTIFIER column.  If you are following this guide exactly, the Transfer partition will be ‘disk0s4′
  4. Now use TextEdit to edit your /Extra/org.chameleon.Boot.plist
  5. Find or add the <Key>Hide Partition</key> section
  6. In the line below it, change or add the line to read:
  7. That should hide the partition 4 on disk 0.
  8. Save the file.
  9. Restart to test, then Shutdown the computer.

Section H (Install Ubuntu)

  1. Turn on the computer and boot using the Ubuntu install USB
  2. Choose the first option, “Run Ubuntu” (do not choose the installer directly)
  3. After you arrive at the Ubuntu desktop, if you’re not connected to the internet, you may want to take this opportunity to do that (via the menu bar at the top of the screen)
  4. After that, choose the second icon down (run the Ubuntu installer)
  5. Answer the various questions about language, then Continue
  6. Eventually, you’ll come to a screen that asks about “Installation Type”. Choose “Something Else” from this screen. This gives you greater control over where Ubuntu installs.  Then click Continue.
  7. It will now scan disks.
  8. Look in the resulting list for the partition made earlier of ‘ext4′ type.  In my case, it is /dev/sda7.  Select it and click ‘Change’
  9. Change the ‘Use as’ to ‘Ext4 journaling file system’
  10. Change the ‘Mount point’ to ‘/’ (no quotes), click the checkbox to Format, then click OK.
  11. Find the swap partition created earlier. In my case it is /dev/sda6.  Select it and click ‘Change’.  Verify that it is using it as ‘swap area’ (should already be setup that way).  Click OK.
  12. IMPORTANT! You will want to pay special attention to the ‘Device for boot loader installation’.  Change it to the same ext4 partition we used in steps 9 & 10. This will cause grub2 to be installed on the Ubuntu partition and won’t interfere with the Chimera boot loader already installed.  Again, in my case, it is /dev/sda7.
  13. You are now ready to install Ubuntu, so click ‘Install Now’, ignore the warning about the boot loader installation and Continue.
  14. While it is copying files, you can answer the other questions about Location, Keyboard layout, account, etc.
  15. Skip the part about importing accounts from Windows (ie. no checkbox)
  16. After Ubuntu installs is a good time to check to be sure the hybrid partition scheme is still intact, so don’t restart right when it asks you to.  Instead, bring up a terminal (Ctrl+Alt+T) and type:    sudo /cdrom/gptsync /dev/sda
    (of course, substituting /dev/sda with the real path of your HDD in case it is not /dev/sda)
    Answer Y, if it proposes changes.
  17. Now you are ready to restart and test.  You should now be able to boot Windows 7, Windows 8, Mac OS X Lion, and Ubuntu from the Chimera menu.  You will notice that you see the grub menu in the case of booting Linux, but we can fix that in the next section.

Section I (Cleanup/Disable GRUB2 menu)

  1. Boot into Ubuntu
  2. Type the following:
    gksu gedit /etc/default/grub
  3. In the editor, uncomment the GRUB_HIDDEN_TIMEOUT=0, and make GRUB_TIMEOUT=0, then save the file
  4. Back in the terminal, type:
    sudo update-grub
  5. Restart and test.  At this point, if you select Ubuntu from the Chimera boot loader, it should go directly there and you won’t see the GRUB2 menu (if you want it, supposedly you hold down shift while booting… side note: it didn’t work for me).

Section J (Install support for exFAT in Ubuntu)

In order to use the Transfer partition from Ubuntu, you need to install exFAT support as it doesn’t support it natively.  I used exFAT because it is a little more capable that FAT32 (particularly in support for files larger than 4GB)… if you decided to just use FAT32, you can skip this section.

  1. Boot into Ubuntu, then run Terminal (Ctrl+Alt+T)
  2. First we need to install exfat support using apt-get:
    sudo apt-add-repository ppa:relan/exfat
    sudo apt-get update
    sudo apt-get install fuse-exfat
  3. Now you can mount the Transfer (on /dev/sda4 in Linux) partition with:
    sudo mkdir /mnt/transfer
    sudo mount -t exfat /dev/sda4 /mnt/transfer
  4. And you can make it mount automatically, by editing fstab:
    gksu gedit /etc/fstab
  5. Once in the editor, add the following line to the bottom:
    /dev/sda4 /mnt/transfer exfat defaults 0 0
  6. Save, then to mount and check after that edit:
    sudo mount -a

Section K (Disable Fast Startup for Windows 8)

It appears that the new Hybrid Hibernate/Fast Startup feature new in Windows 8 does not work with this Chimera boot scheme.  I would suggest you disable it:

  1. Boot to Windows 8
  2. Go to the Windows 8 Desktop
  3. Right click at bottom left corner of screen, and choose Control Panel
  4. Search for ‘Power Options’
  5. Choose ‘Change what the power buttons do’
  6. Choose ‘Change settings currently unavailable’
  7. Scroll down to Shutdown settings
  8. Untick “Turn on fast startup (recommended)”
  9. Now shutdown from Windows 8 will now work correctly.


If you made it this far, you may be deciding to give it a try.  And if you do, please leave feedback as a comment. And if you find an error, let me know and I’ll try to fix it.  Good luck!

Source: Guide to Installing Windows 7, Windows 8, Mac OS X Lion, and Ubuntu Multi-Boot.