Creating a bootable USB from a Windows ISO
The reason for needing this could be e.g. reinstalling Windows but it could also be to update your system firmware - because the vendor only provided Windows binaries - you need a Windows system.
To update you system firmware you can use a Windows PE environment like Hiren's BootCD Hirens BootCD
If you want to reinstall Windows after your Manjaro adventure get a Windows ISO from Microsoft
Only the manual approach described below was viable - until af few years ago when the github user slacka forked the WinUSB project. Thanks to his work the Linux community have an app to do abstract the CLI work.
Very receently a new tool has become available - the ventoy project - which makes the task even easier.
Topics covered
- ventoy bootable USB
- WoeUSB
- Manual using CLI
1. ventoy
2020-05-09T10:35:00Z
The ventoy utility is a great tool for booting a Windows ISO without having to jump through the hoops in this guide.
Install the ventoy package from repo
sudo pacman -S ventoy
Locate your USB stick
lsblk
Replace sdy below with your device
sudo ventoy -i /dev/sdy
Using a file manager
Using your file manager and drag your Windows ISO onto you USB and wait - patience is the keyword - patience.
When the copy operation is done - use the eject button in your file manager - and wait - wait until the device disappears from your file manager.
If you don't wait - data corruption will occur - and you don't want that.
Using terminal
Using the device name from above mount the first partition to a temporary mount point
sudo mount /dev/sdy1 /mnt
Copy the ISO file to the USB - assuming the ISO is in your Downloads folder
cp ~/Downloads/<windows.iso> /mnt && sync
When the command finishes you can unmount the device
sudo umount /mnt
If you don't wait - data corruption will occur - and you don't want that.
2. WoeUSB
Use the package woeusb available from AUR
pamac build woeusb
Tip from @codesardine in a comment
Before launching the app
- open a terminal
- and execute
sudo modprobe -nv loop
Then launch the app and get your ISO done.
TIP:
- The process is unpacking files from the ISO and copying them to the USB
- The latest Windows ISO files contains a file larger than 4G - so choose NTFS as file system.
3. Manual using CLI
Remove all removable devices (USB), open a terminal and list known disk devices
lsblk -la
Insert your USB stick and list your devices one more time
lsblk -la
Make a note of the extra device listed. If you only have one disk then it probably will be /dev/sdb
.
Please do double check the device id
In the terminal clear the disk of any partition info, using this command (replace sdy with device letter from above).
sudo dd if=/dev/zero of=/dev/sdy bs=1M count=10 oflag=sync
Then use fdisk to create the filesystem needed for the Windows ISO (replace X with device letter from above).
sudo fdisk /dev/sdy
The commands in fdisk is as follows
2019-11-01T16:43:00Z
The partitioning may need rework due to single file inside Windows ISO is larger than 4G.
- o - create a new empty DOS partition table
- n - add a new partition
- Enter - accept default partition type primary
- Enter - accept default partition number 1
- Enter - accept default first sector 2048
- Enter - accept default last sector
- t - change partition type
- c - select W95 FAT32 (LBA)
- a - set bootable flag for partition 1
- w - write changes to disk
Newer versions of Windows 10 ISO contains a file bigger than 4G. Format the device using exfat or ntfs (replace sdy with device letter from above) to overcome the size limitation of FAT32.
sudo mkfs.ntfs /dev/sdX1
Create a folder to mount your ISO
mkdir ~/winiso
Mount your ISO
sudo mount -o loop /path/to/windows/iso/filename.iso ~/winiso
Create a folder to mount your USB
mkdir ~/winusb
Mount the partition (replace sdy with device letter from above)
sudo mount /dev/sdy1 ~/winusb
Copy all files from ISO to USB
cd ~/winiso
cp -r * ~/winusb
The copy operation is going to take a long time depending on your USB port speed and your USB device.
When the copy is done ensure all data is flushed to the device using the sync command
sync
When all data is flushed to the device you will be returned to the prompt.
Next thing is to move out of the winiso folder
cd
Then unmount the devices
sudo umount ~/winiso ~/winusb
Remove the folders
rm -rf ~/winiso ~/winusb
You should now be able to boot to your Windows install media.
Revision
- Added ventoy
- Newer Windows media includes a wim file larger than 4GB
- format to exfat or ntfs to be able to use with WoeUSB
- Fixed recursive flag on cleanup command