CD-ROM and DVD ROM Recording

 < Day Day Up > 



Recording data to CD-ROM disks on Linux involves creating a CD image file of the CD-ROM, and then writing that image file to a CD-R or CD-RW disc in your CD-R/RW drive. With the mkisofs command, you can create a CD image file, which you can then write to a CD-R/RW write device. Once you create your CD image file, you can write it to a CD-write device, using the cdrecord or cdwrite application. The cdrecord application is a more powerful application with many options. You can also use GNOME and KDE CD recording applications such as KOnCD and GNOME Toaster to create your CDs easily. Most are front ends to the mkisofs and cdrecord tools. To record DVD disks on DVD writers, you can use dvdrecord (the counterpart to cdrecord) for DVD-R/RW drives and the dvd+rw tools for DVD+RW/R drives. If you want to record CD-ROMs on a DVD writer, you can just use cdrecord.

The dvdrecord application currently works only on DVD-R/RW drives; it is part of the dvdrtools package. If you want to use DVD+RW/R drives, you would use the dvd+rw tools such as growisofs and dvd+rw-format. dvd+rw tools are included on Red Hat in the dvd+rw-tools package. Check the DVD+RW tools Web site for more information, http://fy.chalmers.se/~appro/linux/DVD+RW.

mkisofs

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 "doc":

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 /mnt/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 /mnt/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 Red Hat CD-ROM, the boot image is isolinux/isolinux.bin, and the boot catalog is isolinux/boot.cat (you can also use images/boot.img. and boot.cat). Copy those files to your hard disk. The following example creates a bootable CD-ROM image using Red Hat distribution files located on the CD-ROM drive.

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

cdrecord and dvdrecord

Once mkisofs has created the CD image file, you can use cdrecord or cdwrite to write it to a CD write disc. If you have more than one CD-writer device, you should specify the CD-R/RW drive to use by indicating its SCSI bus number (recall that even IDE CD-R/RW drives are treated as SCSI devices on Linux). You can use cdrecord with the -scanbus option to find out the SCSI numbers of your rewritable devices. In this example, as shown previously in the -scanbus example, the device number for the rewritable CD-RW drive is 0,0. The dev= option is used to indicate this drive. The final argument for cdrecord is the name of the CD image file. dvdrecord works the same way on DVD-R/RW writers and is in fact an extension of cdrecord.

cdrecord  dev=0,0  mydocuments.iso

If you are creating an audio CD, use the -audio option, as shown here. This option uses the CD-DA audio format:

cdrecord  dev=0,0 -audio moresongs.iso

Similar operations apply to dvdrecord, except that dvdrecord will write to a DVD-R disc on a DVD-R recorder.

Tip 

The dummy option for cdrecord lets you test the CD writing operation for a given image.

dvd+rw Tools

The primary dvd+rw tool is growisofs, with which you create DVD+RW/R disks. Two other minor supporting tools are also included, a formatter, dvd+rw-format, and a compatibility tool, dvd+rw-booktype. See the dvd+rw-tools page in /usr/share/doc for detailed instructions.

The growisofs tool functions like the mkisofs tool, except that it writes directly to the DVD+RW/R disc, rather than to an image. It has the same options as mkisofs, with a few exceptions, and is actually a front end to the mkisofs command. There is, of course, no -o option for specifying a disk image. You specify the DVD device instead. For example, to write the contents of the newsongs directory to a DVD+RW disc, you would use growisofs directly.

growisofs -v -V "Goodsongs" -Z /dev/scd0  newsongs

The device is specified by its name, usually /dev/scd0 for the first SCSII device. Recall that IDE DVD writers are configured as SCSI devices by the ide-scsi module when your system boots up. growisofs provides a special -Z option for burning an initial session. For multi-sessions (DVD-RW), you can use the mkisofs -M option. If you want to reuse a DVD-RW disc, just overwrite it. You do not have to reformat it.

To burn an ISO image file to the disc, use the -Z option and assign the iso image to the device.

growisofs -v -V "Goodsongs" -Z /dev/scd0=moresongs.iso

Though growisofs will automatically format new DVD+RW disks, the dvd+rw tools also include the dvd+rw-format tool for explicitly performing formats only. You use the dvd+rw-format tool only to explicitly format new DVD+RW (read/write) disks, preparing them for writing. This is done only once, and only for DVD+RW disks that have never been used before. DVD+R discs do not need any formatting.

The dvd+rw-booktype tool sets the compatibility setting for older DVD-ROM readers that may not be able to read DVD+RW/R disks.



 < Day Day Up > 



Red Hat(c) The Complete Reference
Red Hat Enterprise Linux & Fedora Edition (DVD): The Complete Reference
ISBN: 0072230754
EAN: 2147483647
Year: 2004
Pages: 328

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net