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! :)

wait a sec

After the umount step, I try to use dd like you say and it gives me the error: 


dd: opening `/dev/sde': No medium found

The "e" is variable

Did you do the lsblk command to see your devices?

On my computer, it was sdb not sde.

I'm guessing your device is something other than e.


Otherwise, perhaps the udb drive is not being recognized at all.

L. Arnold's picture

Still a way to get ISOLINUX working again with TKLDEV Wheezy 64?

trying to build some 64 Bit systems both in Jessie and Wheezy.

Wheezy 64 TKLDEV Fails "can't find ISOLINUX" no matter what.  For some reason 386 / 32 Version of Wheezy TKLDEV does not.

Working forward on Jessie but so many other changes in terms of SSL/Apache that wanted to at least get a working system on that level for app tuning.

Seems it would be good that Wheezy TKLDEV works as most people are working with Wheezy still.  (Broken record I know... but working forward on Jessie too).


References to IsoLinux



syslinux-common # Collection of bootloaders (common)


isolinux # Collection of bootloaders (ISO 9960 bootloader)


Quite a few in




Showing the top three matches. Last indexed on Jul 19, 2014.


[ -d $rootfs ] || fatal "no such directory: $rootfs"




echo "# preparing cdroot"


mkdir -p $cdroot/casper


mkdir -p $cdroot/isolinux




if [ ! -f $cdroot/isolinux/isolinux.cfg ]; then




DEFAULT /casper/vmlinuz boot=casper initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram rw showmounts debug toram=196 --


Showing the top three matches. Last indexed on Jul 19, 2014.


genisoimage -o $newimage -r -J -l \




-b isolinux/isolinux.bin \


-c isolinux/boot.cat \


Showing the top two matches. Last indexed on Jul 19, 2014.


echo "# extracting root filesystem and isolinux from ISO"


mkdir -p $cdroot


mkdir -p $name.mount


mount -o loop $isofile $name.mount



unsquashfs -d $rootfs $name.mount/casper/*root.squashfs


cp -a $name.mount/isolinux $cdroot/

Showing the top match. Last indexed on Jul 19, 2014.


- if cdroot-dir is not provided, a minimal isolinux.cfg will be created


to automatically boot the image






* added support for configuration hooks (advanced usage)


then only One in



found: docs/helloworld.rst 


cp build/root.sandbox/usr/lib/syslinux/isolinux.bin build/cdroot/isolinux


cp build/root.sandbox/boot/vmlinuz-3.2.0-4-amd64 build/cdroot/casper/vmlinuz



root (0)


genisoimage -o build/product.iso -r -J -l -V core -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table build/cdroot/


Thank you very much!

Burn ISO Image File to USB Drive

Nice post,thanks for sharing!There also is a post that would show you how to burn an ISO to USB drive or/and copy ISO to USB flash drive for data storage only, rather than creating ISO to bootable USB flash drive.

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)