A Bash Script to Create a Bootable USB from ISO in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

11 Responses

  1. Jules Samuel Randolph says:

    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.

  2. Pim Dennendal says:

    Surely you should put it in /sbin, /usr/sbin, etc. If it is root only, it should be there.

  3. ivank2139 says:

    Very well done and professional. I used dd before but this will make it a little more bulletproof.

  4. Herald says:

    Why not to use dd?

    # dd if=/dev/sdb of=yourimage.iso bs=1m
    

    You don’t need install and setting any other app, dd is out of box.

    • Aaron Kili says:

      @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.

    • Jules Samuel Randolph says:

      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.

      • Aaron Kili says:

        @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.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.