How to Create A Bootable Windows 7 Installation USB from Linux

Thanks to Gunthers at serverfault, I was able to create a USB and start the Startup Repair tool from there to repair my Windows 7 boot.

Probably the only thing you need to know is how to make the USB bootable as I assume you know that you need an NTFS partition on the USB including the installation files (copied over from a DVD or a backup ISO file).

Well, after all that pretty regular stuff, you need to grab ms-sys from here and install it to be able to write Microsoft compatible boot records. (It could also exist in your repositories, so do a check first if you want with your favorite package management tool. (e.g. apt-get, aptitude, yum etc.)

To write a Windows 7 MBR onto the USB device; just do a

# ms-sys -7 /dev/sdb

Assuming /dev/sdb is your usb stick. You can check if it is so by running the mount command without any parameters. The parameter –7 denotes a Windows 7 MBR.

Just to be complete, I will rewrite the commands here, maybe with a little more explanation.


1. Use cfdisk to remove all partitions on the USB stick, and create an NTFS one. Don’t forget to set it as bootable.

You could as well use fdisk or whatever partition editor you like.

# cfdisk /dev/sdb

When creating the partition, the numerical partition type is 7, as it stands for HPFS/NTFS.

2. To create an NTFS filesystem on the partition:

# mkfs.ntfs -f /dev/sdb1

3. If you have an ISO file of Windows 7, you can mount the ISO as a loopback device using this command:

# mount -o loop win7.iso /mnt/iso

And then, mount the USB device somewhere, such as /mnt/usb.

4. # mount /dev/sdb1 /mnt/usb

You will need to

# mkdir /mnt/usb

if the folder does not exist.

5. And then you can just copy over the files from there.

# cp -r /mnt/iso/* /mnt/usb/

Alternatively, you can skip 3 and 5, and just open up the ISO using an archive manager and extract the files to /mnt/usb. (or copy the files from a DVD)

6. As the last step, you will of course need to make the USB bootable by writing a Windows 7 MBR (Master Boot Record) on it.

# ms-sys -7 /dev/sdb

Note that it is not the partition (ie. /dev/sdb1), it is the usb device itself (ie. /dev/sdb).




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: