DALL·E generated image using the request: creating Windows 10 Usb on Linux using the official iso
DALL·E: creating Windows 10 Usb on Linux using the official iso

Creating a Windows 10 USB installer on Linux is a straightforward process, but it does require a few steps to complete. In this blog post, we’ll go over the steps needed to create a Windows 10 USB installer on Linux using the official Windows 10 ISO.

Before we begin, you’ll need the following:

  • A USB drive with at least 4 GB of free space
  • A Windows 10 ISO file (you can download this from the Microsoft website)
  • A Linux machine with dd command installed

Once you have everything ready, let’s start the process.

Step 1: Insert your USB drive Link to heading

Insert the USB drive that you will use to create the Windows 10 installer into your Linux machine.

Step 2: Determine the USB drive’s device name Link to heading

To determine the device name of your USB drive, open a terminal and run the command: lsblk. This command will list all the storage devices currently connected to your machine. Look for the device that corresponds to your USB drive and make note of its device name (it will typically be something like /dev/sdb).

Step 3: Format the USB drive Link to heading

Before we can format the USB drive, we need to unmount it. In the terminal, run the command: umount /dev/<device_name> (replace <device_name> with the device name of your USB drive as determined in step 2).

Then format the USB drive with FAT32. In the terminal, run the command: mkfs.fat32 /dev/<device_name>.

Step 4: Mount the Windows 10 ISO file and copy the files to an intermediate location Link to heading

The Windows 10 ISO contains files which do not fit on a USB disk (because the fat32 filesystem does not support it). Therefore we need to copy the files on the Windows 10 ISO file into a local folder. We should create an intermediate folder and copy all files there. Run the command:

sudo mount Win10_22H2_EnglishInternational_x64.iso /tmp/win10iso -o loop
mkdir /tmp/win10local
rsync -avz --no-perms --no-owner --no-group  --progress /tmp/win10iso/ /tmp/win10local/

Step 5: Shrink files which are too large Link to heading

Some of the files on the WIndows 10 ISO are too large for a fat32 formatted drive. To find the files which are too large, run the command: find /tmp/win10local -size +4G -printf "%11s %p\n" | sort -n

All files listed from the command above, need to be shrinked. At the time of writing, this includes (only) a single file: install.wim .

We need a specific tool to shrink these .wim files called wimlib or wimtools. In NixOS this can be installed into a nix-shel via the command: nix-shell -p wimlib.

To shink the files, run this command for each file: wimlib-imagex optimize <file> --solid (where the file might be install.wim).

This will recompress the file(s) and replace them. Notice that this might take quite some time!

Step 6: Mount the USB drive and copy the files from the intermediate location Link to heading

Then mount the just formatted USB drive. In the terminal, run the command: sudo mount /dev/<device_name> /tmp/win10usb. The usb disk is then mounted to the folder /tmp/win10usb.

Then copy all the files from the intermediate location to the USB drive. Run the command:

sudo rsync -avz --no-perms --no-owner --no-group  --progress /tmp/win10local/ /tmp/win10usb/

Step 7: Verify the USB drive Link to heading

Once the process is complete, verify that the USB drive now contains the Windows 10 installer files by running the command: ls /dev/<device_name> (replace <device_name> with the device name of your USB drive as determined in step 2).

Step 8: Restart your machine and boot from USB drive Link to heading

Now that you have created a Windows 10 USB installer, you can use it to install Windows on a new or existing machine. Simply restart your machine and set the BIOS or UEFI to boot from the USB drive.

That’s it! You now have a Windows 10 USB installer that you can use to install Windows on a new or existing machine. Keep in mind that the process of installing Windows 10 is different for each machine, so consult the documentation of your machine for more information.