Install Windows 7 from USB Pen Drive Using Grub2 and Grub4Dos

Monday, July 19, 2010

I wanted to install Windows 7 on my netbook, but I didn’t have access to a Windows environment from which I could run bootsect.exe or install Grub4Dos; so I figured I’d install Grub2 on my USB disk using Ubuntu, have Grub2 chainload Grub4Dos, and finally let Grub4Dos chainload the Windows installer. This worked for me:

  1. Prepare a fresh NTFS partition on the USB disk /dev/sdX and mount it at /mntX1, then copy all files from the Windows installer disc or image into /mntX1
  2. Install Grub2:
    cd /mntX1; sudo grub-install --no-floppy --root-directory=/mntX1 /dev/sdX; sync
  3. Download the latest Grub4Dos, and unpack grub.exe into /mntX1
  4. Create /mntX1/boot/grub/grub.cfg:
    set timeout=0
    set default=0
    menuentry “Install Windows” {
         linux16 /grub.exe --config-file=”root (hd0,0); chainloader (hd0,0)/bootmgr”
    }

I was surprised that such a complicated setup actually worked. Be sure to substitute your own values for /mntX1 and /dev/sdX. In the Grub4Dos config, (hd0,0) refers to the first partition on the boot disk; you’d need to change that if you want to boot the installer from a different partition.

5 Comments

  1. David Cheng says:

    I actually had to do the same thing a few weeks ago, but I just used this:

    http://www.intowindows.com/how-to-create-bootable-windows-7-vista-or-xp-usb-flashpen-drive-with-a-single-click-must-try/

    which I found to be very simple.

  2. Moptop650 says:

    You know if you just copy the contents of a windows vista/7 install disk to a thumbdrive, it works…

    I’ve done that on windows using xcopy, no reason it shouldn’t work on linux. Fat32 format, too.

  3. Jiang says:

    You know, that only works if you have the nt60 bootloader (or nt54 for WinXP) on that drive. Without a working bootloader, the BIOS would not know how to boot. Installing GRUB is the same idea.

  4. Mathieu says:

    Nice tip.

    (@David: on topic not so much, he?)

  5. chris says:

    i’m about to give this a try, hopefully it will work, …thanks for the write up.