Howto create a Windows 10 or 7 bootable USB flash drive using Linux (Ubuntu 16.04 xenial or 16.10 yakkety)

UEFI compatible

1. Make variables so you can copy and paste the following code. Replace the following with your actual name, path, and device id.

export USBMNT=/media/$USER/$USBNAME
export USBDEV=/dev/sdd

2. Format and partition USB drive. (Only needed if your SD card is not VFAT (FAT32) already)

sudo fdisk $USBDEV

n –> enter –> enter

t –> b




3. Sync disk

sync && sudo partprobe

4. Make vfat filesystem and label.

sudo mkfs.vfat -n $USBNAME $USBDEV"1"

5. Click the device in Files (Nautilus) to mount the newly formatted USB flash

6. Double click the windows ISO file to mount it. Or open in  “Disk Image Mounter”.

7. Copy all contents to the root of the USB flash media. (Files –> Other locations)

8. After the copy process is finished, look in the USB root folder for the boot directory. If it is uppercase, rename it to lowercase.

9. Install Grub2 to the USB media.

sudo grub-install --target=i386-pc --boot-directory="$USBMNT/boot" $USBDEV

I got this error and had to follow this guide:…

parted $USBDEV
mkpart primary ext4 0MiB 1MiB
#Then, zero the newly created partition

dd if=/dev/zero of=$USBDEV"2"
#Then, delete the partition

parted $USBDEV
rm 2

10. Create the boot menu.

cat >>EOF <$USBMNT/boot/grub/grub.cfg

menuentry "Start Windows Installation" {
insmod ntfs
insmod search_label
search --no-floppy --set=root --label $USBNAME --hint hd0,msdos1
ntldr /bootmgr }

menuentry "Boot from the first hard drive" {
insmod ntfs
insmod chain
insmod part_msdos
insmod part_gpt
set root=(hd1)
chainloader +1 boot }



11. Test it (If you see the grub2 boot menu, that’s good. Don’t worry about not being able to run the windows installer in QEMU):

qemu-system-x86_64 -hda $USBDEV

12. Unmount your USB media.

Howto fix windows boot order after installing other OS:…

Original howto from:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.