Walker News

How To Create An ISO Image Of Directory / Filesystem In Linux

Another post related to CD image and Linux system. Do you know there is a simple and efficient Linux command line program to create ISO image of a directory or filesystem?

Most Linux distributions, including RHEL4 that power my aging HP NetServer come with a mkisofs package.

The mkisofs package comprises of few tiny but really useful programs to deal with CD image, i.e. isodebug, isodump, isoinfo, isovfy, mkhybrid, and mkisofs.

Out of all these programs, mkisofs is particularly useful in this post, i.e. its ability to efficiently create CD image of directories or filesystem in Linux.

This is not about creating ISO image from a CD-ROM, which can be easily accomplished with dd command (a simple, legacy command in most Linux/Unix system).
Some of the points to dump a directory content into an ISO image format:
  1. You could easily burn the ISO image format of directory content onto a CD-ROM
  2. It’s much efficient to manage the ISO image of directories that contain few thousands of tiny files, either to transfer it over the network (via scp command, ftp protocol, shfs system, samba file sharing, etc) or copy between local filesystem, as there is less overheat of maintaining transfer status for those few thousands files in the session.

Simple example of using mkisofs

For example, to dump the content of DB2 Workgroup v81 directory into a standard CD ISO-9660 filesystem image with file name called DB2Wkg.iso:
mkisofs -o DB2Wkg81.iso DB2Wkg81

To create CD ISO image of directories that contain long file name or non-8.3 format (particularly if you want to burn the CD image for use in Windows system), use the -J option switch that generates Joliet directory records in addition to regular iso9660 file names. For example, to create CD image of Vista SP1 directory:
mkisofs -o VitaSP1.iso -J VistaSP1

In my test, mkisofs takes less than 10 seconds to dump a directory that contains 4870 files totalled to 328MB.

Custom Search

  1. Ahmad 27-12-08@05:42

    Thanks…i was looking for this tips :D

  2. hugogee 28-01-11@07:25

    Thanks homie!! nice tip.

  3. michan 02-12-11@23:57

    It’s replaced by genisoimage on Debian.

  4. Andre Luiz 30-07-14@14:53

    very usefull. Thank you, man!

2017  •  Privacy Policy