2022-10-17 update: Just use Ventoy! 😉
—
DEPRECATED:
If you use Linux and need to create a bootable flashdrive with a Windows 10 installer, this tutorial is for you.
This method doesn’t require any third-party software to be installed (like winusb or unetbootin).
You will need an 8GB flashdrive (or bigger) to continue. Check if there’s anything in the flashdrive that you need to backup, as this procedure will format it.
1) If you don’t already have it, download a copy of Microsoft Windows 10 directly from Microsoft’s website. Have your activation key in hand for the installation itself (not covered in this tutorial);
2) Make sure you have these packages installed. I’m running Debian, so this is the command for that:
sudo apt-get install coreutils gparted grub-pc-bin ntfs-3g
3) After that, open gparted to prepare the flashdrive. Follow the steps on this video. Make sure you’re selecting the right device for your flashdrive (in my case it’s /dev/sde ):
4) To make our lives easier, create two shell variables pointing to the correct partitions and one pointing to the file we downloaded on step 1.
In my case:
export PART1="/dev/sde1" # this is the boot partition on the flashdrive export PART2="/dev/sde2" # this is the NTFS partition on the flashdrive export ISOFILE="/home/ricardo/Downloads/iso/Win10_1803_EnglishInternational_x64.iso"
5) You will need to mount both partitions as well as the ISO file you downloaded on step 1. Create them:
sudo mkdir -pv /tmp/{part1,part2,iso}
6) Mount the flashdrive partitions to those folders, respectively:
sudo mount ${PART1} /tmp/part1 sudo mount ${PART2} /tmp/part2
7) Mount the ISO file you downloaded on step 1 (point to the correct path on your filesystem):
sudo mount -o loop ${ISOFILE} /tmp/iso
8) Trigger the copy of the files from the ISO file to the flashdrive. This might take a while, depending on the speed of your flashdrive.
sudo rsync -a /tmp/iso/ /tmp/part2/ && sync
9) Install grub to the MBR pointing the root directory to the boot partition:
sudo grub-install --no-floppy --target=i386-pc --recheck --locales="en@quot" --themes="" --root-directory=/tmp/part1 --boot-directory=/tmp/part1/grub-boot --install-modules="ntldr normal search ntfs" ${PART1/1/}
10) We need to create the GRUB configuration file. This has to be done as root. This is the easiest way:
sudo su - cat > /tmp/part1/grub-boot/grub/grub.cfg << EOF set timeout=10 set default=0 menuentry "Windows 10 Installer" { insmod ntfs search --set=root --file /bootmgr ntldr /bootmgr boot } EOF exit
11) That’s it! Now just unmount the flashdrive and ISO file, eject the flashdrive and you’re good to go:
sync && sudo umount /tmp/{part1,part2,iso} && sudo rmdir /tmp/{part1,part2,iso}
12) Plug the flashdrive to your computer, power it on and choose to boot from the USB:
One thought on “Create a Windows 10 bootable flashdrive using GRUB”
Comments are closed.