If you download a Windows 10 installer ISO then it's not immediately obvious how to correctly write it to a USB disk.

Microsoft don't make this easy. Frustratingly, the naïve approach of writing the ISO straight to the USB disk will yield something that does; boot, but that can't actually perform a successful installation! And, to make things even harder, there isn't even a proper error message the results in trying to use it. The best you get is being dumped straight into a prompt "A media driver your computer needs is missing..."

So, how to correctly use the downloaded Windows 10 ISO to prepare a bootable USB disk? If you have a Windows machine handy, you use Microsoft's Media Creation Tool. But if you only have Linux, you can't run that tool. And in any case, it's interesting to learn what it does behind the scenes, right?

So, here's how to prepare a Windows 10 installer USB disk from Linux; no Windows required!

If you want to boot with UEFI:

  1. Create a GPT partition table on the USB disk
  2. Create a partition on the USB disk, and create a FAT32 filesystem upon it
  3. Copy the contents of the ISO filesystem, except for the sources/install.wim file to the FAT32 filesystem: rsync -cai /mnt/CCCOMA_X64FRE_EN-GB_DV9/ /mnt/usb/ --exclude=sources/install.wim

  4. Split the install.wim file into several 'split image' files, each one small enough to be copied to the FAT32 filesystem: wimlib-imagex split /mnt/CCCOMA_X64FRE_EN-GB_DV9/sources/install.wim /mnt/usb/sources/install.swm 4096

If you want to boot with a traditional BIOS:

  1. Create a traditional/legacy/PC/BIOS/MBR partition table, not a GPT partition table
  2. Make sure that the partition you create:
    1. is a primary partition

    2. has the 'active' flag set
  3. Create the FAT32 filesystem and copy the files in the same way as described for UEFI
  4. Use mbr, ms-sys or TestDisk to install bootloader code into the master boot record on the USB disk (this code looks for the first primary partition with the 'active' flag set and loads the volume boot record from the partition)

  5. Use ms-sys to install code into the volume boot record on the partition; the -e option selects the program that is able to load the Windows installer from a FAT32 filesystem (i.e., load & execute the bootmgr program)

Now you can boot off the USB stick and install Windows 10.

Not really all that difficult--just completely undocumented.


robots.org.uk: CreatingWindows10InstallerUSBFromLinux (last edited 2022-10-31 11:30:15 by sam)

© Sam Morris <sam@robots.org.uk>.
Content may be distributed and modified providing this notice is preserved.