HomeHow ToMake a Windows USB with Linux terminal

Create a Windows USB with Linux terminal

In a previous post we provided a guide to creating Windows USB in a Linux environment, without third-party tools.
Read Linux: creating bootable USB with Windows, without tools

Below we will see how you can make a bootable USB with Windows using your Linux terminal. Of course there are tools but many times the results are questionable. The following method 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 format the USB flash drive.

The Windows installer on the USB should be applied to a drive formatted in Fat32.
This means that we will also need to make a partition for UEFI mode. Not a UEFI fan? This guide is not for you.

Let's begin

Connect the USB flash and open a terminal

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

Create a Windows USB with Linux terminal

Locate the /dev/ label of the USB. You will know it by its size. In the image above, all the partitions on my disk are visible, but the sdb disk is also included, which is the USB I currently have.

Note: in the example, the dev/sd/ label of the USB drive is /dev/sdb. It may be different on your computer, depending on what peripherals you have attached to it. Make sure to change this to what lsblk shows on your computer.

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

sudo parted /dev/sdb

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

mklabel gpt

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

mkpart primary fat32 1MiB 100%

Then, exit GNU Parted with:

quit or just q

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

sudo mkfs.vfat -F32 /dev/sdb1

Be careful, we are formatting sdb1 and not sdb

With the 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 then

sudo mount /dev/sdb1 ~/USB

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

Mounting the ISO as a device on your computer 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 the ISO, with the mkdir command.

mkdir ~/WindowsISO

Mount the ISO

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

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

After the process is complete: If you want to unmount the Windows ISO file, use the umount command. The ISO will not be unmounted unless its contents are in use. Do not attempt to unmount it while the files are being copied.

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 the contents of the ISO to the USB drive. The process will take some time. For faster results, use a USB3 port if your computer has one.

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

Of course you will need to change username/ and /home/username/ with your own username.

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

sudo umount /dev/sdd1

If it doesn't want to disconnect and says "device is busy", try the command:

sudo umount /dev/sdd1 -l

That's it, you can make your first boot from your new Windows USB.

📧
Subscribe to the SecNews Newsletter

The most important Security & Technology news in your Inbox.

SecNews
SecNewshttps://www.secnews.gr
In a world without fences and walls, who needs Gates and Windows

SEARCH

FOLLOW US

📧
Newsletter SecNews
The most important Security & Technology news in your inbox.

LIVE NEWS