How to trick Windows 10 to install on an USB drive

Suppose you want a Windows installation for your computer, but a bit more portable. You might think to use an external USB but the truth is Microsoft doesn't want you doing this and prevents it in the Windows installer.

Fortunately there's an easy workaround.

Note: Rufus also supports this mode of installation called "Windows To Go", but this was a bit too magic for me and I really just wanted a normal installation.

Before we begin you will need:

  • a Linux system and QEMU

  • the Windows ISO

  • an USB drive or portable SSD/HDD you will be installing to

  • the OVMF_CODE.fd file from EDK2 for UEFI booting

The workaround

First plug the USB drive into the system and find out the name using lsblk:

sdX      8:32   0 465,8G  0 disk

Since we want QEMU to write directly to the disk we need to allow our user to access it. The quickest way to do that is with chmod a+rw /dev/sdX.

Next, we'll start the VM:

qemu-system-x86_64 -enable-kvm -no-reboot \
        -M q35 -m 4096 -smp 4 -bios ./OVMF_CODE.fd \
        -drive file=/dev/sdX,format=raw -usb -device usb-tablet \
        -cdrom Windows*.ISO

Go through the installation process normally and wait until Windows wants to restart. At this point the VM will simply exit, which is intended.

Now you simply have to reboot your computer, select the USB upon boot and let the installation complete normally.

Setting up

One more important point is that you will need to apply a registry tweak to correctly receive feature updates.

This is described here [1] but for convenience here are the steps:

  • Open regedit

  • Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control

  • Change the value of PortableOperatingSystem to 0