Mounting ISO images in Linux

CD-ROMs are often distributed (or pirated) digitally in the form of ISO images. Like a .zip or .tar file, an ISO image encapsulates a collection of files. The main difference is that an ISO image contains specific information about how those files are laid out on a CD-ROM. After you have acquired an ISO image, you can access its files immediately, even before you burn it onto a CD-ROM. These notes explain how.

You probably need to be root to do all of this.

1.To mount the image, simply issue the following command:

mount -t iso9660 -o loop image.iso /mnt/isoimage

where image.iso is the filename of the ISO image and /mnt/isoimage is the directory under which you want the ISO's files to appear (create it if necessary).

After doing this, you will be able to navigate through the ISO's files, starting from /mnt/isoimage, just as you would any other files in your file system, but with one exception: all of the files and directories mounted from the ISO will be read-only.

When you are finished looking at the files, unmount the ISO with

umount /mnt/isoimage

Creating an ISO image using mkisofs

If you need to generate your own ISO, mkisofs is a great tool for doing it. You don't need fancy tools or GUI front ends to use it, either (though you may wish to employ your favorite graphical file manager). Just follow these simple steps:

1.

Create a temporary directory from which the ISO's files will be read.
2.

Insert files into that directory and arrange them in the manner you would like them to appear in the ISO.
3.

From a directory outside of the tempoary ISO directory, run the following command:

mkisofs -f -R -r -l -J -Vvolid -Aappid -Ppubid -odest.iso src

where

volid
is the volume ID to be written into the master block;
appid
describes the application contained within the ISO;
pubid
names the publisher of the ISO (CD-ROM), usually including adequate contact information, such as a phone number or email address;
dest.iso
is the destination filename of the newly created ISO image;
src
is the temporary ISO directory containing the files and file structure you wish to have included in the ISO image.

4.

These parameters are good defaults. You can customize them, however. For more information, see man mkisofs.

Writing an ISO to a CD-ROM using cdrecord

Assuming that all you want to do is create a CD based on the ISO 9660 file system standard, you can quickly burn the CD using the following command:

cdrecord -v -pad speed=1 dev=0,0,0 src.iso

src.iso is the source filename of the ISO you are burning to the CD-ROM.

You may need to adjust the dev parameter if you are not burning with an IDE drive or you did not follow the instructions given in Configuring an IDE/ATAPI CD-ROM burner in RedHat Linux 6.1.

If you want, you can take the ISO image from stdin by replacing the filename with a hyphen ("-"). This works well with mkisofs if you replace the output image filename to that command with a hyphen also. Then you can chain the two commands together using a standard Unix pipe. Burning CD-ROMs in this manner reduces the total amount of temporary storage you will need, which may be useful if you are low on disk space.

Burning Audio CDs using cdrecord

Burning audio CDs using cdrecord is a piece of cake, too. Just follow these steps:

1.

Create your audio tracks and store them as uncompressed, 16-bit stereo .wav files.
2.

Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as 01.wav, 02.wav, 03.wav, etc.
3.

Change into the directory containing the wave files and make sure there are not any wave files you do not want included in the CD.
4.

With a blank CD in your burner, issue the following command:

cdrecord -v -pad speed=1 dev=0,0,0 -dao -audio -swab *.wav

Again, you may need to adjust your dev parameter as mentioned earlier.

No comments:

Post a Comment