François' Blog

Windows 10, Bootable USB on Linux

2017-01-07

There are so many misleading, confusing and extremely complicated instructions on how to create a bootable Windows USB stick on Linux that is not funny anymore. This is mostly a "note to self" on how to do this.

Microsoft conveniently provides official Windows ISO files that you can use to perform fresh installations of Windows on PCs of relatives that you need to clean up. You don't even need to provide a "COA" key to download them, at least not for Windows >= 8.

So, once you have the ISO and a USB stick (or external hard disk) of at least 4GB it is very easy, if the machine supports (U)EFI which all machines do that I got my hands on, even an old Samsung machine from 2009 supports it.

We assume the USB device is /dev/sdb, please make sure this is correct for you.

Empty the first MB of the USB device to clean any crap that may be there:

$ sudo dd if=/dev/zero of=/dev/sdb count=1024 bs=1024
[sudo] password for fkooman: 
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.174261 s, 6.0 MB/s

Create a new partition using fdisk, it is important to create a partition of type 0x0c and mark it as bootable:

$ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.28.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x4ddb579b.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-30998527, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-30998527, default 30998527): 

Created a new partition 1 of type 'Linux' and of size 14.8 GiB.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): 0c 
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): p
Disk /dev/sdb: 14.8 GiB, 15871246336 bytes, 30998528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ddb579b

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1  *     2048 30998527 30996480 14.8G  c W95 FAT32 (LBA)

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Now, create a FAT32 file system on the USB device:

$ sudo mkdosfs -F32 /dev/sdb1
mkfs.fat 4.0 (2016-05-06)

Create some mount points:

$ sudo mkdir /mnt/usb
$ sudo mkdir /mnt/iso

Mount the USB device:

$ sudo mount /dev/sdb1 /mnt/usb

Next we mount the ISO to access the files on it:

$ sudo mount -o loop Win10_1607_English_x64.iso /mnt/iso

Now, we copy the files from the ISO to the USB stick:

$ sudo cp -r /mnt/iso/* /mnt/usb/ && sync

The sync is to make sure all data is written to the USB stick.

Unmount the ISO and USB stick:

$ sudo umount /mnt/iso
$ sudo umount /mnt/usb

That's all!

Return to Index