Bootiso is a powerful Bash script to easily and securely create a bootable USB device from one ISO file. It helps you create a bootable USB from an ISO with a single command from the terminal. It is a well tailored script that carefully organized and validated using shellcheck.
It has to be run with root authority, and if external programs it requires are not available on your system, it will ask you to install them and exits. Bootiso checks that the selected ISO has the correct mime-type, otherwise it exits. To prevent system damages, it ensures that the selected device is connected only via USB.
Read Also: 3 Ways to Extract and Copy Files from ISO Image in Linux
Before formating and partitioning your USB device, it prompts you to accept execution of the actions to prevent any data loss. Importantly, it manages any failure from an internal command appropriately exits. In addition, it performs a cleanup of any temporary files on exit by employing the trap utility.
Install Bootiso Script in Linux
The easy way to install bootiso from sources is to clone the git repository and set execute permission as shown.
$ git clone https://github.com/jsamr/bootiso.git $ cd bootiso/ $ chmod +x bootiso
Next, move the script to a bin path (for example ~/bin/ or /usr/local/bin/) to run it like any other Linux commands on your system.
$ mv bootiso ~/bin/
Once installed, the syntax for running bootiso is to provide the ISO as first argument.
$ bootiso myfile.iso
To create a bootable USB device from ISO file, first you need to list all available USB drives attached to your system using the -l
flag as shown.
$ bootiso -l Listing USB drives available in your system: NAME HOTPLUG SIZE STATE TYPE sdb 1 14.9G running disk
Next, to make the device (/dev/sdb
) as a bootable device, simply provide the ISO as the first argument. Note that if there is only one USB device attached to the system (as in the case above), the script will automatically select it, otherwise, it will ask you to select from an auto-generated list of all attached USB drives.
$ sudo bootiso ~/Templates/eXternOS.iso
You may also use the -a
flag to enable autoselecting USB drives in conjunction with -y
(disables prompting user before formating USB drive) option as shown.
$ sudo bootiso -a -y ~/Templates/eXternOS.iso
If you have multiple USB devices connected to the system, you can use the -d
flag to explicitly specify the USB device you want to make bootable from the command line as shown.
$ sudo bootiso -d /dev/sdb ~/Templates/eXternOS.iso
By default, bootiso uses mount + rsync
to employ dd command instead, add the --dd
flag as shown.
$ sudo bootiso --dd -d ~/Templates/eXternOS.iso
In addition, for non-hybrid ISOs, you can install a bootloader with syslinux with the -b
option, as follows. This option however does not support the dd command.
$ sudo bootiso -b /ptah/to/non-hybrid/file.iso OR $ sudo bootiso -bd /usb/device /ptah/to/non-hybrid/file.iso
For more information on other bootiso capabilities and options, see the help message.
$ bootiso -h
Bootiso Github repository: https://github.com/jsamr/bootiso
That’s It! Bootiso is a powerful Bash script to easily and securely create a bootable USB device from one ISO file, with a single command on the terminal. Use the comment form below to share your thoughts about it or ask questions.
bootiso: Found non-hybrid ISO; inspecting ISO for boot capabilities…
bootiso: Could not find an SYSLINUX bios folder containing c32 bios module files on this system.
Exiting…
What is your distro? Have you read
https://github.com/jsamr/bootiso#environment-variables-and-distro-specific-tweaks
?You never mention numerous dependencies that bootiso in fact requires and which are the pain in the neck to provide. It would be nice to check for them on the user side and point to where they can be obtained ( and installed !)
@Isnurmi
This is a valid concern, however, the script prompts you to install a dependency if it doesn’t exist on the system.
However, it would be nice to know about the dependencies ahead of time and install all of them at once instead of installing them one by one when the script calls for them.
@Dragonmouth
True, thanks for sharing your thoughts with us.
Can I make the script format the usb to ntfs while installing the iso?
I’ve tried:
bootiso [-f -t ntfs] isofile.iso — still does fat32
bootiso [-f] [-t] [ntfs] isofile.iso — still does fat32
bootiso -f [-t ntfs] isofile.iso — fail saying format action doesn’t require any arguments
bootiso -f -t ntfs — formats to iso but doesn’t install iso
bootiso isofile.iso — formats fat32 –if you can direct me to where it defaults to the fat32 so i can change the default to ntfs instead of fat32 that would also work for me
bootiso [-t] [ntfs] isofile.iso — fail: bash: -f: No such file or directory
Can’t seem to get the script to create an ntfs formatted bootable usb drive.
Hi ! Just to understand your issue clearly, what’s the output of « bootiso –inspect isofile.iso »?
Version 3 is out [with many improvements :-) https://github.com/jsamr/bootiso/releases/tag/v3.0.0
Notably, it now inspects ISO file to check if it’s hybrid. When it’s not, it looks for UEFI and SYSLINUX boot capabilities. After which, it chooses the best install mode (dd or mount+rsync) and eventually installs SYSLINUX.
So you basically don’t need to care anymore about rsync or dd mode, just run `bootiso myfile.iso’ and it will work, even with rescue CDs such as UltimateBootCD.
@Jules
Many thanks for sharing this useful information, we are truly grateful.
Surely you should put it in /sbin, /usr/sbin, etc. If it is root only, it should be there.
@Pim
Correct, these are more appropriate locations for keeping it. Thanks for this useful tip.
Thanks for pointing this out. I’ve added your suggestion to the README.
Very well done and professional. I used dd before but this will make it a little more bulletproof.
@1vank2139
It is a great script, reliable and indeed professional. Many thanks for the feedback.
Why not to use dd?
You don’t need install and setting any other app, dd is out of box.
@Herald
The main aim of this script is to provide a secure way of creating bootable devices, which you can not achieve by running this dd command only. Using this dd command, you can accidentally provide your root partition or any other important partition output device, which can lead to data loss; in simple terms the dd command only, can not check that your output device is a USB or not.
Secondly, using dd command, you will not be prompted before formating of the output device, which may also lead to data loss in case you have not backed up data on that device. This script is a much better option because it securely prepares your USB device before moving files on it, and any internal errors are reported.
As a side note, dd only works for hybrid ISO’s. bootiso works with any ISO, given the “-b” option to install a syslinux bootloader.
@Jules
This actually sheds more light on why bootiso is far much better a option than using dd only for making a bootable USB from the command-line. Thanks for the addition.