Skip to main content

Creating a bootable flashdrive

Creating a bootable flashdrive

To create a bootable flashdrive for Windows you'll need an 8GB+ flash drive. For Linux, it depends on the distribution. You should be fine with 1GB for Arch, but hey, 16GB flash drives are like $5 today.

Keep in mind that the flash drive can either be (U)EFI bootable, BIOS bootable(often named legacy in UEFI options) or both.

To actually boot from the flash drive, go into your UEFI/BIOS settings and either find the option to boot directly from the flash drive, or rearrange your boot order to boot from flash drive first.

On Windows

Linux or Windows images

Rufus - Rufus usually has no problem working with Linux and Windows ISOs and is easy to work with. The only negative thing is that I didn't figure out how to make ISOs that boot both under BIOS and UEFI, only one or the other, which is selected under the "Partition scheme" label.

You want to use "GPT for UEFI" partition scheme unless your hardware is years and years old.

unetbootin - Sometimes certain Linux distributions fail to be used by Rufus

On Linux and macOS

macOS has some command name differences not mentioned here, but the general idea works still.

Linux images

Unebootin or dd can be used for this purpose, I chose to use dd because it's preinstalled and straightforward.

Make sure to run lsblk to know what device you should be dealing with.

umount /dev/sde1 - Unmount the device in case it's mounted

sudo dd if=/path/to/file.iso of=/dev/sde bs=4M status=progress && sync

You should now be able to boot the distribution in both BIOS and UEFI, if the distribution supports it.


Windows images

Below is a description of the manual process, however you can use WoeUSB for an automated one.


[1] [2]

This handy script does the below-described process:

Format the flash drive with Gparted - Device > Create partition table - Set partition table to msdos. Afterwards create a FAT32 partition, remember to label it, labeling it is optional if you only want to keep only one OS on the flash drive but probably required for more.

Right click the partition you created > Manage flags > tick the 'boot' flag. Exit gparted.

Mount the ISO you want to use to some already existing folder

sudo mount -o loop ~/Downloads/Win8.1_English_x64.iso /mnt/iso

and copy all files from it to the mounted flash drive. The exclude is there to support Win10 1809+ images which have over 4GB install.wim which needs to be split:

rsync -rv --progress --exclude=install.wim /mnt/iso/ /run/media/c0rn3j/WINDOWS/

wimsplit /mnt/iso/sources/install.wim /run/media/c0rn3j/WINDOWS/sources/install.swm 3000

At this point the flash drive should be UEFI bootable. You're likely done here, but if you have a very old machine, the rest is needed to also enable BIOS booting.

Also you should create a file ei.cfg in the sources folder with following content(it makes sure you can actually select the edition):

[Channel]
Retail

sudo grub-install --target=i386-pc --boot-directory=/run/media/c0rn3j/WINDOWS/boot /dev/sdd - This command will install GRUB bootloader on the flash drive.

Last thing you'll need to do is create a config file for GRUB.

gedit /run/media/c0rn3j/WINDOWS/boot/grub/grub.cfg - This command will run gedit, paste the following text block in it and save it. Remove the label part if you didn't set one.

default=1
timeout=15
color_normal=light-cyan/dark-gray
menu_color_normal=black/light-cyan
menu_color_highlight=white/black
menuentry "Start Windows Installation" {
    insmod ntfs
    insmod search_label
    search --no-floppy --set=root --label WINDOWS --hint hd0,msdos1
    ntldr /bootmgr
    boot
}

The flash drive should now be bootable by both UEFI and BIOS.

KON-BOOT images

Format the flash drive with Gparted - Device > Create partition table - Set partition table to msdos. Afterwards create a FAT32 partition, remember to label it.

Copy the EFI folder onto the new partition.(you may need to rename it to lowercase efi?) Copy the files in USBFILES folder onto the new partition.

sudo grub-install --target=i386-pc --boot-directory=/run/media/c0rn3j/KONBOOT/boot /dev/sdd - This command will install GRUB bootloader on the flash drive.

sudo cp /usr/lib/syslinux/bios/memdisk /run/media/c0rn3j/KONBOOT/boot/grub/ - copies memdisk onto the flashdrive - needed for BIOS booting.

gedit /run/media/c0rn3j/KONBOOT/boot/grub/grub.cfg - create the following grub entry

 menuentry "Konboot" {
 linux16 /boot/grub/memdisk
 initrd16 /konboot.img
 }

Note: Konboot v2.5 does not seem to work on anything past the first W10 RTM build.

Using Android to emulate mass storage

You can boot images straight off your phone if you've root permissions.

Usb Mountr was one of the FOSS solutions, but it was dropped by the maintainer.

DriveDroid is supported but proprietary.

Your kernel might support emulating USB, emulating CD drive or both.