English / Deutsch | Print version

Create a bootable Windows VISTA, 7 or Windows 8 install USB drive from ISO or DVD with Linux


It's very easy with Linux to create a bootable USB drive to install Windows 7 or Windows 8.

Requirements:

  • A Windows VISTA, 7 or 8 DVD, or the ISO file (download from Microsoft).
  • A USB drive with at least 4GB space to copy the Windows files on it.
  • A Linux distribution. Maybe Plop Linux ;), others like Ubuntu, Fedora, Debian and so on will also work.


Situation 1 - Partitioning and formatting is not required
Situation 2 - USB drive was not formatted by Windows

Situation 1 - Partitioning and formatting is not required


When you have a USB drive formatted by Windows (FAT32 or NTFS) then simply copy the Windows files that are on the DVD/ISO to the root directory of the USB drive.

To access the files on the ISO you have to mount it as loop device. You can do this with

sudo mkdir /mnt/iso
sudo mount [ISO FILE NAME] /mnt/iso -o loop
Copy the files from /mnt/iso/ to the root directory of the USB drive.


When you want to mount the USB drive from the command line then use

  • for a FAT formatted USB drive
    sudo mkdir /mnt/usb
    sudo mount /dev/sdc1 /mnt/usb
    
    /dev/sdc is in this case the USB drive and 1 is the first partition.

  • for a NTFS formatted USB drive
    sudo mkdir /mnt/usb
    sudo mount /dev/sdc1 /mnt/usb -t ntfs-3g
    
    /dev/sdc is in this case the USB drive and 1 is the first partition.

  • Unmount the USB drive before you unplug it. "umount /dev/sdc1".

    Boot the USB drive to install Windows (when you really need Windows).


    Situation 2 - USB drive was not formatted by Windows


    With this description, you delete all data on the USB drive. You can use tools like Gparted, but I explain it with doing all on the command line. Basically it's only a format to NTFS and copy the Windows install files.


    At first became root when you are not already root.

    You do this with "su" and enter the root password or with "sudo bash" and enter your password.

    In this example the USB drive is /dev/sdc.

    We change the type of the first partition to NTFS with fdisk

    fdisk /dev/sdc
    

    With "p" and enter you list all entries. You will see something similar.

    Disk /dev/sdc: 8011 MB, 8011120640 bytes
    246 heads, 40 sectors/track, 1590 cylinders, total 15646720 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
    Disk identifier: 0x6b11f4f9
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1            2048    15646719     7822336    b  W95 FAT32
    

    Press "t" and enter to change the type.

    Partition 1 is automatically used because its the only partition on the drive.

    Use the hex code "7".

    Press "a" and enter to set the boot flag.

    Select Partition "1".

    When you press again "p" and enter then you should see something like this. Boot * and Id 7

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1   *        2048    15646719     7822336    7  HPFS/NTFS/exFAT
       
    

    Press "w" and enter to write the changes.

    Now format the USB drive with "mkntfs -f /dev/sdc1" or with "mkfs.ntfs -f /dev/sdc1"

    When the following directories in /mnt/ are not existing, then create them with "mkdir [directory]" or mount to a place that you want.

    Mount the USB drive. For example "mount /dev/sdc1 /mnt/usb -t ntfs-3g".

    Mount the DVD or ISO file.

    • DVD: Example "mount /dev/sr0 /mnt/dvd". /dev/sr0 is in this case my SATA DVD drive.
    • ISO: Example "mount win8.iso /mnt/dvd -o loop"

    Copy the files with "cp -avr /mnt/dvd/* /mnt/usb".

    Unmount the USB drive "umount /mnt/usb". This can take a while because of the USB file writing.

    Boot the USB drive to install Windows (when you really need Windows).


    © 2024 by Elmar Hanlhofer
    This page was last modified on 29/Aug/2012.