Writing CD's under Red Hat Linux 6.2: Step One - Making the ISO file
This document will give a brief description on how to create an image file (the ISO file) that will be used to burn a CD. Remember that this is only a short description on how to make simple ISO files. The man page for mkisofs defines all of the command line switches that can be used.
Create an ISO image using mkisofs 1.12 (i686-pc-linux-gnu)
An ISO image can be created from a single directory tree (the simplest method). An ISO image can also be created with files and directories that are not in the main directory. I will present these cases via examples.
Single directory method:
This is the mkisofs command line for the creation of a simple ISO file:
mkisofs -T -r -o filename.iso pathname/
where -o filename.iso - is the name of the ISO file that will be created pathname/ - is the path to the directory where all of the files are kept -r - is the command line switch used to generate Rock Ridge extensions (same as -R but with some more useful file ownership and mode values) -T - is the command line switch that generates the file TRANS.TBL, in each directory on the CD. These files help systems that are non-Rock Ridge compatible to see the correct file names
This is the mkisofs command line for the creation of an ISO file where the source files are in the main directory (pathname/) and in other directories (~/somedir/foo/ and ~/somedir2/bar/ in this case).
mkisofs -T -r -o filename.iso pathname/ \ pathname/subpath/=~/somedir/foo/ \ pathname/subpath2/=~/somedir2/bar/
The syntax on this command line (all on one line; here the backslash \ indicates to the bash shell to continue the line) shows data in two other directories being included. They will be included in their own subdirectories in the file structure that will be created based in the main directory (pathname/). Make sure the subdirectories in the main directory exist before you run the command.
This example is from the time I made a backup of assorted files from machines I had mounted via NFS. The command line I used to create the file was (all one line):
mkisofs -T -r -o backup-20010208.iso \ data-backup-20010208/home/=home/ \ data-backup-20010208/petar/=petar/ \ data-backup-20010208/nsmail/=nsmail/ \ data-backup-20010208/old-bilbo-home-petar/=/mnt/ttt/home/petar/ \ data-backup-20010208/nsmail-frodo-20010208/=nsmail-frodo-20010208/
where the directory backup-20010208/ and its sub-directories home/, petar/ old-bilbo-home-petar/, nsmail/, and nsmail-frodo-20010208/ were already created.
The directory structure on the CD will be
$CDMOUNT/data-backup-20010208/ $CDMOUNT/data-backup-20010208/home/ $CDMOUNT/data-backup-20010208/petar/ $CDMOUNT/data-backup-20010208/nsmail/ $CDMOUNT/data-backup-20010208/old-bilbo-home-petar/ $CDMOUNT/data-backup-20010208/nsmail-frodo-20010208/
where $CDMOUNT is the mount location of the CD. On my Linux system $CDMOUNT will be /mnt/cdrom and therefore I would see /mnt/cdrom/data-backup-20010208/, etc. And on my MS Windows machine I would see E:\data-backup-20010208\, etc.
Multiple directories and extra files:
This is the mkisofs command line for the creation of an ISO file where the source files are in the multiple directories as well as other individual files.
mkisofs -T -r -o filename.iso pathname/ \ pathname/subpath/=~/foo/fred/ \ pathname/subpath2/=~/bar/wilma/ \ pathname/subpath3/=~/bedrock/barney.txt \ pathname/subpath4/rockvegas.doc=~/bedrock/betty.txt
The syntax on this command line shows data in two other directories and two files being included. The file barney.txt will be included under the directory subpath3/ in the ISO file and the file betty.txt will be included under subpath4/ as rockvegas.doc.
(C) 2001 Petar Knezevich
Every attempt has been made to ensure that the information presented in this mini-HOWTO is safe and accurate. However, this information is given without any warranty, either expressed or implied, as to its suitability for a particular use. It is generally considered a GoodThing(TM) to make backups of your system files before changing system configurations and/or files. I suggest you take this precaution "just in case".