Last active
June 7, 2025 01:52
-
-
Save janaz/60e6ef40aae03ab88132001f112c73f5 to your computer and use it in GitHub Desktop.
Create bootable Windows 11 USB in Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usb drive: /dev/sdg | |
# Format your USB flash drive | |
wipefs -a /dev/sdg | |
parted /dev/sdg | |
(parted) mklabel gpt | |
(parted) mkpart BOOT fat32 0% 1GiB | |
(parted) mkpart INSTALL ntfs 1GiB 10GiB | |
(parted) quit | |
parted /dev/sdg unit B print | |
# Mount Windows ISO somewhere | |
mkdir /mnt/iso | |
mount /tmp/Win11_24H2_Polish_x64.iso /mnt/iso/ | |
# Format 1st partition of your USB flash drive as FAT32 | |
mkfs.vfat -n BOOT /dev/sdg1 | |
mkdir /mnt/vfat | |
mount /dev/sde1 /mnt/vfat/ | |
# Copy everything from Windows ISO image except for the sources directory there | |
rsync -r --progress --exclude sources --delete-before /mnt/iso/ /mnt/vfat/ | |
# Copy only boot.wim file from the sources directory, while keeping the same path layout | |
mkdir /mnt/vfat/sources | |
cp /mnt/iso/sources/boot.wim /mnt/vfat/sources/ | |
# Format 2nd partition of your USB flash drive as NTFS | |
mkfs.ntfs --quick -L INSTALL /dev/sdg2 | |
mkdir /mnt/ntfs | |
mount /dev/sdg2 /mnt/ntfs/ | |
# Copy everything from Windows ISO image there | |
rsync -r --progress --delete-before /mnt/iso/ /mnt/ntfs/ | |
# Unmount the USB flash drive and Windows ISO image | |
umount /mnt/ntfs | |
umount /mnt/vfat | |
umount /mnt/iso | |
sync | |
# Power off your USB flash drive | |
udisksctl power-off -b /dev/sdg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment