Skip to content

Instantly share code, notes, and snippets.

@ungeskriptet
Last active November 14, 2025 18:00
Show Gist options
  • Select an option

  • Save ungeskriptet/c9bd5a5b60284074299816e2b38ce863 to your computer and use it in GitHub Desktop.

Select an option

Save ungeskriptet/c9bd5a5b60284074299816e2b38ce863 to your computer and use it in GitHub Desktop.
Create a bootable Windows USB flash drive on Linux without Ventoy

Create a bootable Windows USB flash drive on Linux without Ventoy

This guide will show you how to create a bootable Windows USB flash drive without Ventoy.

Make sure to replace /dev/sdX in the command with your actual block device. You can list all of your block devices using the command lsblk.

Step 1: Partitioning

We need a GPT partition table and two partitions:

  • 1 MiB partition with type EFI System
  • Remainder of the storage space with type Microsoft basic data

Here is an example with fdisk:

Details: fdisk output log
$ sudo fdisk /dev/sdX

Welcome to fdisk (util-linux 2.41.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): g
Created a new GPT disklabel (GUID: 5290C629-9D9E-4F08-B883-D64EB11E4338).
The device contains 'dos' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (2048-31129566, default 2048): 2048
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-31129566, default 31127551): +1M

Created a new partition 1 of type 'Linux filesystem' and of size 1 MiB.

Command (m for help): n
Partition number (2-128, default 2): 2
First sector (4096-31129566, default 4096): 4096
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4096-31129566, default 31127551): 31127551

Created a new partition 2 of type 'Linux filesystem' and of size 14,8 GiB.

Command (m for help): t
Partition number (1,2, default 2): 1
Partition type or alias (type L to list all): 1

Changed type of partition 'Linux filesystem' to 'EFI System'.

Command (m for help): t
Partition number (1,2, default 2): 2
Partition type or alias (type L to list all): 11

Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.

Command (m for help): p
Disk /dev/sdd: 14,84 GiB, 15938355200 bytes, 31129600 sectors
Disk model: Slim Line
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 5290C629-9D9E-4F08-B883-D64EB11E4338

Device     Start      End  Sectors  Size Type
/dev/sdd1   2048     4095     2048    1M EFI System
/dev/sdd2   4096 31127551 31123456 14,8G Microsoft basic data

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Alternatively, you can use this sfdisk command:

Warning

Running the command below will delete the partition table without prompting for confirmation

$ sudo sfdisk /dev/sdX << EOF
label: gpt
,1M,U
;,EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
write
EOF

Step 2: Flashing UEFI:NTFS

UEFI:NTFS makes it possible to boot from an NTFS or exFAT partition on the USB flash drive. This is what Rufus does under the hood and is required since we will later copy the Windows ISO contents to the bigger partition we have created.

  1. Download uefi-ntfs.img (Click on download raw file): https://github.com/pbatard/rufus/blob/master/res/uefi/uefi-ntfs.img
  2. Flash the downloaded file onto the USB flash drive: $ cat uefi-ntfs.img | sudo tee /dev/sdX1 > /dev/null

Alternatively, you can tell curl to directly download the file and flash it to the partition:

$ sudo curl -L https://raw.githubusercontent.com/pbatard/rufus/refs/heads/master/res/uefi/uefi-ntfs.img --output /dev/sdX1

Step 2: Formatting

Now we need to format the bigger partition on the USB flash drive. The Windows ISO contents will later be copied to this partition

Note

  • Make sure you have the ntfs-3g or ntfs3g package installed.
  • Do not format this partition using exFAT. Only NTFS is supported by the Windows Boot Manager.

Use the following command to format the second partition:

$ sudo mkfs.ntfs -Q -L "WINDOWS" /dev/sdX2

Step 3: Copying Windows ISO contents

Note

Make sure you have the 7zip or p7zip package installed. The command for 7-Zip may be called 7zz or 7z.

  1. Mount the partition:
    $ sudo mount --mkdir -o uid=$UID,rw -t ntfs3 /dev/sdc2 windows-mnt
    
  2. Extract the ISO contents to the mounted partition:
    $ 7z x -owindows-mnt 26100.1742.240906-0331.ge_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso
    
  3. Sync data (may take a while to finish):
    $ sync
    
  4. Unmount the partition:
    $ sudo umount windows-mnt
    

Step 4: Booting

If everything has finished successfully, the USB flash drive should now be bootable. Make sure your firmware is set to use UEFI instead of legacy (CSM) mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment