Skip to content

Instantly share code, notes, and snippets.

@kuznero
Last active August 23, 2021 13:20
Show Gist options
  • Star 46 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
  • Save kuznero/9eb62f6f0612a32d9c4446a4f1f4cf74 to your computer and use it in GitHub Desktop.
Save kuznero/9eb62f6f0612a32d9c4446a4f1f4cf74 to your computer and use it in GitHub Desktop.
How to make Windows 7 USB flash install media from Linux?

How to make Windows 7 USB flash install media from Linux?

StackOverflow

  • Install ms-sys - if it is not in your repositories, get it here. Or alternatively, make sure lilo is installed (but do not run the liloconfig step on your local box if e.g. Grub is installed there!)
  • Check what device your USB media is assigned - here we will assume it is /dev/sdb. Delete all partitions, create a new one taking up all the space, set type to NTFS (7), and remember to set it bootable:
# cfdisk /dev/sdb
or fdisk /dev/sdb (partition type 7, and bootable flag)
  • Create an NTFS filesystem (if this step produces error, you may need to reboot):
# mkfs.ntfs -f /dev/sdb1
  • Write Windows 7 MBR on the USB stick (also works for windows 8), multiple options here:
# ms-sys -7 /dev/sdb
or (e.g. on newer Ubuntu installs) sudo lilo -M  /dev/sdb mbr (info)
or (if syslinux is installed) sudo dd if=/usr/lib/syslinux/bios/mbr.bin of=/dev/sdb
  • Mount ISO and USB media:
# mount -o loop win7.iso /mnt/iso
# mount /dev/sdb1 /mnt/usb
  • Copy over all files:
# cp -r /mnt/iso/* /mnt/usb/
or use the standard GUI file-browser of your system
  • Call sync to make sure all files are written.

...and you're done.

  • After all that, you probably want to back up your USB media for further installations and get rid of the ISO file... Just use dd:
# dd if=/dev/sdb of=/win7.img

and reverse if/of next time you want to put the Windows 7 installer onto USB.

As always, double check the device names very carefully when working with dd.

@jscoba
Copy link

jscoba commented Nov 28, 2018

Thank you for this guide!

@0pLuS0
Copy link

0pLuS0 commented Jan 31, 2019

Windows 10?

@diegoramirezpy
Copy link

Gracias, me funciono perfecto. Thank you.

Copy link

ghost commented Jun 8, 2019

Windows 10?

same process

@MagnusOxlund
Copy link

mount -o loop win7.iso /mnt/iso returns mount: /mnt/iso: mount point does not exist. If I create the folder /mnt/iso and use mount /dev/sdb1 /mnt/usb, it returns fuse: failed to access mountpoint /mnt/usb: No such file or directory. If I create that folder, I get fuse: mount failed: Device or resource busy.

Copy link

ghost commented Jun 13, 2019

I get that error too sometimes. idk how to actually fix it I just reboot

@MagnusOxlund
Copy link

I couldn't get it to work. I used windows2usb from the AUR instead.

@Cheaterman
Copy link

Yeah, can't boot my USB disk using a Win7 ISO with this method. I'll try woeusb instead.

@asbestomolesto
Copy link

Doesn't work on me. Computer hangs trying to boot, I only got a flashing cursor :(

@JensMy
Copy link

JensMy commented Mar 23, 2020

You need to set boot flag in gparted

@asbestomolesto
Copy link

I did that. Not solved that way.
Time has passed, I solved using a different software (I don't remember how, sorry)

@nr1q
Copy link

nr1q commented Sep 18, 2020

windows2usb worked for me

@pcranaway
Copy link

pretty cool way of copying the ISO contents, thanks for the guide!

@rocket111185
Copy link

mount -o loop win7.iso /mnt/iso returns mount: /mnt/iso: mount point does not exist. If I create the folder /mnt/iso and use mount /dev/sdb1 /mnt/usb, it returns fuse: failed to access mountpoint /mnt/usb: No such file or directory. If I create that folder, I get fuse: mount failed: Device or resource busy.

All the commands are launched with root privileges. Try append to your command sudo.

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