UCLALUG

Main - Linux? - Help & Docs - Software Downloads - About Us

CD Writing Tutorial (for linux)

by terry chow

This tutorial is split into two parts:

1. Introduction to CD burning in linux
2. Application examples - the cheatsheet

Legal spiel

Neither I nor the UCLALUG condone any actions of illegally copying CDs or distributing CDs. The following discussion is not an attempt to spread criminality, but rather education and knowledge. The UCLALUG and I do not take any responsibility for your actions in regards to the following tutorial. This following information is taken from a variety of sources: Joerg Schilling's cdrecord documentation, xcdroast documentation, the CD-Writing HOWTO, my own experiences, the CD-info web page,the cdrdao web site and the McFadden CD-R FAQ. If you think I'm plagiarizing your material, please tell me before you threaten legal action. I'll handle it accordingly with you personally and quickly.

Which burner?

There is no definitive answer for this question, but I can tell you what I have heard is good and where I've heard about problems. I've had good experiences with the Matsushita/panasonic 7502 and 7503. The 4x burner and 8x burner, respectively. Plextor writers also seem to work well, i.e. configure easily, well supported. I've heard some people complain about Yamaha's doing weird stuff, and I know one person who doesn't like his Philips burner. Check out the documentation for your CD copying software to see what burners are supported. I have no experience with CD-RW. If you would like to donate a CD-ReWritable drive to me, I'll be happy to document its properties. Also see the CD Recordable FAQ for a discussion on the best models.

Which interface?

SCSI is the easiest and most stable interface for cd-burning. It costs a bit more though. I don't think an IDE burner is the best idea. But the quality of IDE burners run the gamut, so check your favorite hardware web sites for the real scoop on which IDE burner might be good for you. Do not get a parallel port burner. A SCSI burner with IDE reader or IDE harddrives will work fine. But if you have the resources, get an all SCSI system. You don't need the latest and greatest SCSI card just to copy cds. Nobody says if you want to burn cds that you have to have the newest Adaptec card with LVD support. If you don't have many SCSI devices (like one cd-writer), then an inexpensive Tekram or Advansys card will work beautifully. If you insist on getting an IDE burner, you need to employ SCSI emulation for your CD-writer. I don't know anything about USB burners, but considering the shared bandwidth and relatively small bandwidth, I would predict bad consequences.

Which media?

This depends on where your CDs will ultimately end up. Most newer CD-roms are very smart and can read almost any CD-R, assuming its not wildly scratched. If your CDs are soley for your own computer, the main difference between competing brands of media are the capacity. I have yet to see or hear of a CD player (from component stereo land) not being able to read a burned CD. The biggest concern is mobile CD players (discman) and car stereos. Not uncommonly, certain (mainly generic) CD-Rs do not work for these. The most universally accepted CD-Rs, in my opinion, are Mitsui and TDK discs. Chances are low that your burned CD won't work somewhere, so save yourself some cash unless you are paranoid.

Why use linux for CD-writing?

Because it sucks less. Many CD writing software in Windows are poorly implemented, unstable, and/or bloated. My realization of the power of linux began with powerful CD writing capabilities. Windows CD burning utilities are not definitely easier to use than linux. For most general CD burning duties, linux can handle them simply and without any mistakes.

Which programs do the job?

Xcdroast, cdrecord, mkisofs, xmms cdparanoia, and cdrdao will handle nearly every application scenario for writing CDs. Cdrecord does nearly everything you need, but it is not entirely intuitive. Mkisofs turns a directory structure on your filesystem into the ISO9660 filesystem for CDs. Xcdroast is an intuitive gui frontend to cdrecord and mkisofs. Cdrdao is a console program used for DAO (disc-at-once) recording. There are probably gui frontends to cdrdao too. Xmms is a mp3 player.

What about setting up my hardware in linux?

Cdrecord, xcdroast, and cdrdao have some built-in configuration tools. Usually this will be all you need. The CD-WRITING HOWTO makes setting up a CD writer sound hard, and it very well could be difficult with the many different cd writers. I won't detail on hardware problems because the howto does a better job, and for most cases extra preliminary configuration is not necessary. If you did not have any SCSI devices during installation, your distribution might not have provided the SCSI drivers you need. You need to compile in generic SCSI support into the kernel or insert the appropriate modules.

The following command scans your scsi bus. The output should tell you the SCSI bus number, id number, and lun for your drive(s).

cdrecord -scanbus

Configuration for xcdroast is self-explanatory. Select the "Setup" tab on fill in appropriate fields. If anything is confusing, there is an extremely clear README included with xcdroast. Note: the "HD SETUP" tab asks you where you want images stored on your hard drive. You can specify a partition or a path to wherever your have room. Images of CDs are large, so make sure you have the extra capacity.

I'm impatient, and I don't want to image a CD to my hard drive. Can I copy from a CD directly to another CD?

Yes, you can. I don't recommend it, unless you absolutely can not spare the space. One little buffer underrun or another flaw can give you a shiny coaster. If you must, make sure the source cd is not scratched and that the CD reader is at least twice the speed of the writing speed.

Where can I find more info?

man cdparanoia
man cdrdao
/usr/doc/xcdroast[your_version]/README.html
man cdrecord
man mkisofs
http://www.linuxdoc.org/HOWTO/CD-Writing-HOWTO-3.html
http://www.ping.de/sites/daneb/cdrdao.html
http://www.fadden.com/cdrfaq/
http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html
http://www.cd-info.com/



top

intro

cheatsheet

THE CHEATSHEET

NOTE: There are usually more than one way to do the following tasks. I demonstrate what I think is the easiest option.

