BootCamp from external USB drive

I use Apple Macbook Pro and iMac for work and at home, as well as HP z820 Workstation for development. Sometimes there is a need to demonstrate the software I am responsible for on the Apple equipment, but the software is designed for Windows. Whilst it can run in a virtual machine, some demos require the bare hardware approach for performance. To do this I have built a system on an external USB hard drive that can be booted from the Apple boot menu using the Option key. It makes extensive use of boot from VHD, introduced in Windows 7 and Server 2008 R2, and uses base VHD images with differencing disks to allow different demo scenarios to be loaded.The VHD images are converted from existing VMware virtual machines running on either Workstation or Fusion depending on platform.

Windows Server 2008 R2 is the version of Windows used for my demos, and whilst Apple supply BootCamp, neither the version of the OS or booting from a USB drive is supported so some work must be done to make this work. Everything can be made to function except Bluetooth as Windows server variants do not have a Bluetooth stack, and USB 3 cannot be enabled as this stops booting from USB.

Step 1 – Prepare the VMware Guest

The guests used for demos have been configured following the guidelines on this site to give the best visual experience. Most importantly the Windows Wireless service feature has been installed and it is set to run on boot.

Some registry setting changes need to be made to the guest to enable boot from USB2 and to cleanup the image:

  1. Remove paging files
  2. Disable paging files
  3. Increase the timeout to find the boot partition
  4. Ensure AHCI service starts at boot time
  5. Ensure USB2 service starts at boot time

At this stage reboot the guest in VMware to check that it as still works as a functioning Windows system.

Step 2 – Convert VMDK to VHD

There are two ways to convert the VMDK to a VHD that can be used for directly boot on the physical hardware.  Firstly the Microsoft Disk2VHD utility can be used in the running guest to create a VHD file. This then needs to be transferred to host before shutting down the guest. Second option is Starwind’s V2V converter, which takes a shutdown guest’s VMDK file and converts it to a number of different formats.

There are other options but these are the two that I have used and had positive results with for this process.

Step 3 – Configure the USB drive

These steps have to be done from another Windows operating system with the USB drive attached. This can be a real Windows system or a VM running in VMware. The drives I used were partitioned and formatted using MBR and a single NTFS partition. In this example M: is the USB drive and R: is the mounted VHD file.

Mount the newly created VHD on the currently booted Windows system:

Copy the VHD to the drive and then make it bootable by the addition of the boot sector and the NT boot loader:

  1. Write the MBR boot sector code
  2. Copy the VHD’s BCD entries to the USB drive
  3. Copy the current default boot entry to BCD
  4. Set the copy’s DEVICE entry to the VHD file
  5. Set the copy’s OSDEVICE entry to the VHD file
  6. Ensure HAL detection is switched on

The GUID will change for each copy and will need to be replaced with the correct GUID for the BCD entry.

Step 4  – Boot the system to Windows

Shut the system down and get ready to reboot into the Windows USB drive.

On the Macbook Pro 15″ Retina Mid-2012 the drive MUST be plugged into the left USB port.

Power on the machine whilst holding the Option key until the boot selector is shown, and select the USB drive. It should now boot to Windows and start trying to install the device drivers.

Step 5 – Install Apple Bootcamp drivers

As we are using a USB2 drive to boot, we cannot install the USB3 drivers from the Bootcamp support package. To avoid this we need to make a modification to the XML file used to drive the installation. Unzip the Bootcamp package from the Apple Support download page. In the BootCamp subfolder you will need to edit the BootCamp.xml file and remove the following lines:

It is also a good idea to delete or move the file BootCamp\Drivers\Intel\IntelxHCISetup.exe.

Now run the BootCamp installer and let it complete. Following the reboot you should have everything working apart from the Bluetooth driver. This device can be disabled from the Device Manager.

There may be more tricks available to make this work and I will add additional posts if I find more. I would still like to get Bluetooth working and will look into that as the next step.