Create a Bootable USB with Windows Installer

From Exterior Memory
Revision as of 01:42, 7 November 2021 by MacFreek (Talk | contribs) (Burning the ISO file to USB stick)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Hints for the process of installing Windows from scratch on self-build hardware

Installation order
If you want both Windows and Linux, start by installing Windows first, then Linux. The other way around is possible, but requires a lot more manual fiddling because the Windows installer does not have a dual-boot option.
Download
Windows can be downloaded from https://www.microsoft.com/software-download/windows10. You do not to buy a media (although it is easy), but you do need a licence code.

Download a Windows 10 or Windows 11 ISO file

Windows 10 and Windows 11 installers can be downloaded from https://www.microsoft.com/software-download/. You can either download the ISO file directly, or with a helper program, called MediaCreationTool.

You may find that your browser redirects you to the other page depending on the operating system of your current system. It's annoying.

If you use MediaCreationTool, be sure to select "Create installation media for another PC", than "ISO file". It is possible to directly burn to a USB disk from MediaCreationTool, but in my experience it did not always work. Instead, I recommend to download the ISO file, and then use Rufus to create the USB stick from the ISO file.

Burning the ISO file to USB stick

If you use a modern PC with UEFI bootloader, you must use GPT (GUID Partitioning Map) as partitioning scheme for your USB disk. Windows either supports a BIOS bootloader and MBR (master boot record), or UEFI bootloader and GPT. Any other combination will fail, although perhaps UEFI with CSM (Compatibility Support Module) enabled (basically reverting back to BIOS compatibility) might work too.

There are some suggestions to use a USB2 stick and a USB2 port, but I had no issues with a USB3 stick in a USB3 port.

I strongly recommend the program Rufus on Windows to create a proper USB stick from an ISO. The steps are straightforward when you download Rufus.

Rufus will output a GPT disk with FAT32 file system. It is able to do so, because the ISO downloaded by the MediaCreationTool contains many small files, unlike the ISO downloaded directly, which contains one large file that does not fit in the 4 GByte file limit of FAT32.

Create Windows bootable USB on MacOS

Stop. Really. Borrow a friends Windows PC instead. Technically, it might be possible to create a bootable USB stick with Windows, but I did not succeed.

Either I was able to create a GPT partition with exFAT file system, which was not bootable. Or I was able to create a Universal Disk Format (UDF) disk, which was bootable, but gave an error "A media driver your computer needs is missing." later in the installation process.

For reference, here are the two methods:

GPT partition with exFAT

Your first step is to erase your USB stick and create a GPT partition map and exFAT file system. The easiest way is to use the "Disk Utility" program in /Application/Utilities/. Select the disk, right-click, and select "Erase..." from the menu.

Next you should mount the downloaded ISO file, and copy all files. You can do this in the Finder if you wish.

You can also do these steps in the terminal. Make sure to replace disk8 with the label of your USB disk.

Find the label name of your USB disk. E.g. `/dev/disk8`.

diskutil list

Proceed to erase and format this disk with a GPT (GUID Partitioning Map) and FAT32 file system. To erase `disk8`:

diskutil eraseDisk exFAT "WINDOWS10" GPT disk8

Mount the ISO file:

hdiutil mount ~/Downloads/Win10_21H1_English_x64.iso

Copy all files:

rsync -vha /Volumes/CCCOMA_X64FRE_EN-US_DV9/* /Volumes/WINDOWS10

GPT partition with FAT32

It is not possible to store files larger than 4 GByte on a FAT32 file system, and the Windows installer has a 5.4 GByte file called `install.wim`

At https://www.freecodecamp.org/news/how-make-a-windows-10-usb-using-your-mac-build-a-bootable-iso-from-your-macs-terminal/ are instructions to still create Windows 10 installer on a USB stick with GPT partition and FAT32 file system. They achieve this by using the wimlib -imagex tool from the wimlib library to split the file in two parts.

Copy all files, except install.wim:

rsync -vha --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/* /Volumes/WIN10

Split and copy the install.wim file(s):

wimlib-imagex split /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim /Volumes/WIN10/sources/install.swm 3800

I have not tested this method.

UDF file system

Copy al data from the downloaded ISO image to the USB disk `disk8`:

dd if=Downloads/Win10_21H1_EnglishInternational_x64.iso of=/dev/disk8 bs=1m

Since the ISO disk is a file system in Universal Disk Format (UDF) format, the USB stick will also have the UDF boot record and file system.

While this leads to a bootable USB stick, later in the proces, it gives an error: "A media driver your computer needs is missing."

Error: "A media driver your computer needs is missing."

The following error may be shown after booting from the USB stick, right after the language selection and "Install Now" screen:

   A media driver your computer needs is missing. This could be a DVD, USB or Hard disk driver.

In reality, this is unlikely the problem. The most likely cause is one of Windows restrictions. I strongly suggest to ensure that your boot USB disk is formatted with GPT partition table and exFAT file system. In my experience, anything else leads to problems.

Some reports suggest to use a USB 2 instead of USB 3 stick. For me, it worked with USB 3 stick just fine. Just not with other file systems. In those case, I was able to boot from USB stick. Just that I got the above error later in the process.