Skip to content

Instantly share code, notes, and snippets.

@manpages
Created December 12, 2014 14:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save manpages/741ccc52c589c7e665ed to your computer and use it in GitHub Desktop.
Save manpages/741ccc52c589c7e665ed to your computer and use it in GitHub Desktop.
How to make bootable Windows USB from Linux
Install ms-sys
You will need ms-sys to write a Master Boot Record (MBR) to the USB drive.
Make sure you have installed the gcc, make, and gettext repository packages in order to compile the source code.
Download the latest source code from http://ms-sys.sourceforge.net/#Download.
Un-tar the source code and change into the source code directory:
tar xvzf ms-sys-2.3.0.tar.gz
cd ms-sys-2.3.0
Compile and install the binary:
make
sudo make install
ms-sys will install to /usr/local/bin. Be sure to add this path if it is not in the root user’s environment PATH:
su -
export PATH=$PATH:/usr/local/bin
Write Windows 7 Master Boot Record (MBR) to the USB Drive
sudo ms-sys -7 /dev/sdX
Mount the USB Drive
sudo mkdir -p /mnt/flash
sudo mount /dev/sdX1 /mnt/flash
Mount the Windows 7 ISO
sudo mkdir -p /mnt/iso
sudo mount -o loop /tmp/en_windows_7_professional_x64_dvd_X15-65805.iso /mnt/iso
Copy the Contents of the Windows 7 ISO to the USB Drive
sudo cp -av /mnt/iso/* /mnt/flash/
Unmount the USB Drive
I encountered several instances where the cp command finished before all I/O was written to the USB drive. Because of this, the umount command below will stall until all I/O is finished. I/O can be watched in real time by installing iotop.
sudo umount /mnt/flash
Boot from the USB Drive
Plugin the USB drive to the computer you want to install Windows 7 on and boot to USB-HDD or USB-ZIP. Depending on the type of motherboard/computer, there may be instances where you have to boot to USB-FDD or USB-CDROM instead. For example, on a Gigabyte GA-MA74GM-S2 motherboard, booting to USB-HDD did not work, I had to boot to USB-ZIP. However, on a Lenovo ThinkPad X220 I had to boot to USB-HDD.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment