Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently discovered that I can create a bootable USB key from an ISO file by simply using cat (or dd).

I can't find any information on how this works. Why would:

cat my.iso > /dev/sdb && sync

take that file and write all the files it contains, in bootable format, to a device?

share|improve this question
I've never thought to use cat in place of dd when making liveUSBs – Rob Feb 13 '12 at 19:51
It was in the instructions for "Tails", the live Tor image. I did a little googling (before asking here) and it seems that dd was what people used to use for this sort of thing, but cat seems to be the preferred tool now. I guess it's easier as you don't have to bother specifying named parameters for input/output details. – Alex Feb 13 '12 at 22:51
up vote 12 down vote accepted

An ISO file is a complete, formatted filesystem image. All cat or dd does is do a bit-for-bit copy of that filesystem image to your target media.

There is no magic going on behind the scenes. The ISO filesystem preparation was done beforehand (often by a specialized tool). All cat does is write that collection of bytes out. It doesn't interpret the .iso at all, nor does it understand that it's trying to create a bootable removable medium at all.
It does require proper support from the kernel and device driver to make the writes work on that media. A bit of "magic" goes on there, since writable optical media don't operate exactly the same way as conventional hard drives. But that magic doesn't involve interpreting the contents of the ISO file.

You could mount the .iso file directly without burning it by using a loop mount (if such a thing is available on your OS). Similarly, you can create a file that contains for instance an ext4 filesystem, and you could cat that to a partition.

share|improve this answer
and then simply make sure the data have really written to you partition (instead of just bufferred) – yuyichao Feb 13 '12 at 13:07

This works because the iso image was processed withisohybrid, which installs a normal syslinux boot loader into the iso image. This is possible because iso9660 does not normally use the first few sectors of the image, so a more or less normal hard disk boot loader can be placed there. When burned to an optical disk, it is ignored and the bios boots the disc using the conventional el torito cdrom boot method. When the image is placed on a flash drive, the syslinux boot sector is loaded.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.