Boot Camp – OSX Lion, Windows 7 x86 and Windows 7 x64 – Triple Boot

This was a process I tinkered with in order to triple boot OSX Lion, Windows 7 x86 and Windows 7 x64 (as a VHD file) all on the same device.

Note: Booting Windows as a VHD requires Ultimate or Enterprise editions.(http://technet.microsoft.com/en-us/library/dd440865(WS.10).aspx)

Boot Camp Assistant will set-up your partitions on disk for you automatically. However, it formats the disk so that you cannot create any additional primary partitions. To remedy that, I create a Virtual Hard Disk (VHD) from within Windows and edit it’s bootloader to be able to switch between multiple installations of Windows instead of burning some Linux disk partitioner software and manually creating everything. This way, OS X is installed clean from the Lion image, and doesn’t interfere with my multiple Windows 7 test OSes.

1 – Install/boot up OSX. Make sure you have Recovery Assistant handy if you blow something up. (http://support.apple.com/kb/DL1433)

2 – Open Boot Camp Assistant, split disk according to what you want Windows to use ( I do 50/50)

3 – Download Windows support media and burn using the SuperDrive when prompted

4 – Insert the Windows 7 install media and let OSX finish the installation

5 – Install the support tools from OSX

Ta-da! A standard boot camp installation. Now, lets install our second copy of Windows.

1 – Create a new VHD (Virtual Hard Drive) to install your second copy of Windows 7 on.

Example below created a 100GB fixed size disk. Adjust to what space you want with maximum setting.

From an Elevated Command Prompt:

diskpart
create vdisk file=c:\Windows7.vhd maximum=102400 type=fixed 
select vdisk file=c:\Windows7.vhd
attach vdisk
create partition primary
assign letter=v
format quick label=VHD
exit

2 –  Apply a Windows WIM image to the VHD using ImageX.exe

ImageX.exe is available in the WAIK (http://www.microsoft.com/download/en/details.aspx?id=5753) toolkit and can be copied to the local Windows 7 machine from:

C:\Program Files\Windows AIK\Tools\<x86 or amd64>\imagex.exe .

An install WIM (x64) can be copied from your install media (Extracted .ISO or physical disk): \sources\install.wim

Copy the .WIM file from your location to your fresh Windows 7 image.

imagex.exe /apply <pathtowim> 1 v:

Example:

imagex.exe /apply c:\extractediso\sources\install.wim 4 v:

(I applied a MSDN copy of Windows 7 Ultimate. Windows 7 is index #4 of the install.wim image included in the download from MSDN.

Side note: To determine what is in a WIM image, run command:

dism.exe /get-wiminfo /WimFile:C:\extractediso\sources\install.wim /Index:# )

Unmount the VDISK from an Elevated Command Prompt:

diskpart
select vdisk file=c:\Windows7.vhd
detach vdisk
exit

3 – Edit the Windows bootloader from within the existing Windows installation to recongize the VHD as an OS:

Open an Elevated Command Prompt

bcdedit /copy {current} /d "Name You Want To Appear Windows Boot Manager"

A long number is generated and displayed. Copy the long number {CLSID} and use it in the following commands:

bcdedit /set {CLSID} device vhd=[C:]\Windows7.vhd
bcdedit /set {CLSID} osdevice vhd=[C:]\Windows7.vhd
bcdedit /set {CLSID} detecthal on

Edit the Boot Loader Timeout (if you want to):

bcdedit /timeout 45

Reboot. Select the new virtual disk from the boot menu. It will finish a new installation of Windows. Run the support media again.

References:

http://technet.microsoft.com/en-us/library/dd744338(WS.10).aspx

http://social.technet.microsoft.com/wiki/contents/articles/how-to-boot-from-a-vhd.aspx