Installing Windows 8.1 on an external USB drive

With Windows 8.1, Microsoft introduced a feature called Windows-to-go which enables the installation of Windows on external drives. Only if you have a Microsoft-certified external drive. Only if you have Windows 8.1 Enterprise.

If not? Bummer.

Or? Actually, there is a way. Not wanting to "pollute" my internal SSD with Windows, I started investigating what the options are.

Disclaimer

The following steps might result in data corruption or loss and your coffee machine might stop working. Have a backup of your data ready before you proceed. If the words "command line", "BIOS" or "partition" do not mean anything to you or scare you, please do not proceed.

The outset

I wanted to install Windows 8.1 on an external USB 3.0 drive connected to a MacBook Pro running OS X Yosemite. This drive already had a HFS+-formatted partition I had shrunk by 120GiB to make space for Windows 8.1.

I already had a version of Windows 8.1 installed in VMware Fusion. Bootcamp is not an option since it merely prepares your hard drive - the installation itself is done by Windows which calmly refuses to install on any external drive.

What didn't work

  • first idea: Clone the VMware disk to the physical volume. While it might actually work on BIOS-based machines, on a Mac you're out of luck with this approach, since VMware uses MBR instead of GPT partitions and a Mac cannot boot off these.
  • second idea: Use the VMware Windows 8.1 to create a WinToUSB drive and clone this to a GPT partition on the external drive, then boot this. While promising, the cloned version refused to boot.

What did work

Prerequisites

First, if you create a partition table and subsequently, partitions with Disk Utility in GPT format, the partition table is actually a hybrid, containing both an MBR and a GPT - Windows will only see the MBR, OS X the GPT. If you boot the BIOS version of the Windows setup, it'll complain it cannot install to a GPT partition, if you boot the UEFI version of the Windows setup, it'll complain it cannot install to a MBR partition.

The first step towards a successful installation therefore is to remove the hybrid partition table. The utility gdisk can help you with that. Prepare your drive with these steps (source):

  1. run gdisk on the target disk, gdisk /dev/diskN
  2. check if you are on the right disk by viewing the partition table by pressing p. If you took a wrong turn, press q to quit gdisk.
  3. Press x to open the expert's menu.
  4. Press n to create a new protective, empty MBR. gdisk will not output anything, just a new prompt.
  5. Press w to save the changes and confirm. Then unplug and replug your drive.

Preparing a Windows boot USB dongle

For creating a bootable USB dongle you can either use Bootcamp or follow the instructions Microsoft is giving.

After you are finished with this, you need to download the WAIK, the Windows Automated Installation Kit - a task that can be neatly automated with this tool.

The WAIK tools are only a few MiB in size, so you can copy them also to the root folder of your prepared USB dongle. Please assure that the files amd64\bcdboot.exe and amd64\imagex.exe exist on the drive then. They will handle our installation.

Please also be sure that the Sources directory of the USB dongle contains the file Install.wim. Microsoft's method puts an extracted version there. If [drive]:\Sources\Install.wim does not exist, copy it there from a Windows 8.1 DVD or ISO image.

Installing rEFInd

rEFInd is UEFI boot manager with quite a few more options than Apple's integrated boot manager. It is also made by the same awesome guy who already brought you gdisk. To install rEFInd, follow the instructions here.

Installing Windows from the Command Line

After having installed rEFInd, reboot your machine with the target external USB drive unplugged. On rEFInd's prompt, select EFI boot from the USB dongle. Windows 8.1 will start the EFI setup.

But today we're not going to use the graphical interface! Press Shift-F10 to open a command prompt and launch diskpart.exe.

  1. Plug your external drive back in and give Windows a few seconds to detect it.
  2. Type list disk to get a list of the disks Windows recognized. Note the number of your external drive.
  3. Type select disk [number] where [number] is the disk number discovered in the previous step.
  4. If you have created your drive's partitions with Disk Util, there will already be an EFI boot partition. You need to find it's number by issueing list partition.
  5. Type select partition [number of EFI boot partition].
  6. Type assign letter=S, this will assign the drive letter S: to the EFI boot partition
  7. Create a Microsoft Reserved partition of 128MiB size by create partition MSR size=128. This is absolutely required because Microsoft says so!
  8. Finally create the partition that will hold your Windows installation by issueing create partition primary size=[what size you'd like], format it by format quick fs=ntfs label=System and give it the drive letter U: by assign letter=U.

Now you need Windows to copy itself on your shiny new NTFS partition U:. The following steps assume you have copied the WAIK tools verbatim to your USB dongle so bcdboot.exe and imagex.exe reside in D:\amd64.

  1. run D:\amd64\imagex.exe /Apply D:\Sources\Install.wim 1 U: /norpfix - this will install Windows 8.1. Also, it's going to take a bit.
  2. run D:\bcdboot.exe U:\Windows /s S: /f UEFI /v - this will install UEFI boot code to the EFI boot partition where rEFInd as well as Apple's boot loader can find it.
  3. reboot.

Finally!

You can now enjoy your freshly prepared Windows 8.1 installation on an external drive. The first boot is going to take a while as Windows needs to figure out your hardware config. Apart from that, this approach has been working quite nicely for me.

Big thanks to Matti who provided me with the original instructions to install Windows via imagex.exe. His instructions can be found at the 3DCenter Forum, albeit only in German.

If you have any comments or suggestions, contact me on Twitter.