Skip to content

Instantly share code, notes, and snippets.

@scvnc
Last active August 2, 2016 02:23
Show Gist options
  • Save scvnc/10334163 to your computer and use it in GitHub Desktop.
Save scvnc/10334163 to your computer and use it in GitHub Desktop.
Bootable Windows 7 USB Drive via LINUX

PROBLEM: ALL MY WINDOWS IMAGES ARE ON MY LINUX WORKSTATION AND I NEED TO BOOT WINDOWS OFF A USB DRIVE.

Historically, I've used Windows 7 USB/DVD Download tool on a Windows guest OS in VirtualBox to get this done. Well after doing the research and several stick formats later: I've pieced together a better recipe.

Some other solutions/tutorials have some shortcomings. WinUSB is too complicated and doesn't work with certain versions of GRUB. This post comes very close but assumes the drive has a Windows 7 bootloader already.

Make new partition table

Give the USB device one primary partition. This is what I did, other partitioning schemes may work. I'm using fdisk.

Set partition type to 7 (Windows/NTFS)

Use the t option in fdisk

Flag the partition as bootable

Use the a option in fdisk

Format the partition as NTFS

mkfs.ntfs -f /dev/sdx1

Install the NTFS bootloader

Use ms-sys

ms-sys -7 /dev/sdx

ms-sys seems to provides some alternative options for Vista. I have not tested this recipe with Windows 8.

Copy files from the windows image to the NTFS partition

mount WinIMG.iso /path/to/WinIMG -o loop

cp -avr /path/to/WinIMG/* /path/to/usb

Unmount and boot

Get that USB drive out of there and try to boot!

Other notes

If you don't have a USB drive that's large enough, you can plug in the hard drive you're going to install to and use that instead. It works pretty well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment