How to make a Windows 7 USB disk using only Unix commands?

7,820

Just to cover the basic questions: What motherboard do you have? Have you changed the boot order in your BIOS?

I recently had to do this for a netbook laptop. The method I followed was probably very similar to what you've tried, but I'll give it anyway:

  1. Make sure the USB stick is wiped before going any further

    dd if=/dev/zero of=/dev/<usb_stick>
    
  2. Create a new partition table on your USB stick, and create a partition (using fdisk, parted, or gparted). Mark the partition as "Bootable" or "Active". Format the USB stick as FAT32.

  3. Mount the new partition.

  4. Copy the DVD/ISO contents to the mounted partition:

    dd if=/home/trent/iso/win7.iso of=/mnt/usb1
    
  5. Reboot and make sure your boot order/priority has USB devices first.

Unfortunately it seems there are different methods that work for different people, and not just one universal solution. I've seen other instructions where it was said to dd the ISO contents to the device (/dev/sdc) instead of a mounted FAT32 partition, but this never worked for me.

The only other method that worked for me was doing it in Windows using the DISK PART command. I will try some other methods on Linux to see if I can come up with alternatives for you.

Share:
7,820

Related videos on Youtube

Derrick
Author by

Derrick

Updated on September 17, 2022

Comments

  • Derrick
    Derrick over 1 year

    I think I can use newfs_msdos to format it. and dd to copy the contents of the iso to the usb. I can't get it to boot. I've tried to do it before but it didn't work. Has anyone successfully done this?

    • erik
      erik over 8 years
      You will find the best solutions reading these answers at askubuntu. And some more nerdy ones (using command line) here at serverfault.
  • quack quixote
    quack quixote almost 14 years
    don't format and use dd; those are mutually exclusive, so pick one. formatting lays down a FAT32 filesystem, which is then overwritten by an ISO9660/UDF filesystem when you dd the ISO. instead, do dd, or format to FAT32 and copy (cp, not dd) the ISO contents to the stick. (mount the ISO as a loopback filesystem if needed to access the ISO contents.)
  • gamal
    gamal almost 14 years
    I never realised `dd' formatted the FS, I just assumed it was a copy. Thanks for the clarification.