Книга: Fedora™ Unleashed, 2008 edition

Creating CDs from the Command Line

Creating CDs from the Command Line

In Linux, creating a CD at the command line is a two-step process. You first create the iso9660-formatted image, and you then burn or write the image onto the CD. The iso9660, as you will learn in Chapter 35, "Managing the File System," is the default file system for CD-ROMs.

Use the mkisofs command to create the ISO image. The mkisofs command has many options (see the man page for a full listing), but use the following for quick burns:

$ mkisofs -r -v -J -l -o /tmp/our_special_cd.iso /source_directory

The options used in this example are as follows:

-r — Sets the permission of the files to more useful values. UID and GID (individual and group user ID requirements) are set to zero, all files are globally readable and searchable, and all files are set as executable (for Windows systems).

-v — Displays verbose messages (rather than terse messages) so that you can see what is occurring during the process; these messages can help you resolve problems if they occur.

-J — Uses the Joliet extensions to ISO9660 so that your Windows-using buddies can more easily read the CD. The Joliet (for Windows), Rock Ridge (for Unix), and HSF (for Mac) extensions to the iso9660 standard are used to accommodate long filenames rather than the eight-character DOS filenames that the iso9660 standard supports.

-l — Allows 31-character filenames; DOS does not like it, but everyone else does.

-o — Defines the directory where the image will be written (that is, the output) and its name. The /tmp directory is convenient for this purpose, but the image could go anywhere you have write permissions.

/source_directory — Indicates the path to the source directory; that is, the directory containing the files you want to include. There are ways to append additional paths and exclude directories (and files) under the specified path—it is all explained in the man page, if you need that level of complexity. The simple solution is to construct a new directory tree and populate it with the files you want to copy, and then make the image using that directory as the source.

Many more options are available, including options to make the CD bootable.

After you have created the ISO image, you can write it to the CD with the cdrecord command:

$ cdrecord -eject -v speed=12 dev=0,0,0 /tmp/our_special_cd.iso

The options used in this example are as follows:

-eject — Ejects the CD when the write operation is finished.

-v — Displays verbose messages.

speed= — Sets the speed; the rate depends on the individual drive's capabilities. If the drive or the recordable medium is poor, you can use lower speeds to get a good burn.

dev= — Specifies the device number of the CD writer (the number I told you to write down earlier).


You can also use the blank= option with the cdrecord command to erase CD-RW disks. The cdrecord command has fewer options than mkisofs does, but it offers the -multi option, which enables you to make multisession CDs. A multisession CD enables you to write a data track, quit, and then add more data to the CD later. A single-session CD can be written to only once; any leftover CD capacity is wasted. Read about other options in the cdrecord man page.

Current capacity for CD media is 700MB of data or 80 minutes of music. (There are 800MB/90 minute CDs, but they are rare.) Some CDs can be overburned; that is, recorded to a capacity in excess of the standard. The cdrecord command is capable of overburning if your CD-RW drive supports it. You can learn more about overburning CDs athttp://www.cdmediaworld.com/hardware/cdrom/cd_oversize.shtml/.

Оглавление книги

Генерация: 1.074. Запросов К БД/Cache: 3 / 1
Вверх Вниз