Solved Creating a Windows 10 bootable USB-stick using FreeBSD

Has anyone successfully created a Windows 10 bootable USB0stick using FreeBSD?

I have tried both "dd if=W10.iso of=/dev/da0" and "dd if=W10.iso of=/dev/da0 bs=1M conv=sync" but both did not work.
 
Has anyone successfully created a Windows 10 bootable USB0stick using FreeBSD?

I have tried both "dd if=W10.iso of=/dev/da0" and "dd if=W10.iso of=/dev/da0 bs=1M conv=sync" but both did not work.
I had recently made one UEFI Windows bootable USB, but in Devuan Linux. You need to format the USB drive with gpt label and FAT32 file system. Since, FAT has some size restrictions, some tool (wimlib) was used to compress the the contents. In brief - mount the iso as read only; copy the contents, use wimlib tool to compress; then copy to the FAT32 formatted USB drive. Note that you've to install wimlib in FreeBSD.
This is the source, I followed:

Another way is to use Rufus's UEFI:NTFS driver. I had tried this few years back and it worked:
 
I ran into this the last time I tried:
The Windows Imaging format (WIM) file in that download, which contains the compressed files that the Windows Setup program uses for installing the new version, is a little over 4.5 GB in size, which is well beyond the 4 GB maximum file size for a USB flash drive formatted using the FAT32 file system. That extra-large file would be fine for a drive formatted using NTFS, but modern UEFI-based hardware requires a FAT32 drive to boot for a clean install of Windows.

I wound up burning a DVD.
 
  • Like
Reactions: a6h
This is not Linux Forums. Which one of your solutions actually works in FreeBSD?
OK. I tried the first method on a 15GB USB drive for UEFI booting of Windows 10. It works!
First hurdle was FreeBSD is not supporting UDF ISO format of Windows 10. So, I used 7z to extract the ISO contents. Thanks to this post.
--
HOWTO make a bootable UEFI Windows 10 USB in FreeBSD :
(I have used doas for root access. Run the commands as root or sudo, if you don't use doas.)
  • I downloaded latest 64-bit Windows 10 ISO as of now - 'Win10_20H2_English_x64.iso' into ~/Downloads directory.
  • Installed necessary tools:
    Code:
    :~% doas pkg install p7zip wimlib

  • Created a "windows" directory in ~/ (home directory) and extracted the contents of 'Win10_20H2_English_x64.iso':
    Code:
    cd ~/windows; 7z x ~/Downloads/Win10_20H2_English_x64.iso
  • After extraction, compress the size by running:
    Code:
    cd sources; doas wimlib-imagex optimize install.wim --solid
    (If doas is not used, perhaps run this as root su or sudo) - This took a very long time (30 minutes or so) in my poor 2012 Sandy bridge desktop.
Now, get an USB drive, blank it and format to FAT32. I am using the drive with GPT partition type. Replace the /dev/da0 with respective USB drive device file.
Code:
:~% doas gpart destroy -F /dev/da0
:~% doas gpart create -s GPT /dev/da0
:~% doas gpart add -a 4k -t ms-basic-data /dev/da0
:~% doas newfs_msdos -F 32 -L Windows10 /dev/da0p1
:~% doas mount -t msdosfs /dev/da0p1 /mnt
:~% doas cp -R ~/windows/ /mnt/
:~% doas umount /mnt
:~% doas sync

That's all needed to create a Windows 10 latest bootable media in FreeBSD. I tried it and is listed as UEFI usb drive in F10 boot menu and booted into Windows 10 in my desktop PC. Note that this is my experience building it and YMMV. Let me know, if it works for you.
 
Last edited:
It took 22,5 minutes (1348.67 seconds) for me. On a G1 Sniper Z97 with a 4 core i5-4690 CPU.


For other users, to format an USB under FreeBSD 12.1:

Code:
# gpart destroy -F da0
# gpart create -s GTP da0
# gpart add -a 4k -t ms-basic-data da0
# newfs_msdos -F 32 -L Windows10 /dev/da0p1
# mount -t msdosfs /dev/da0p1 /mnt
# cp -R ~/windows/ /mnt/
# umount /mnt

(I am in the middle of creating the USB.)
 
Not sure what exactly `wimlib-imagex` does, I usually use just `wimsplit install.wim install.swm 2048 && rm install.wim`, it's like 10 seconds for me (on new pc, with fast cpu and nvme though).
 
It took 22,5 minutes (1348.67 seconds) for me. On a G1 Sniper Z97 with a 4 core i5-4690 CPU.


For other users, to format an USB under FreeBSD 12.1:

Code:
# gpart destroy -F da0
# gpart create -s GTP da0
# gpart add -a 4k -t ms-basic-data da0
# newfs_msdos -F 32 -L Windows10 /dev/da0p1
# mount -t msdosfs /dev/da0p1 /mnt
# cp -R ~/windows/ /mnt/
# umount /mnt

(I am in the middle of creating the USB.)
I've found thet partition type 'ms-basic-data' is not supported if your scheme is "MBR", changed it to "fat32", so the command is
gpart add -a 4k -t fat32 da1​
My USB stick was at '/dev/da1', so I've changed the geometry name.
Now, I have a working WindowsPE, thanks!
 
Back
Top