Mar 242012
 
windows7

This week a friend of mine had a problem with his laptop, Windows 7 was caught in a boot loop. I wasn't able to fix the bootloop so I decided I was going to format her PC and reinstall Windows on it. She hadn't got a Windows 7 disk with her, so I had to download an ISO. The problem is I only had my netbook with me that, of course, doesn't have a DVD-drive and only has Ubuntu installed. So I needed to create a bootable Windows 7 USB stick from my Ubuntu machine.

Getting Windows 7

She already had an official W7 key but no disk, you can find Windows 7 ISO's through torrent sites, but you never know if they bundle it with "complimentary" software (spyware). So I started looking around for an official download site. Lots of companies apparently let you download the ISO's freely. Remember you can always test Windows legally for while (trial) after that you need to purchase a key. I already had that so I just downloaded the ISO. You can find the ISO's here (the links point to an official MS partner's download links):

Windows 7 x86 English

Mirror 1: http://msft-dnl.digitalrivercontent.net/msvista/pub/X15-65732/X15-65732.iso
Mirror 2: http://msft-dnl.digitalrivercontent.net/msvista/pub/X15-65804/X15-65804.iso

Windows 7 x64 English

Mirror 1: http://msft-dnl.digitalrivercontent.net/msvista/pub/X15-65733/X15-65733.iso
Mirror 2: http://msft-dnl.digitalrivercontent.net/msvista/pub/X15-65805/X15-65805.iso

The ISO's come with every possible Windows 7 installation (home premium,professional,ultimate,...), it just depends on the key you have which features will get unlocked. Choose your appropriate version (32 bit = x86) and download it.

Extracting the ISO to USB

The first things we need to do is download a few packages:

apt-get install ntfs-3g gparted

We need ntfs-3g to be able to make an ntfs USB stick. I also downloaded gparted, because it is a great tool to check these things with. Plug in your USB stick (minimun 4 GB) and open gparted from the menu (or just open a terminal and type "gparted"). Now select your USB drive from the gparted menu and remember your USB name the name /dev/sdX (x can be a different letter):

Then select all the space, right click, select format and then click ntfs. After it finishes we mount our Windows 7 ISO:

mkdir w7
mount yourwindows7.iso w7

It will be mounted as read only, but that's not a problem. Your USB drive should be mounted in /media by default. Copy all the files from w7 to your pendrive (note that you need to close gparted before you can access your USB drive again):

cp -r w7/* /media/someverylonghash/

Now go grab yourself a coffee and a biscuit.

ms-sys

After the download this finishes we need to look for ms-sys, download the tool from scourgeforge. After you downloaded the package untar it:

tar xvf ms-sys-2.2.0.tar.gz #or whatever the latest version may be
cd ms-sys
make
make install

if you get an error, you might be missing either of these three packages, so just run this command:

apt-get install gettext make gcc

After this rerun make and make install and you should have these tools available now. Now we use ms-sys to write a Windows 7 master boot record to our USB drive:

ms-sys -7 /dev/sdX

Replace the X with your usb drive letter you had to remember from gparted.

Final word

Congratulations, you have a bootable Windows 7 usb drive. Just plug it in your computer, select boot from usb and install your Windows 7.

If people of MS or digitalrivercontent come along here and want me to take down the links, please send me an email and I will kindly take them down for you. See the about page for contact details.

  10 Responses to “Create a Windows 7 bootable USB from Ubuntu Linux”

  1. Awesome case study (with the friend) ;) - this has saved me a great deal! Thanks!

  2. YEAH! AWESOME!!!
    But why for Pete's SAKE
    WHY did you ever put the word "LIVE" in your title!??????!!!
    do u know how much time u've stolen from people actually searching for a WIN7 LIVE CD ?..
    reading this simply to find it's just some chick showing off..with smth u can easily find on Ubuntu forums..
    which i'm not anywhere around BECAUSE I'M SEARCHIN' FOR A VERY SPECIFIC COMBINATION OF WORDS FORMING A VERY SPECIFIC PHRASE WITH EVEN MORE SPECIFIC MEANING!
    NOW ( )
    {
    LOOK @ YOUR TITLE;
    READ;
    APPREHEND;
    &GUESS WHAT IT IS!;
    IF (U == FAIL)
    aHINT << "U're not providing it!";
    ELSE
    turn2google!;
    }

  3. OK, now you're talking! THANK U!!!..for the effort.
    Now no one's Matchstick Eyes will end up here Misdirected.

  4. I did this exactly as stated, had a few permission errors here and there, got a message to the effect the flash drive was sucessfully made bootable, but when I try booting it, nothing happens, just a black screen with white flashing cursor. Any ideas?

  5. For a more "CLI" (Command Line Interface) solution, try my (older) tutorial here:

    http://thepanz.netsons.org/post/bootable-windows7-usb-key-with-linux

    thePanz

  6. Instead of gparted (gui tool) you can also used fdisk on linux from command like:

    sudo fdisk -l

  7. Thank you! This is the only guide that actually worked! I spent literally half a day trying to get my Windows installation working, but it always failed, with every guide. I'm bookmarking this for future reference!

 Leave a Reply

(required)

(required)


4 × five =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>