1. Home
  2. Computing & Technology
  3. Linux

Linux Newbie Administrator Guide

From Authors, for About.com

7.7.3 Creating data CDs

  • Create a CD image containing your data:

mkisofs -r -o cd_image input_data_directory

This makes an International Standard Organization (ISO) standard 9660-type filesystem containing the files from input_data_directory, but writes the filesystem to an ordinary file on the hard drive. This output file is an "image" of the new CD which I am creating. The option "-o" indicates that the parameter that follows is the output filename of this image. The option "-r" enables "Rock Ridge" extensions to the ISO protocol so that file attributes are saved, and it sets the file permissions so all the files on the CD are publicly readable (can be read by all user, not only the file owner). The filenames are abbreviated to the "8.3" DOS-type length but, since Linux supports so called "Rock Ridge" extensions to ISO9660, it also writes the full names and all the file permissions as well--this way the new filesystem is portable across all popular operating systems (DOS, MS Windows, Linux, UNIX, etc)--really convenient to the user.

The input data directory can be assembled from different directories and files from all-over your filesystem using symbolic links (saves harddrive space because the data is not copied), but if you do it you probably want to tell mksiofs to follow symbolic links using the option -f:

mkisofs -r -f -o cd_image input_data_directory_containing_symlinks

  • You may want to inspect the CD image file by mounting it through the loop device:

mount -t iso9660 /dev/loop0 cd_image /mnt/cdrom

[now the content of the file should appear in /mnt/cdrom]

cd /mnt/cdrom

[inspect the file mounted through the loop device]

When done with inspection, change your working directory away from the mountpoint and unmount the file:

cd

umount /mnt/cdrom

  • If everything worked, you may burn your data CD:

cdrecord -v speed=8 dev=0,0,0 -data cd_image

The first number in "dev=" stand for the scsi bus number (the first one is 0, second bus is 1, ...), device id on the scsi bus (between 0 and 7), and the scsi lun number (always 0) respectively. You must customize them: the first two numbers can be read in the output from cdrecord -scanbus, the third number is always 0. Make sure to use the correct numbers or you may write to a wrong drive and corrupt your data.

The timing of writing to CD-Rs is very important, or an error may occur (the laser cannot be switched on and off at will). Therefore avoid doing intensive tasks during creating a CD, e.g. don't create or erase large files on the hard drive. My old system (RH6.2) will not permit me to start new tasks when using cdrecord .

In a similar way, I can burn a CD from an ISO CD image downloaded from the Internet. One source (a Debian FAQ) recommends the following command (as root) to burn the image "binary-i386-1.iso" to a CD:

nice --18 cdrecord -eject -v speed=2 dev=0,6,0 -data -pad binary-i386-1.iso

This assigns a very high priority ("niceness" of minus 18) to the CD burning task (thus minimizing the possibility of an error).

* License

* Linux Newbie Administrator Guide Index

Explore Linux

More from About.com

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux Documentation
  5. Newbie Administrator Guide
  6. Linux Newbie Administrator Guide - 7.7 Writing CD-R/Ws: cdrecord and cdparanoia

©2008 About.com, a part of The New York Times Company.

All rights reserved.