$ sudo -i
# id
uid=0(root) gid=0(root) groups=0(root)

Unmount all the partitions that you have mounted off the USB stick.

# umount /dev/sdxn

# export USB_DEVICE=/dev/sdx
# export USB_PARTITION=/dev/sdxn
# export USB_MOUNTPOINT=/mnt/sdxn
# export WIN10_MOUNTPOINT=/mnt/win10-mount

The next three commands will erase your ${USB_DEVICE} and create the EFI system partition:

# sgdisk --zap-all ${USB_DEVICE}
# sgdisk --new=1:0:0 --typecode=1:ef00 ${USB_DEVICE}
# mkfs.vfat -F32 -n EFI ${USB_PARTITION}

Mount the USB device partition at ${USB_MOUNTPOINT}:

# mkdir ${USB_MOUNTPOINT}
# mount -t vfat -o uid=1000,gid=1000,umask=022 ${USB_PARTITION} ${USB_MOUNTPOINT}

Mount the Windows 10 ISO image at ${WIN10_MOUNTPOINT}:

# mkdir -p ${USB_MOUNTPOINT}/boot ${USB_MOUNTPOINT}/EFI/BOOT ${WIN10_MOUNTPOINT}
# mount -t udf -o loop,ro windows10.iso ${WIN10_MOUNTPOINT}

Copy the Windows 10 ISO contents to ${USB_MOUNTPOINT}:

# cp -Rv ${WIN10_MOUNTPOINT}/* ${USB_MOUNTPOINT}

# sync
# cd /
# umount ${USB_MOUNTPOINT} ${WIN10_MOUNTPOINT}
Advertisements