TurnKey Linux Virtual Appliance Library

Creating a bootable USB drive from an ISO image

What's an ISO?

ISO, short for ISO9660 is the standard filesystem format for optical disc media. This is the default format created by the TurnKey GNU/Linux build system (AKA TKLDev)

Why would you want to write an ISO to a USB drive?

Typically one of two reasons:

  1. Compatibility: You want to boot the ISO on a physical computer that doesn't have a CD drive.

    Originally ISO files were intended to be burned to physical CDROM discs. Unfortunately while most virtualization software (e.g., KVM, VMWare, VirtualBox) has support for inserting ISO images into "virtual" CD readers, physical CD readers are a dying breed.
  2. Convenience: USB flash drives are smaller, faster, rewriteable and more robust than a clumsy, flat, scratchable CD.

Using isohybrid + dd

The isohybrid tool in the syslinux package will convert ISO images into a USB flash drive compatible format:

# apt-get install syslinux
# isohybrid path/to/image.iso

Use lsblk to identify the device path (e.g., /dev/sdX) of your USB drive:

# lsblk
sde                                     8:64   1   7.4G  0 disk  
└─sde1                                  8:65   1   7.4G  0 part  /media/usbdrive

If it's been automounted, as is the case above, unmount it first:

# umount /media/usbdrive

Use dd to write the ISO image to the disk path. That's /dev/sde NOT /dev/sde1:

dd if=path/to/image.iso of=/dev/sde
Things to keep in mind:
  • Root access is required: You will need to perform the above commands as root. On Ubuntu prepend the commands with sudo (e.g., sudo apt-get install syslinux)
  • dd will completely overwrite your USB drive: Any data on it will be lost so if you use this method you'll want to use it with a dedicated USB device.
  • dd needs to write to the disk path, not the partition path: in the above example /dev/sde is the disk path device, /dev/sde1 is the partition path (e.g., sde1 is the first partition on sde). You need to write to the disk path because isohybrid prepends a partition structure to the ISO.

How isohybrid works

Starting in version 3.72, ISOLINUX supports a "hybrid mode" which can be booted from either CD-ROM or from a device which BIOS considers a hard disk or ZIP disk, e.g. a USB key or similar.  These isohybrid images contain in addition to the normal CD-based ISO9660 filesystem, a valid-looking DOS-style partition table. So if you simply "raw" copy an isohybrid processed image to a USB flash drive, the BIOS will boot the image directly.

iso2usb.py helper script

The 'dd' command has always scared me. One wrong keystroke and you can overwrite the wrong hard disk. To make things a little less scary and safer, I wrote iso2usb:
Syntax: iso2usb.py iso_path usb_device
iso2usb: Create a bootable USB flash drive containing ISO image

    iso_path        Path to ISO (e.g., product.iso)
    usb_device      USB device path (e.g., /dev/sdc)

    --force         Not implemented, interactive confirmation required
iso2usb will do its best to verify that the usb_device is actually a USB device, and prompt for confirmation with device information before doing anything dangerous:
# iso2usb.py turnkey-core-13.0-wheezy-amd64.iso /dev/sdc
iso: turnkey-core-13.0-wheezy-amd64.iso (hybrid: False)
usb: disk/by-id/usb-SanDisk_Cruzer_Blade_200601650311ADD19323-0:0 (/dev/sdc)
Is the above correct? (y/N):

Additionally, iso2usb will check whether the ISO image has been pre-processed with isohybrid, and if not it will process the image before writing it. 

Once completed, the USB flash drive should now boot directly, showing exactly the same bootup screen as if you'd written the image directly to a CD.

The old pre-isohybrid version of iso2usb

If for some reason your ISO isn't using ISOLINUX as the bootloader you might want to try the old pre-isohybrid version of the iso2usb.py script which I wrote a few years ago. It extracts the ISO to the USB drive together and then installs syslinux. Recently I tried using it but hit issues related to changes in isolinux, which has since introduced the new isohybrid method.

The future

All future TurnKey ISO's will be pre-processed with isohybrid, making it that little bit more TurnKey for installing ISO's to USB flash disks.

You can get future posts delivered by email or good old-fashioned RSS.
TurnKey also has a presence on Google+, Twitter and Facebook.


Nice...I've been looking for a portable apps alternative

Thanks Alon. Much appreciated.

I've been providing clients with a dashboard based on portableapps.com with mixed satisfaction. The portableapps model requires the apps to be stripped down to work in the framework. Getting up-to-date apps and then having no decent support model when the apps don't work is less than ideal.

I like the idea of a mini LXC-based Turnkey linux to deploy dashboards & dev environments to my clients.

Should be good :-)

FYI - Minor typo...your script link label says usb2iso rather than iso2usb.


Tim (Managing Director - OnePressTech)

Alon Swartz's picture

Glad you find it useful...

Glad you'll find it useful! The idea of using TurnKey LXC with pre-cached images sounds very interesting indeed.

I personally use it as I've swapped out my laptops CD drive for a second harddrive to compliment my SSD, and I thought it would make sense to share what I've done, as well as pre-process all future ISO's for hybrid mode...

Great post Alan!

Great post Alan!  Flash drives aren't just faster and re-usable (compared to CD drives) they’re also smaller. Occupy less space. One can also send the data on flash drives with the busines logo etc on it. 

Interesting, but I've gotten by with only dd

This is interesting because I've always gotten away with dd'ing the ISO to the USB drive directly, without converting the ISO first.


Although, could it simply be that Ubuntu, Debian, and Mint release their ISOs as hybrids to begin with?

Jeremy's picture

They must be hybrid ISO to start with

AFAIK Ubuntu have been producing hybrid ISOs for quite some time now. I would assume that Mint (as an Ubuntu derivative) has also been doing that. Debian OTOH haven't been doing it quite so long but at least since Wheezy. So I guess you've just been lucky! :)

isohybrid is in the syslinux-utils package starting with jessie

In case this helps anyone, you'll need to install syslinux-utils instead of syslinux starting with Debian jessie (a.ka. "testing" at the time of writing, soon to be stable).  See: https://packages.debian.org/search?suite=jessie&arch=any&mode=exactfilename&searchon=contents&keywords=isohybrid



Thank you very much for this very useful guide and for the script as well!



how to restore USB?


I have created a USB bootable as per the above mentioned the method.

But now, the USB disk is not usable for data storage.

How can I make it a FAT32 system again?




Jeremy's picture

Format it! :)

Format it! :)

Useful guide

Thanks for this wonderful article... very useful guide.. See different styles of Bulk USB Flash drives  :


Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)