scripts/bootable_windows10_usb_drive/README.md

3.0 KiB

Create a Bootlabe Windows 10 USB Drive using LINUX Arch

A manual from the site adamsdesk, was adapted to my needs. Version 1.0

Prerequisite

Assumptions

  • Instructions using Arch Linux
  • USB drive with a minimum of 8 GB
  • Steps prefixed with "$" represents the CLI prompt with normal user access rights
  • Steps prefixed with "#" represents the CLI prompt with root access rights

Preparation

Install the following packages from the Arch Linux distribution

$ yay -Sy ms-sys ntfs-3g rsync

Instructions

  1. Download the latest Windows ISO from Microsoft here,

  2. Plug in the USB flash drive,

  3. Locate the USB device name:

    $ lsblk
    
    NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    loop0     7:0    0  5,7G  0 loop /mnt/iso
    sda       8:0    1  7,5G  0 disk 
    └─sda1    8:1    1  7,5G  0 part 
    nvme0n1 259:0    0  1,8T  0 disk /
    
  4. Unmount the UB flash drive:

    # umount /dev/sda1
    
  5. Create USB flash drive partition:

    # fdisk /dev/sda
    

    a.) Press D then press <ENTER> to delete all partitions,

    b.) Press N then press <ENTER> to create a new partition,

    c.) Press <ENTER> to accept default (p for primary),

    d.) Press <ENTER> to accept default partition number, 1,

    e.) Press <ENTER> to accept default first sector,

    f.) Press <ENTER> to accept default last sector,

    Note:
    Say yes if prompted for "Do you want to remove the signature". 
    

    g.) Press T then press <ENTER> to change partition type,

    h.) Press 7 then press <ENTER> to set partion type to HPFS/NTFS/exFAT,

    i.) Press P to verify:

    Disk /dev/sda: 7,5 GiB, 8053063680 bytes, 15728640 sectors
    Disk model: Flash Disk      
    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: dos
    Disk identifier: 0x8bfaef3a
    
    Device     Boot Start      End  Sectors  Size Id Type
    /dev/sda1        2048 15728639 15726592  7,5G  7 HPFS/NTFS/exFAT
    

    j.) Press W then press <ENTER> to write table to disk and exit,

  6. Format partition file system to NTFS:

    # mkfs.ntfs -L win10 /dev/sda1
    
  7. Create mount points:

    # mkdir /mnt/{iso,usb}
    
  8. Mount Windows ISO:

    # mount ~<username>/Downloads/Win10_22H2_English_x16v1.iso /mnt/iso
    
  9. Mount USB drive partition:

    # mount /dev/sda1 /mnt/usb
    
  10. Copy files from Windows ISO to USB flash drive using rsync:

    # rsync -avP /mnt/iso/ /mnt/usb/
    
  11. Make USB flash drive bootable with:

    # ms-sys -7 /dev/sda
    
    Windows 7 master boot record successfully written to /dev/sda
    
  12. Run sync to ensure all operations have completet,

    # sync
    
  13. Unmount USB flash drive,

    # umount /mnt/usb
    
  14. Unmount Windows ISO,

    # umount /mnt/iso
    
  15. Remove mount point directories:

    # rm -r /mnt/{iso,usb}