To create a CD image, you first select the files you want on your CD. Then you can use mkisofs to create an ISO CD image of them.

mkisofs Options

You may need to include several important options with mkisofs to create a data CD properly. The -o option is used to specify the name of the CD image file. This can be any name you want to give it. The -R option specifies RockRidge CD protocols, and the -J option provides for long Windows 95/98/ME or XP names. The -r option, in addition to the RockRidge protocols (-R), sets standard global permissions for your files, such as read access for all users and no write access because the CD-ROM is read-only. The -T option creates translation tables for filenames for use on systems that are not RockRidge compliant.

The -U option provides for relaxed filenames that are not standard ISO compliant, such as long filenames, those with more than one period in their name, those that begin with a period such as shell configuration files, and ones that use lowercase characters (there are also separate options for each of these features if you just want to use a few of them). Most RPM and source code package names fall in this category. The -iso-level option lets you remove ISO restrictions such as the length of a filename. The -V option sets the volume label (name) for the CD. Finally, the -v option displays the progress of the image creation.

Disk Image Creation

The last argument is the directory that contains the files for which you want to make the CD image. For this, you can specify a directory. For example, if you are creating a CD-ROM to contain the data files in the mydocs directory, you would specify that directory. This top directory will not be included, just the files and subdirectories in it. You can also change to that directory and then use . to indicate the current directory.

If you were creating a simple CD to use on Linux, you would use mkisofs to first create the CD image. Here the verbose option will show the creation progress, and the -V option lets you specify the CD label. A CD image called songs.iso is created using the file located in the newsong directory:

mkisofs -v -V "Goodsongs" -o moresongs.iso newsongs

If you also wanted to use the CD on a Windows system, you would add the -r (RockRidge with standard global file access) and - J (Joliet) options:

mkisofs -v -r -J -V "Goodsongs" -o moresongs.iso newsongs

You need to include certain options if you are using filenames that are not ISO compliant, such as ones with more than 31 characters or ones that use lowercase characters. The -U option lets you use completely unrestricted filenames, whereas certain options like -L for the unrestricted length will release specific restrictions only. The following example creates a CD image called mydoc.iso using the files and subdirectories located in the mdoc directory and labels the CD image with the name "Greatdocs":

mkisofs -v -r -T -J -U -V "Greatdocs" -o mydocuments.iso mydocs

Mounting Disk Images

Once you have created your CD image, you can check to see if it is correct by mounting it as a file system on your Linux system. In effect, to test the CD image, you mount it to a directory and then access it as if it were simply another file system. Mounting a CD image requires the use of a loop device. Specify the loop device with the loop option as shown in the next example. Here the mydoc.iso is mounted to the /media/cdrom directory as a file system of type iso9660. Be sure to unmount it when you finish.

mount -t iso9660 -o ro,loop=/dev/loop0 mydocuments.iso /media/cdrom

Bootable CD-ROMs

If you are creating a bootable CD-ROM, you need to indicate the boot image file to use and the boot catalog. With the -c option, you specify the boot catalog. With the -b option, you specify the boot image. The boot image is a boot disk image, like that used to start up an installation procedure. For example, on the Fedora CD-ROM, the boot image is isolinux/ isolinux.bin, and the boot catalog is isolinux/ (you can also use images/boot.img. and Copy those files to your hard disk. The following example creates a bootable CD-ROM image using Red Hat Linux and Fedora distribution files located on the CD-ROM drive.

mkisofs -o rd8-0.iso -b isolinux/isolinux.bin -c isolinux/ \ -no-emul-boot -boot-load-size 4 -boot-info-table \ -v -r -R -T -J -V "Fed4" /media/cdrom

0 0

Post a comment