CD-writable (CD-R) drives have grown in popularity as an inexpensive way to back up and archive data, including applications, personal files, and even multimedia (audio/video and still image) presentations. Red Hat Linux includes several tools for using CD-Rs and CD-rewritable (CD-RW) drives.
X-CD-Roast is a graphical application for duplicating and creating (mastering) CD-ROMs. X-CD-Roast automates the process of burning CD-Rs and CD-RWs and is highly configurable to many CD mastering or duplicating needs.
To start X-CD-Roast, choose Main Menu > System Tools > CD Writer. To start it at a shell prompt, type /usr/bin/xcdroast. X-CD-Roast will first scan your device busses and find your CD-R(W) drive. It will then allow you to configure settings for CD-writer, CD-ROM drive, and more.
Figure 7-7 illustrates the Setup screen and its configuration options. Note that your CD-R(W) drive brand may be different from the drive shown.
Check your CD-R(W) manufacturer documentation to set some of the CD Settings options, such as CD Writer Speed and CD Writer FIFO-Buffer Size. All CD image (.iso or .img) files need to be stored in a central location accessible to X-CD-Roast. You will have to specify a path on your hard drive's file system that has at least 700MB of free space available. You can configure the path where you wish to store CD images in the HD Settings tab under Path.
X-CD-Roast is well documented within the interface itself, as several of the options have long, descriptive pop-up tips that inform you of the associated function in detail. You can access these tooltips by leaving your mouse pointer on a button or drop-down menu for at least two seconds.
To duplicate an existing CD-ROM for backup purposes, click the Duplicate CD button in the main panel. You can read all of the tracks on a CD — all CD-ROM information, including data and audio, is stored on tracks — by clicking Read CD. You can set the speed at which you read a CD-ROM as well as find out some information about the CD-ROM track such as its type and size. If you are copying tracks from an audio CD, you can preview each track with Play Audio-Tracks. Because X-CD-Roast reads all tracks of a CD-ROM by default, you can delete unwanted tracks with Delete Tracks.
Finally, to burn your tracks onto CD-R(W) media, choose Write CD. Figure 7-8 shows the Write CD dialog box where you can configure the speed at which you read and write the tracks to CD-R as well as whether you wish to copy the CD-ROM on-the-fly or create an image file first before burning, which is recommended to prevent write or read errors from occurring during the duplication process.
Click the Write CD button to start the burning process.
Figure 7-8. Using X-CD-Roast to Duplicate CDs
You should always back up personal data and information often in case of hardware failure or file system corruption. X-CD-Roast allows you to backup files on your hard drive partition using Create CD. This facility allows you to add files and directories into a CD session using Master Tracks.
There are other options within the Master Tracks dialog that allows you to configure advanced settings; however, the defaults are set correctly to create data CD-ROMs, so no further configuration is necessary. Figure 7-9 shows a session that is preparing the entire /home directory for backup.
Figure 7-9. Using X-CD-Roast to Back Up Hard Drive Files
Highlight the files and directories that you wish to add to the session and click Add. After you have added all the files and directories you want to write to the CD-R(W), click the Create session/image tab to create the .img file. You must first click Calculate size and then Master to image file to create the image.
To write your tracks to the CD-R(W), click Write Tracks from the panel on the left. In the Layout Tracks tab, highlight the image file you created in the box on the right, and click Add. The image will be displayed in the Tracks to write box on the left side. Click Accept track layout, and click the Write Tracks tab to return to the main writing dialog. Click Write tracks to write the image to the CD-R(W).
Large files that end in .iso are known as ISO9660 (or ISO) image files. For example, Red Hat Linux is freely available as ISO images that you can download and write to the CD-R(W). There are other ISO image files available on FTP and websites. There are other file types that can be burned as images, such as .img and .raw, but ISO images are the most common CD image format.
To write an ISO image file to a CD-R(W) with X-CD-Roast, move the ISO file to the path specified during setup and then click Create CD. In the Layout tracks tab, highlight the ISO image file you wish to burn and click Add, then Accept track layout. This will automatically load the Write Tracks tab where you can click Write Tracks to burn the image to the CD-R(W).
If you want to use a shell prompt to write images to CD-R or CD-RWs, there are two utilities available: mkisofs and cdrecord. These two utilities have several advanced options that are beyond the scope of this guide; however, for basic image creation and writing, these tools save some time over the graphical alternatives such as X-CD-Roast, and so we discuss them briefly in the following sections.
The mkisofs utility creates ISO9660 image files that can be written to a CD-R(RW). The images that mkisofs creates can be made up of all types of files. It is most useful for archival and file backup purposes.
Suppose you wish to backup a directory called /home/joeuser/, but you wish to exclude the subdirectory /home/joeuser/junk/ because it contains unnecessary files. You want to create an ISO image called backup.iso and write it to CD-R so that you can use it on your Red Hat Linux PC at work and your Windows laptop for trips. This can be done with mkisofs by running the following command:
mkisofs -o backup.iso -x /home/jouser/junk/ -J -R -A -V -v /home/joeuser/
The image will be created in the directory you were in when you ran the command. Table 7-1 explains each command-line option. For more information on using mkisofs, refer to the additional resources in the “Additional Resources” section later in this chapter.
You can now use the ISO image file with either X-CD-Roast as described in the “Using X-CD-Roast” section earlier in this chapter, or by using cdrecord, the command-line-based CD recording utility. For more information about using cdrecord, see the next section.
Specify an output filename of the ISO image.
Generate Joliet naming records; useful if the CD will be used in Windows environments.
Generate Rock Ridge (RR) naming records to preserve filename length and casing, especially for UNIX/Linux environments.
Set an Application ID — a text string that will be written into the volume header of the image that can be useful to determine what applications are on the CD.
Set a Volume ID — a name that will be assigned to it if the image is burned and the disc is mounted in Solaris and Windows environments.
Set verbose execution, which is useful for viewing the status of the image as it is being made.
Exclude any directory immediately following this option; this option can be repeated (for example, ... -x /home/joe/trash –x /home/joe/delete ...).
The cdrecord utility writes audio, data, and mixed-mode (a combination of audio, video, and/or data) CD-ROMs using options to configure several aspects of the write process, including speed, device, and data settings.
To use cdrecord, you must first establish the device address of your CD-R(W) device by running the following command as root at a shell prompt:
This command will show all CD-R(W) devices on your computer. Remember the device address of the device you will use to write your CD. The following is an example output from running cdrecord:
-scanbus. Cdrecord 1.8 (i686-pc-linux-gnu) Copyright (C) 1995-2000 Jorg Schilling Using libscg version 'schily-0.1' scsibus0: 0,0,0 0) * 0,1,0 1) * 0,2,0 2) * 0,3,0 3) 'HP ' 'CD-Writer+ 9200 ' '1.0c' Removable CD-ROM 0,4,0 4) * 0,5,0 5) * 0,6,0 6) * 0,7,0 7) *
To write the backup file image created with mkisofs in the previous section, switch to the root user and type the following at a shell prompt:
cdrecord -v -eject speed=4 dev=0,3,0 backup.iso
The command above sets the write speed at 4, the device address as 0,3,0, and sets write output to verbose (-v), which is useful for tracking the status of the write process. The -eject argument ejects the CD-ROM after the write process is complete. The same command can also be used for burning ISO image files downloaded from the Internet, such as Red Hat Linux ISO images.
You can use cdrecord to erase CD-RW discs for reuse by typing the following:
cdrecord --dev=0,3,0 --blank=fast