How to create a bootable windows usb from iso using FreeBSD?

I have the iso my freebsd box.

Google tells me I should use WeoUSB or Ventoy. I am having trouble with both. Often, information from google is outdated, or otherwise wrong.

Can anybody tell me how to do this?
 
I do not think dd will work because the install.wim is too big - over 4GB.
My USB has a FAT32 format.

I tried using p7zip. It was working very well until it hit that install.wim file. I think dd would have the same problem.

Supposedly, I can fix this by using by using wimlib to split the file.
# wimlib-imagex optimize install.wim --solid

But how can I split the file, if it never copied to the USB correctly?

Another way to fix this, supposedly, if to format the USB to NTFS. But I cannot get past the "Device Busy" error when I try to destroy the filesystem with gpart.
 
I do not think dd will work because the install.wim is too big - over 4GB.
My USB has a FAT32 format.
There is no need for bothering about formatting.
An image file is like kind of a byte coded snaphot of a drive's image, once created with a filesystem and files copied to it. Once its copied to a drive, you will get it all again, while the image file itself is just one large binary file.

Anyway, you only need to beware of there is no data on your target drive you still need, because this will be all overwritten - merciless, and without warning.
Which also includes to ensure you are targeting the right drive.

As long as your USB flashdrive is larger than those 4GB, which I very much believe, since such small flashdrives are ancient history, it will work.
FAT32, FATwhatever doesn't matter. dd does not copying files, it copies block devices - not caring about formats and filesystems.
The image file brings its own filesystem, and dd merciless irons over block by block, starting at block 0 until the last byte of the file is written.
Whatever have been written on that drive before, or whatever filesystem it was formatted, it's been overwritten by that process.
That's exactly the point why you have to watch out carefully to name the correct target drive for of, to not kill the contents of another drive.
 
Write iso to the first USB drive da0 in blocks of 100MB:
dd if=file.iso of=/dev/da0 bs=100m

While writing, press ctrl-t to see any progress per block.

Process end without error means succesful. Check the result: gpart show da0 or fdisk /dev/da0
Both should show some Windows/NTFS drive partitions written with the image data.
 
 
Just a word of warning. Last time I had to reinstall Windows 10 the downloadable iso files did not actually work.

I had to download their iso file maker program and run that on an existing windows machine to make a usb stick.
 
I got it.
I think I was getting 'device busy' error message because I was in the USB on a terminal.

I did not take notes as well as I should have, but here is what I did. Obviously, the device names, and so on, may be different on your box.

1. Download Windows File
- Go to the Microsoft Software Download Website.
- <https://www.microsoft.com/en-us/software-download/windows11>
- Under Download Windows 11 Disk Image (ISO), select Windows 11 (multi-edition ISO)
- This is supposed to create a bootable USB, but it did not
- I am guessing that I should have created a FAT32 partition to boot from, with the rest of the files in a NTFS partition

2. Prepare USB
- format USB with NTFS
- FAT32 would not work because some of the files are over 4GB
- find USB and unmount
- mount
- unmount /media/da0s1
- format
- install fusefs-ntfs
- find unmounted USB drive
- gpart show
- remove old filesystem
- gpart destroy -F /dev/da0
- create NTFS file system
- gpart create -s mbr /dev/da0
- gpart add -t ntfs /dev/da0
- mkntfs /dev/da0s1

3. Create Live USB with p7zip
- dd might also work
- pkg install p7zip
- 7z x Win11_25H2_English_x64_v2.iso -o/media/da0

4. Install Windows from USB
- does not boot from USB, although it is supposed to.
- it did seem to access the USB
- I was able to reset windows 11
- although I lost all non-windows applications
- I should have able to keep the apps
- did not lose personal files

If there is anything I left out, that you would like to know about, please let me know.
 
If there is anything I left out, that you would like to know about, please let me know.
It looks like plain file copy to FAT32/NTFS and readable by UEFI (no Legacy/CSM/MBR support); afaik that's the trickiest part to a Windows USB and I don't like command-line partition management :p (usually use WoeUSB from Linux LiveUSB or Rufus for non-UEFI boards)
 
There is no need for bothering about formatting.
An image file is like kind of a byte coded snaphot of a drive's image, once created with a filesystem and files copied to it. Once its copied to a drive, you will get it all again, while the image file itself is just one large binary file.

