Build a Windows USB with Linux terminal

In a previous post we had provided a Windows USB creation wizard in Linux, with no third party tools.
Read it Linux: bootable USB with Windows, without tools

Below we will see how you can do one bootable USB with Windows with your Linux terminal. Of course there are tools, but often the it is doubtful. The way below will work 100% as long as you follow the steps.Windows USB

The USB should have at least 4GB, and not contain anything else you need because it will be deleted.

The first step is to configure the USB flash drive.

The Windows Installer in USB should be applied to a Fat32 formatted disk.
This means that we will also need to make a partition for it UEFI. Δεν είστε φίλος του UEFI; Ο this is not for you.

Let's start

Connect the USB flash and open a terminal

Run the lsblk command. The command will reveal all the devices on your computer.

Locate the / dev / USB stick. You will get to know it by size. All the partitions in my disk are visible on the above image, but there is also a sdb disk, which is the USB I currently have.

Note: in the example, its dev/sd/ label of the USB drive is /dev/sdb. On your computer it may be different, and it depends on what peripherals you put on it. Make sure you change it to what lsblk shows on your own computer.

Below, with the GNU Parted (gparted) tool, we will create a new partition.

sudo parted / dev / sdb

However, Windows uses UEFI, so we need to configure the partition in GPT format.

mklabel gpt

Answer yes (y) to all the questions that GNU Parted will ask you. Next, let's create a new system in FAT32 format.

mkpart primary fat32 1MiB 100%

Then exit GNU Parted with:

quit or just q

Finally, we will format in the new partition with a mkfs command.

sudo mkfs.vfat -F32 / dev / sdb1

Be careful to format sdb1 rather than sdb

With formatted USB, on your computer. Do not open the USB with the file manager, but create a new folder called USB with the mkdir command.

mkdir ~ / USB

and after

sudo mount / dev / sdb1 ~ / USB

In the next step we will mount Windows ISO to extract the files. Download the official ISO of Windows 10 from Microsoft.

Mounting ISO as your PC device is important. Do not attempt to open it by right-clicking as there may be data that you do not see.

Create a folder to open ISO with the mkdir command.

mkdir ~ / WindowsISO

Mount the ISO

sudo mount -o loop / home / your own path to /windows.iso ~ / WindowsISO

If the ISO file is installed well, you will see it appear if you run the lsblk command.

For after the end of the process: If you want to decouple the Windows ISO file, use the umount command. ISO will not be disconnected unless its contents are used. Do not attempt to disconnect it while copying files.

sudo umount ~ / WindowsISO

Let's create the USB

Before we transfer the files to the upcoming Windows USB we will need root access.

sudo -s

Copy and paste all ISO contents into the USB drive. The process will take some time. For faster results, use a USB3 port if your computer is available.

cp -r / home / username / WindowsISO / * / home / username / usb

Of course you should change username / and / home / username / with your username.

After transfer is complete, disconnect the USB from the ~ / USB folder with the umount command.

sudo umount / dev / sdd1

If it does not want to disconnect and says "device is busy", try the command:

sudo umount / dev / sdd1 -l

That was, you can make your first boot from your new Windows USB.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.100 registrants.

Written by giorgos

George still wonders what he's doing here ...

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).