40

I need to create a Windows installation USB drive from an ISO file. I used UNetbootin which seems to be the only tool that can write non-Linux images.

The USB disk boots (sort of), but it gets stuck at the very first stage. A UNetbootin splash screen appears that keeps counting down from 10 to 0, and then restarts.

The screen looks like this:

enter image description here

Is there a way to make Windows boot from a USB image created on Linux?

karel
  • 114,770
  • As far as I know it only works on an NTFS partition, so re-format your thumb drive. This brings another problem, because version 494 of unetbootin is the latest that could write to ntfs partitions, so use that one instead of the current. –  Aug 25 '12 at 21:29

2 Answers2

38

Method 1

Using gparted format the drive FAT16, set the boot flag.

Using Archive Manager extract the iso to the drive.

(or just copy the DVD to the drive).

That's it.

works for me

Method 2

To create your bootable installer disc, select an ISO image or CD/DVD disc, and click Install enter image description here

This will create your Windows Vista/7 installer USB. It is worth mentioning here that the tool might also work with Windows 8; however, it has not been tested. Having said that, the developer has mentioned that the supported images include, “Windows Vista, Seven+.” You can install WinUSB either from the Deb package given at the developer’s website (for Oneiric, Natty, Maverick and Lucid), or from the PPA given below.

sudo add-apt-repository ppa:colingille/freshlight
sudo apt-get update
sudo apt-get install winusb

Since WinUSB also works from the command line, you can create a Windows 7 or Windows Vista USB installer by following the command line format given below

sudo winusb --format <iso path> <device>

Once the USB is formatted using the above method, install a Windows partition and edit the Master Boot Record:

sudo winusb --install <iso path> <partition>
twister_void
  • 5,924
  • 1
    You mean you do not even need to use unetbootin or similar tools? – Salim Fadhley Mar 28 '12 at 23:35
  • That will copy the ISO content to USB, but will it make the USB bootable? – mikewhatever Mar 28 '12 at 23:39
  • 2
    Yes that will make USB bootable only u have to format the drive into FAT16 using gparted tool – twister_void Mar 28 '12 at 23:42
  • 1
    This is usless to me unless it boots? I do not understand how Gaurav_Java's technique could make the disk bootable. Setting the boot flag only marks a partition as bootable but does not tell the computer what to boot. How on earth could this work? – Salim Fadhley Mar 28 '12 at 23:46
  • Guarav_Java, in your previous instructions you said to format to NTFS? Which do you mean - NTFS or FAT16? I'm confused! – Salim Fadhley Mar 28 '12 at 23:47
  • @SalimFadhley i post 2 method if u don't like that then try second one . and before pointing atleaast give a try ya u format drive into FAT16 using gparted it will work . – twister_void Mar 28 '12 at 23:52
  • 3
    @SalimFadhley, remember that method 1 also talks about using the Archive Manager to extract the Win7 ISO on the pendrive, so it does work, but as far as I know, doesn't it should also work with FAT32?

    Thumbs up for the WinUSB method.

    – crackout12 Mar 29 '12 at 00:04
  • @crackout12 :ya it also work with FAT32 – twister_void Mar 29 '12 at 00:16
  • Steps are great except you assume we know how to install a Windows partition and edit the Master Boot Record... – Brock Hensley Jul 03 '13 at 22:04
  • Found original post with clearer instructions: http://shuffleos.com/5053/winusb-bootable-windows-installer-usb-ubuntu-linux/ – Brock Hensley Jul 03 '13 at 22:08
  • @SalimFadhley by configuring the bioses boot order to have usb port at top. – samus Aug 25 '13 at 20:42
  • winusb literally does not work for me and fails in the end every time... – Pavel Jul 05 '16 at 17:27
26

Its a simple process.

For BIOS: MBR partition scheme

  1. Format the USB to FAT32 and mark it with the 'boot' flag. (NTFS works too, but for this tutorial I'm using FAT32 because you can make it UEFI bootable this way.)

  2. Mount the USB somewhere, for example /media/<user>/<disc_label>

  3. Install grub to the USB using:

     grub-install --force --no-floppy --boot-directory=/media/<user>/<disc_label>/boot /dev/sdX
    

(Install to the disk; not partition!)

  1. Extract the contents of the iso onto the root of the USB stick; I personally use 7z for this:

     7z x /path/to/win.iso
    

(Note that the Win7 iso has a boot dir; you will need to 'overlap' the boot dir created with grub with the contents of the iso. )

You should end up with something like this

    ├── autorun.inf
    ├── boot
    │   └── grub
    ├── bootmgr
    ├── efi
    ├── setup.exe
    ├── sources
    ├── support
    └── upgrade
  1. Edit/create boot/grub/grub.cfg so it contains the following menuentry:

     menuentry 'Windows 7 AIO Installer' --class windows --class os {
       set root=(hd0,1)
       insmod part_msdos
       insmod fat
       insmod ntldr
       ntldr /bootmgr
     }
    
  2. When you reach the grub prompt (grub>) type boot and press Enter

  3. Enjoy your bootable stick.

It may be a bit of a runaround, but this lets you add addtional resources as needed via edits to the grub.cfg file. I personally have a Windows 7 All In one (9 editions of win7) installer, Mini Windows XP (from hirens), DOS 6.22, memtest, and gparted live on one usb stick this way.

For UEFI: GPT partition scheme *

  1. Copy efi/microsoft/boot one level upward:

     cp -r efi/microsoft/boot efi/boot/
    

(The path may be all uppercase, lowercase, or a mix, due to the case-insensitive nature of the FAT32 filesystem and differing mount options. Adjust commands to fit your situation.)

  1. Extract 1/Windows/Boot/EFI/bootmgfw.efi from sources/install.wim

     7z e sources/install.wim 1/Windows/Boot/EFI/bootmgfw.efi
    
  2. Place this file as efi/boot/bootx64.efi

     mv bootmgfw.efi efi/boot/bootx64.efi
    
  3. Enjoy your UEFI-bootable windows 7 USB!

For UEFI: GPT partition scheme - chapter 2 **

When I replaced my SSD with a more modern / faster / bigger one I made the old one into a USB drive. To reach the existing grub on that drive I did the following:

  1. make an efi/boot directory (as above)

  2. copy efi/debian/grubx64.efi and efi/debian/grub.cfg to efi/boot/bootx64.efi and efi/boot/grub.cfg.

  3. boot the new usb drive via the computer's boot menu.

I guess that this should be done whenever a new version of grub is installed. (but even the old version worked fine before I updated the system after 2 years)

You might want to disable os probing in /etc/default/grub (GRUB_DISABLE_OS_PROBER=true) - see this page.

Artur Meinild
  • 26,018
hanetzer
  • 441