1. Home
  2. Computing & Technology
  3. Linux

From Authors, for About.com

these kinds of data (not audio) CDs need to be treated differently: bootable CDs (like Linux installation CD), CDs that require the label, disk with errors, etc. For data CDs, I use these commands to make an exact copy:

dd if=/dev/cdrom of=cd_image

cdrecord -v speed=2 dev=1,0,0 -data cd_image

The dd command copies the input file (if), which in this case is the device /dev/cdrom to the output file (of) which in this example is a file called cd_image (on the hard drive in the current working directory). The second command copies the file cd_image that was created by the dd command onto an empty CD.

For data disk with error, you might want to try:

dd conv=noerror,notrunc if=/dev/cdrom of=cd_image

cdrecord -v speed=2 dev=1,0,0 -data cd_image

The option "conv=noerror,notrunc" specifies that the potential read errors are to be ignored, and files not truncated on error.

For audio CDs, I use these command to make a copy:

[rip the content of all audio tracks on the CD, from track 1 on. The tracks are saved into files in the current directory and named: track01.cdda.wav, track02.cdda.wav, etc.)]

cdparanoia -B "1-"

[write all the audio files to the CD, one by one. The tracks are separated by a 2 s gap]

cdrecord -v speed=2 dev=1,0,0 -audio track*

To copy an audio CDS in the most accurate way, man cdrecord recommends doing this:

cdda2wav -v255 -D2,0 -B -Owav

cdrecord -v dev=2,0 -dao -useinfo *.wav

To make an exact copy of mixed mode CDs:

[The dd command will output an error message when the the data has ended and audio started. This is expected and OK]

dd if=/dev/cdrom of=cd_image

[rip the content of all audio tracks on the CD, except the first track since it is data]

cdparanoia -B "2-"

[Write the data and subsequent audio files, piece by piece]

cdrecord -v speed=2 dev=1,0,0 -data cd_image -audio track*

7.7.7 Re-writable CDs

Re-writable CDs (CD-RW) are used the same way as regular write-once CDs (CD-R), but you have to blank re-writable disks before you will be able to re-use them, e.g.:

cdrecord -v speed=2 dev=1,0,0 blank=fast

To see other (more thorough and slower) options for blanking, use:

cdrecord blank=help

For example this thorough blanking can take 0.5 hour on my system, but is not really necessary unless the old data is confidential:

cdrecord dev=0,0,0 blank=disk

Again, older stereos often will not play CD-Rs.

7.7.8 Simplifying long commands with aliases

To simplify writing long commands required by cdrecord (or cdrdao), I may want to define a global alias by placing the following line in the file /etc/bashrc:

alias cdrecord="cdrecord -v speed=2 dev=1,0,0"

Re-login for the changes in /etc/bashrc to take effect. After creating this alias, I can record a CD using the following shortened command (no need to specify the CD writer speed and device name all the time):

cdrecord -audio track*

Explore Linux

More from About.com

  1. Home
  2. Computing & Technology
  3. Linux

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

All rights reserved.