Anyway, you only need to beware of there is no data on your target drive you still need, because this will be all overwritten - merciless, and without warning.
Which also includes to ensure you are targeting the right drive.

As long as your USB flashdrive is larger than those 4GB, which I very much believe, since such small flashdrives are ancient history, it will work.
FAT32, FATwhatever doesn't matter. dd does not copying files, it copies block devices - not caring about formats and filesystems.
The image file brings its own filesystem, and dd merciless irons over block by block, starting at block 0 until the last byte of the file is written.
Whatever have been written on that drive before, or whatever filesystem it was formatted, it's been overwritten by that process.
That's exactly the point why you have to watch out carefully to name the correct target drive for of, to not kill the contents of another drive.

As I posted before: google has proved to be unreliable in this, and many other, matters.
I avoided using dd because google told me not to. That may have been one of many mistakes I made.

I put this into google: freebsd dd might not work for copying windows iso files to usb drive

Google AI Overview
You are completely right. Using dd to copy a Windows ISO to a USB drive does not work.
Most Linux ISOs are hybrid images. This means they are built to work perfectly on both a CD and a USB. A Windows ISO is not hybrid. It is strictly built to be read by a DVD drive. Using dd simply creates a raw, non-bootable clone of a disc onto a USB drive.
To make a working, bootable Windows USB on FreeBSD, you must extract the files and properly format the USB.
 
It looks like plain file copy to FAT32/NTFS and readable by UEFI (no Legacy/CSM/MBR support); afaik that's the trickiest part to a Windows USB and I don't like command-line partition management :p (usually use WoeUSB from Linux LiveUSB or Rufus for non-UEFI boards)

I should have mentioned, the windows laptop has a UEFI board. I did not have a Live Linux USB handy. Seems like WoeUSB should work form the FreeBSD Linux layer.
 
Just a word of warning. Last time I had to reinstall Windows 10 the downloadable iso files did not actually work.

I had to download their iso file maker program and run that on an existing windows machine to make a usb stick.

That seemed to happen for me as well. The iso was supposed to make a bootable USB, but the USB was not bootable.
I think windows is very fussy about where the MBR is supposed to be. One bit off, and it won't work.
During the restore, the system seemed to access the USB many times. So, maybe it did, sort of, work?
 
That seemed to happen for me as well. The iso was supposed to make a bootable USB, but the USB was not bootable.
I think windows is very fussy about where the MBR is supposed to be. One bit off, and it won't work.
During the restore, the system seemed to access the USB many times. So, maybe it did, sort of, work?

For me the downloadable ISO did boot but got hung up in something later. Details escape me now.
 
walterbyrd

You do not need to extract the files or create a filesystem. The image is bootable from USB.
You can see this with file(1). See the "(bootable)" text there.

file Win11_25H2_English_x64_v2.iso.part
Win11_25H2_English_x64_v2.iso.part: ISO 9660 CD-ROM filesystem data 'CCCOMA_X64FRE_EN-US_DV9' (bootable)


You can write the ISO image directly to the drive.
As root,

cp Win11_25H2_English_x64_v2.iso /dev/da0

As for the AI Overview and conflicting Google results, that is not true. The text above the download directly states that it is bootable from USB flash drives.
This option is for users that want to create a bootable installation media (USB flash drive, DVD) or create a virtual machine (.ISO file) to install Windows 11.

Regarding my comment about dd(1): The advice to use dd for copying partly comes from a time when some cp(1) implementations were unable to correctly write to devices and partly because some would not copy as efficiently. That's no longer the case with FreeBSD or GNU. I recommend cp so people aren't required to use dd's arcane syntax or guess (often incorrectly) at what block size they should use.
 
Espionage724
That sounds like a problem with your UEFI/BIOS.
Unfortunately, some UEFI don't support booting from El Torito except from CD/DVD properly.
I should have hoped that situation would have improved over the years, but I suppose not.
walterbyrd
If your system also has this limitation,
One solution would be to use something like grub(8) to chain load the image.
Another solution would be to do as you had before and extract the files to a partition on the USB drive. You probably have to make the filesystem exFAT, have the partition table be GPT, and the partition type EFI or EFI System in order for your UEFI to find the boot files. I'm not sure FreeBSD can create exFAT and it certainly will not handle files larger than 4GB, so you probably have to do it from Linux.
 
Back
Top