Home

About

« Back to System

Make a bootable Windows 7 installation USB stick with Linux

You will need: 1) an ISO file with your copy of Windows 7 (all legal, needless to say, huh?), 2) a USB stick at least as large as the ISO file and 3) the Gparted program ("gparted" package in Ubuntu/Debian) and 4) support for NTFS ("ntfs-3g" package in Ubuntu/Debian).

Plug your USB stick, open Gparted, and select the USB stick in the devices menu. Take note of its identifier, for example /dev/sdb1. Unmount it, erase all the partitions, and create a single, primary, NTFS partition. Then use the Manage flags menu to enable the "boot" flag.

Then open a terminal and start an administrator session:

sudo su

Set up the NTFS filesystem:

mkfs.ntfs --quick /dev/sdXY

(replace sdXY with the identifiers you've determined above).

Then create a mount point and mount the USB stick:

mkdir /mnt/ufd && mount -t ntfs /dev/sdXY /mnt/ufd

Now mount your ISO image:

mkdir /mnt/windowsdvd && mount -r -o loop path/to/your/Windows.iso /mnt/windowsdvd

Copy the contents over:

tar -C /mnt/windowsdvd -c -f - . | tar -C /mnt/ufd -x -v -f -

Once finished (it might take a while), unmount the USB stick:

umount /mnt/ufd

Unplug the USB stick, then plug it back in and mount it again:

mount -t ntfs /dev/sdXY /mnt/ufd

Now let's make sure everything was copied over just fine:

tar -C /mnt/dvd -c -f - . | tar -C /mnt/ufd -d -f - | egrep -v '(Mode|Uid|Gid) differs'

If the output is empty, everything looks good. Otherwise, you probably need to start over.

Everything is ready, unmount everything:

umount /mnt/ufd && umount /mnt/windowsdvd

Unplug your USB stick. It's now ready to be used to boot a computer and install Windows on it.