How do I copy a "normal" data CD?

If this is a normal, i.e. it can be mounted, ISO9660 data cd, simply click on the "Copy Data-CD" button in xcdroast and follow the steps sequentially. Start at the top button, work your way down. The function of each tab is named appropriately. Verifying images and deleting them is optional. There is also a "Quick CD-COPY" function, which copies CDs on the fly.

I have data on my hard drive that I would like to archive. The data is taking up needed space or I want to back it up.

Again use xcdroast for this. Select "Master CD". Select the directory you want backed up and paths to exclude. Select each button on the left, starting from top to bottom. When you finish you will have a cd with the contents from your hard drive. Enabling Rockridge extensions, Joliet extensions, and long filenames is rarely disadvantageous. Check these if you want to use your CD in windows and linux, and you want such features as long filenames, symbolic links, etc. If you can think of a good reason to use DOS, then you might want to check the TRANS.TBL button.

I downloaded an ISO from a certain place (e.g. a new Redhat ISO). How do I put this on a CD?

xcdroast can probably do this, but I find it simpler with one command with cdrecord:

cdrecord -v -eject speed=4 dev=0,6,0 the_iso_name.iso

Change the value for speed of writing accordingly. The value for dev is scsibus,scsi_id,lun. Very often it will be 0,6,0.

However, before you start any burning process, you may want to verify the validity of the ISO with the next two commands. You can do a quick check to see if the iso you downloaded works by mounting it via the loopback driver before you burn the image. You need this compiled into your kernel.

mount -t iso9660 -o ro,loop=/dev/loop0 [the_iso_image] [your_mount_point]

More often than not, there will be a md5sum to verify the validity of your download. Compare the results of the following command to the md5sum on the remote machine.

md5sum the_iso_name.iso

How do I copy an audio CD?

Use xcdroast. Select the "Copy Audio-CD" tab, and select each tab from top to bottom.

How do I make a custom audio CD from several other CDs?

Same as above. Except you need to put in different audio CDs and read the track(s) you want. Be careful about naming. You can easily overwrite your old tracks.

I have several .WAVs I want on a CD. How do I do this?

Use xcdroast. Select the .wavs that you want on your cd. Check the "Fix wavs" button.

I have several MP3s I want to be able to play on my CD player. How do I put these onto CD?

Go to options-preferences in xmms. Select for output plugin Disk Writer and configure the proper directory you want the .wav to end up in. Play your mp3, and you will have a wav.

Do the the answer to the previous question.

I have a CD with no pauses in between songs. The end of one song is the beginning of the next (e.g. live CDs) How do I make this CD without pauses?

cdrdao read-toc --device 0,2,0 your_name_for_toc

cdparanoia -w 1- data.wav

cdrdao write --device 0,6,0 --speed 4 --eject your_name_for_toc

Change the device argument accordingly for the cdrdao commands (scsibus, scsi_id,lun), where scsi_id refers to the id for your burner or reader. Also change the speed argument accordingly.

I have a large .WAV, and I want to put it onto an audio CD and specify how long the tracks are.

Read the man page for cdrdao. You will need to make a customized toc (table of contents). It will look similar to this:

CD_DA

TRACK AUDIO
NO COPY
NO PRE_EMPHASIS
TWO_CHANNEL_AUDIO
FILE "yourwav.wav" 0 4:00:74

TRACK AUDIO
NO COPY
NO PRE_EMPHASIS
TWO_CHANNEL_AUDIO
FILE "yourwav.wav" 4:00:74  3:00:02

TRACK AUDIO
NO COPY
NO PRE_EMPHASIS
TWO_CHANNEL_AUDIO
FILE "yourwav.wav" 7:01:01 5:32:23

The arguments of "FILE" are, in order, the name of your file, the beginning of the current track, and the length of the track. Note that the third field in time arguments is not milliseconds. It is 1/75 of a sector or a second. Hence, 74 + 2 will sum up to 01 in the third field for the next entry, while increasing the second field by one. Use your custom toc and cdrdao to make your CD.

I have a CUE/BIN. How do I burn this?

The very popular cdrwin (for windows) images cds with a cuesheet (CUE) and a concatenated binary (BIN) from the track(s). CDRDAO has support for these.

cdrdao write --device 0,6,0 --speed 4 --eject foo.cue

Change arguments accordingly. The associated bin file must have the same name as the cuesheet. In this case, foo.bin.

How do I customize a Redhat/Mandrake CD?

Mirror the distribution locally on your hard drive. Use the "mirror" program or simply recursively copy an existing CD.

Use the mirror program to obtain updates. Or manually download updates and new boot images and incorporate them into your mirrored tree. Your can manually remove the old files or run the bash script found in the Redhat-CD mini-howto. You can also put whatever you want on the cd in your mirrored tree. Be careful about space limitations.

Run the program genhdlist on your mirrored distribution on the directory that will become the root of the cd:

misc/src/install/genhdlist /[path_to_mirror]/
genhdlist is located in different places for different releases and distributions.

Run the following command to make an image of your mirror in the root of the mirrored directory.

mkisofs -b images/boot.img -c boot.cat -f -J -l -L -r -v -V volume_label -o name_of_image ./
Volume_label is the volume label for your CD. Then burn the image:
cdrecord -v -eject speed=4 dev=0,6,0 name_of_image
Read the Redhat-CD mini-howto for many other options to play with on your customized Redhat/Mandrake cd.

Are there any other application examples?

I'm sure there are many applications that I didn't cover. For instance, I didn't talk about multi-session cds or mixed-mode cds because I haven't found any use for them yet.

top

intro

cheatsheet