-
-
Save dcrystalj/62edb6d27168fef986a817538723ca42 to your computer and use it in GitHub Desktop.
How to make bootable Windows USB from Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
#might take 30mins | |
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