|Red Hat Enterprise Linux 4: Red Hat Enterprise Linux Step By Step Guide|
|Prev||Chapter 13. Diskettes and CD-ROMs||Next|
CD-writable (CD-R) media are an inexpensive way to back up as much as 760MB of data, including applications, personal files, and multimedia files. CD-rewritable (CD-RW) media are also very common, and allow the user to write files to the media multiple times.
Recently, the DVD equivalents of these media have become more common and more affordable. They behave similarly to CDs, but can store up to 4.7GB of information. DVDs, in general, cannot be read by CD-ROM drives, though most DVD-ROM drives can read CDs. Refer to the manufacturer of your drive for more information regarding compatible formats.
Below, we discuss tools for both CDs and DVDs.
Nautilus has an integrated tool, CD/DVD Creator, that allows you to write to CDs and DVDs.
CD/DVD Creator allows you to drag and drop files from a Nautilus window to the CD/DVD Creator interface. To access the CD/DVD Creator feature in Nautilus, insert a blank CD-R(W) into your drive and the CD/DVD Creator window automatically starts. You can also open CD/DVD Creator from a Nautilus window by selecting Go => CD Creator.
Open a new Nautilus window and select the files or directories you want to write to CD or DVD, then drag the files and folders to the CD/DVD Creator window.
When you are ready to write the files to your CD or DVD, click the Write to CD button in the CD/DVD Creator window. The Write to Disk window opens. Select the write speed, name the CD or DVD, and click the Write button when finished.
By default, the CD or DVD should automatically eject from your drive when it is finished. Since it is generally recommended to periodically backup personal files, CD/DVD Creator can help you do so quickly.
There are two shell prompt applications used to write image to CDs and DVDs: mkisofs and cdrecord. These 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 CD/DVD Creator.
The mkisofs utility creates ISO9660 image files that can be written to a CD or DVD. The images created by mkisofs can include all types of files. It is most useful for archival and file backup purposes. For CDs, make sure that the total data to be written is less than 760MB. For DVDs, make sure that it is less than 4.7GB of data.
Suppose you wish to backup a directory called /home/user/, but exclude the subdirectory /home/user/junk/ because it contains unnecessary files. You want to create an ISO image called backup.iso and write it to CD or DVD. Backing up your data as an ISO9660 image is useful in that it can be read by both Red Hat Enterprise Linux and Windows systems. This can be done with mkisofs by running the following command:
mkisofs -o backup.iso -x /home/joeuser/junk/ -J -R -A -V -v /home/joeuser/
The image is created in your current working directory. Table 13-1 explains each command line option. For more information on using mkisofs, refer to the additional resources in Section 13.4 Additional Resources.
You can now use the ISO image file with cdrecord, the command line based CD recording utility. For more information about using cdrecord, refer to Section 220.127.116.11 Using cdrecord.
|-o||Specifies an output file name of the ISO image.|
|-J||Generates Joliet naming records; useful if the CD is used in Windows environments.|
|-R||Generates Rock Ridge (RR) naming records to preserve filename length and casing, especially for UNIX/Linux environments.|
|-A||Sets an Application ID — a text string that will be written into the volume header of the image which can be useful to determine what applications are on the CD.|
|-V||Sets a Volume ID — a name that is assigned to it if the image is burned, and the disc is mounted in Solaris and Windows environments.|
|-v||Sets verbose execution, which is useful for viewing the status of the image as it is being made.|
|-x||Excludes any directory immediately following this option; this option can be repeated (for example, ... -x /home/joe/trash -x /home/joe/delete ...).|
Table 13-1. mkisofs Options
The cdrecord utility writes audio, data, and mixed-mode (a combination of audio, video, and/or data) CDs and DVDs 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 or DVD device by running the following command as root at a shell prompt:
This command shows all CD and DVD devices on your computer. It is important to remember the device address of the device used 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 sets the write speed (4), the device address (0,3,0), and sets write output (verbose [-v]), which is useful for tracking the status of the write process. The -eject argument ejects the media 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 Enterprise Linux ISO images.
You can use cdrecord to blank CD-RW or DVD-RW discs for reuse by typing the following:
cdrecord --dev=0,3,0 --blank=fast