Windows Bootable USB - Linux


Any Ubuntu version

even other Linux distros as long as GParted and GRUB are installed.

Install GParted and GRUB on Ubuntu with:

sudo apt-get install gparted grub-pc-bin p7zip-full ntfs-3g

For BIOS: MBR partition scheme

  • Rewrite the partition table as msdos and format your USB drive as NTFS using GParted (and then “Manage flags” and add the boot flag).
  • In GParted, right click the USB partition and select Information. Copy the UUID somewhere as you will need it.
  • Copy all files from mounted Windows ISO or DVD to USB drive using your favorite file manager.
  • Go to USB drive and if the folder named boot has uppercase characters, make them all lowercase by renaming it.

Install GRUB on USB:

sudo grub-install --target=i386-pc --boot-directory="/<USB_mount_folder>/boot" /dev/sdX

Create a GRUB config file in the USB drive folder boot/grub with the name grub.cfg.

Write this into the file:

echo "If you see this, you have successfully booted from USB :) <or whatever you want>"
insmod ntfs
insmod search_fs_uuid  
search --no-floppy --fs-uuid <UUID_from_step_2> --set root 
ntldr /bootmgr
boot

Unmount the USB drive and restart your PC. Choose the USB as the first boot device in BIOS and start booting from it.

For UEFI: GPT partition scheme *

  • Older Windows versions / editions may not be properly supported or not supported at all. I suggest reading the Microsoft UEFI Firmware page.
  • Using GParted rewrite the partition table of the USB drive as GPT.
  • Create a new primary partition and format it as FAT32.
  • Copy all Windows files (from mounted ISO or DVD) to the USB drive.
  • Look on USB in the efi/boot folder. If there’s a file bootx64.efi (bootia32.efi) then you’re done. The USB is bootable. Skip to step 7.
  • Otherwise, open sources/install.wim with the Archive Manager (you must have 7z installed) and browse to ./1/Windows/Boot/EFI. From here extract bootmgfw.efi somewhere, rename it to bootx64.efi (or bootia32.efi for supported 32 bits OS [?]) and put it on USB in efi/boot folder.
  • If you’re making a Windows 7 USB, copy the boot folder from efi/microsoft to efi folder.
  • Don’t forget to unmount (safely remove) the USB drive. Select the proper EFI loader from your BIOS.
  • /dev/sdX is the device (e.g. /dev/sdb, not /dev/sdb1).

Source: My blog post about this can be found at Make a bootable Windows USB from Linux.

Note

When properly used with a compatible target operating system, both of these methods should get you a bootable USB drive. However this does not guarantee successful installation of the target operating system.