Make an ISO image from a folder of files

ISO image files are everywhere. When you download a new Linux distribution, you'll probably be given one of these files which you then burn the contents of to disc. You aren't just restricted to burning them, though, and it's actually a really simple process to make your own ISO images.

First of all, why manually create an ISO image, when you can just use pretty burning software such as Gnomebaker or K3B to build a disc or an image for you? Well, creating the ISO yourself gives you ultimate control (if you want to later venture into more advanced features) and it's always good to know the command line way of doing things too.

Before we do anything else, we need to ensure that the mkisofs program is actually installed on your machine. On my Ubuntu 7.04 machine here, it wasn't. Quickly run this to verify:

$ mkisofs --version

If that command returns a version number or something indicating it's installed, you're good to go. If not, head over to your package manager and search for and install mkisofs.

It is surprisingly easy to do. First of all, you just need to assemble a folder full of the files you wish to be part of the ISO image. In this example, I'm going to assume that folder is named iso.

$ mkdir iso
$ cd iso
[[copy the desired files into the iso folder]]

Once you've got the files you want loaded up, we're going to go back up and out of the iso directory, then use the mkisofs program to make the image:

$ cd ..
$ mkisofs -o myimage.iso iso

It really is that simple. You should now have a ISO image which you are free to burn, store or do whatever you want with. Note that the ISO9660 filesystem (that is used for CDs) does not support the permissions or ownership of your files, so this information will be lost in the ISO image. Bear that in mind if you're backing up data to a CD where permissions are important (consider making a tar archive first if necessary).

It is possible to get a lot more complex and add functionality such as booting from your disc as well. I won't cover that here this time, but use man mkisofs for more information.

To be completely technically accurate here, Ubuntu ships with genisoimage, not mkisofs, but for the purposes of the tutorial, they work the same way so it doesn't really matter.

Avatar for peter Peter Upfold - http://peter.upfold.org.uk/

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Make an ISO image from a folder of files

  1. anoop (guest)

    # Posted on 29 April 2009 at 03:07 AM

    using poweriso to make folder image



Home » Articles » Make an ISO image from a folder of files