--get your your Linux knowledge
> Linux Reviews > Howtos >

CD ripping and burning from the command prompt Howto

How to rip and burn data, audio and special (like Playstation PSX) CDs using the standard command line tools.

  1. General information / required configuration
  2. Ripping, copying and burning normals CDs or ISOs
  3. Rip / Copy Multi-track Cd's (cue/bin, Playstation)
  4. Smoother CD burning using ccache
  5. CD Image Format Guide

1. General information / required configuration

Almost all CD burners on the marked today use the IDE standard. Older / rare / expensive CD burners use the SCSI standard.

cdrtools *version 1.x requires "scsi emulation" when using IDE CD burners. This is provided by a kernel module called "ide-scsi". Most distributions will auto-detect IDE CD burners and magically do the required configuration for you. (Mandrake Linux, Redhat, Suse).

cdrtools version 2.x can write to IDE devices directly without using emulation. You may still want this for 2.4.xx kernels because some tools, like cdrdao, still requires it.

These links will help you configure scsi emulation by your self:

Hints: Use dmesg | grep 'scsi' to identify SCSI drives, dmesg | grep 'hd' to identify IDE drives.

cdrtools changelogs:

2. Ripping, copying and burning normals CDs or ISOs

Ripping means copying the contents of a CD to another filesystem. This can be done easy with standard Linux command-line tools or using a frontend like k3b or xcdroast.

2.1. Data CDs / working with iso images

CDs containing data can be saved as archives called .iso. This image can be used to burn an identical 1:1 copy of the CD.

2.1.1. Rip data-cds

To rip an entire normal data-cd (ISO filesystem) from a CD-ROM:

  dd if=/dev/cdrom of=my_cd_image.iso

dd manual page

2.1.2. Burn data-cds

ISO CD images can be burned to CDs by using the program cdrecord. You can use it like this with a SCSI burner:

cdrecord -v speed=XX dev=0,Y,0 -data cd_image.iso

XX sets the speed, dev=0,Y,0 is the burners (SCSI) ID. Run cdrecord -scanbus to view your drive(s) and their ID(s)

For IDE CD burners (most likely what you got) you must use -dev ATAPI:/ and add the link to your device:

cdrecord -dev ATAPI:/dev/hdc -data cd_image.iso

It is also possible to use a numbered ID when using IDE/ATAPI: cdrecord dev=ATAPI:0,0,0 Run cdrecord dev=ATAPI -scanbus to find the valid IDs.

cdrecord manual page

cdrecord is a part of cdrtools

2.1.3. Mouting ISO Images

.iso images be mounted as if they were burned to a CD. This is a quick and good way to test your .iso images or extract files from them without actually burning it - the mounted image folder will act like a CD with the syntax:

  mount -t iso9660 -oloop [isofile] [mountpoint] 


  mount -t iso9660 -o ro,loop /path/cd_image.iso /mountpoint/cdrom

You can specify the loop device you want, that it is not needed. (loop=/dev/loop0).

This only works if you have CONFIG_BLK_DEV_LOOP=m or y in your kernel configuration.

mount manual page

2.1.4. Mounting / converting cue/bin images

You need cdemu to mount cue/bin images in Linux. Check the home page and INSTALL for more information.

Gentoo Users with 2.4.xx kernels: emerge cdemu && depmod -ae

You can also use bchunk to convert bin/cue CD-images to iso+wav/cdr.

You can also try the 9kb program bin2iso.

2.1.5. Windows users should use DAEMON Tools to mount .iso and .bin

DAEMON Tools is a virtual cd / dvd-rom emulator for Windows. It is able to emulate nearly all known copy protections on the market today.

NOTE: "DAEMON Tools is freeware ONLY for PRIVATE USE. If you use it in a commercial environment, for example your office or an Internet Cafe, you must register DAEMON Tools. One license is needed for every PC you run DAEMON Tools on."

magiciso is a shareware Windows program that can burn and extract .iso/.bin archives..

2.1.6. Nero .nrg archives

Nero is a popular burning program for Windows. CD images made with Nero are called filename.nrg and are similar to, but not the same as standard .iso images.

You need to convert Nero images to standard ISOs using the program Nrg2Iso in order to burn them as usual under Linux.

Download now:

Suse RPMs for Nrg2Iso are also available on the Nrg2Iso homepage. (The homepage is also available in some strange language)

2.2. Audio CDs

Use cdparanoia to rip audio tracks from a CD. The sound can be saved as WAV, AIFF, AIFF-C or raw format.

  cdparanoia [options] span [outfile] 

To list a CDs table of contents:

  cdparanoia -Q

To copy a track to the current directory:

  cdparanoia n myfile.wav``** where n is track number.


  cdparanoia 5 lovesong.wav

To rip several (a to, and including c) tracks to one big file:

  cdparanoia --batch a-c bigfile.wav

cdparanoia manual page

3. Rip / Copy Multi-track Cd's (cue/bin, Playstation)

With mosts Cd's you can make a 1:1 copy with dd and burn this ISO 9660 image using any standard tool (like the CD-Writing HOWTO explains).

This does not work with Playstation-Cd's because the data track is written in mode 2 which dd can't read, and because the Cd's are multitrack (one data-track and several audio-tracks).

cdrdao (manual page) can copy these Cd's.

To read a CD and make a image pair:

cdrdao read-cd --read-raw --datafile [filename.bin] --device [bus,id,lun] --driver generic-mmc-raw [filename.toc]

[filename.bin] The actual image file
[bus,id,lun] The SCSI-address of the used device
[filename.toc] The description file (Table Of Contents)

IDE users should use --device ATAPI:0,0,0 (for the first drive, ATAPI:0,1,0 for the second), SCSI users only need to give ut the device number (--device 0,3,0). It is also possible to point directly to the device path: --device /dev/cdroms/cdrom1


cdrdao read-cd --read-raw --datafile my_game_rip.bin --device ATAPI:0,0,0 --driver generic-mmc-raw my_game_rip.toc

This makes my_game_rip.toc and my_game_rip.bin.

SCSI users can how burn these files to a CD:

cdrdao write --eject --speed [num] --device [bus,id,lun] --driver generic-mmc [filename.toc]

cdrdao write --eject --speed 16 --device 0,3,0 --driver generic-mmc my_game_rip.toc

cdrdao can not burn CDs using IDE/ATAPI devices. (you can use scsi emulation)

.toc files are what Windows users name .cue files. It makes no differnece if the contents table you feed cdrdao is called .cue or .toc.

Front-ends for using bin/cue files:

4. Smoother CD burning using ccache

If you are burning Cd's on Linux, your CD recording settings are set by the file:

/etc/cdrecord.conf (default) /etc/default/cdrecord (Gentoo and others)

You can change the option CDR_FIFOSIZE in cdrecord.conf to increase the amount of data read, in megabytes (m), before the actual recording is started.

This option has nothing with the size of your CDRWs buffer, it sets how much system memory is used to buffer the on-the-fly iso image created before data is tranfered from system ram to your CDRWs buffer.

The dataflow is: Files on harddrive -> Linux Memory Buffer -> CD-Writer Buffer.


  # The default speed, if not specified elsewhere
  # The default FIFO size if, not specified elsewhere

CDR_SPEED should be your burners correct speed or something less if your harddrive is so slow it can't keep up.

A good size for CDR_FIFOSIZE is 1/4 of your RAM, at most the amount you are sure you will have available whenever you feel like burning a CD. The command **free* will show your total and currently available memory.

If the CDR_FIFOSIZE is set too high Linux may run out of memory and start swapping or even killing applications (if you don't have swap)! Swapping may at worst cause the data to be read so slow that you risk getting an buffer underrun error.

5. CD Image Format Guide

The standard for CD images is called .iso.

5.1. iso images

iso is a very common standard. If you download a file called .iso then you will be able to burn it with any standard cdrecording tool like k3b.

5.2. .cue/.bin pairs

These files come in pair. .bin is the large actual cd image and the .cue is a small description on how to burn it.

cdrdao write --eject --speed 16 --device 0,3,0 --driver generic-mmc filename.cue

Common tools like k3b supports .cue/.bin pairs.

Capital letter warning

When asking programs to burn a .cue file they will look for a matching .bin file. If the filename uses capital letters (image pair FILEONE.BIN & FILEONE.CUE) this may fail because the program will look for FILENAME.bin instead of FILENAME.BIN. Rename the file if you run into this problem.

5.3. CloneCD .ccd/.img/.sub

A Windows tool called CloneCD is commonly used to burn backups of Playstaion and other copyprotected CDs.

CloneCD rips an image consisting of three files .ccd/.img/.sub, usually distributed archived as zip or rar. The .img is the CD data, the .cdd looks like a .cue and the .sub may contain extra information on specially marked sectors.

Sad to say these files can not be burned perfectly under Linux. You have to alternatives:

  1. Download the Clone-CD to ISO converter ccd2iso
  2. Burn with cdrdao and use the .img as .bin, .cdd as .cue and ignore the .sub. This may work correct.

5.4. .nrg

Nero image files, made with and for the Windows program called Nero.

.nrg is a non-standard variant of the common .iso format. Images with only one track can be burned as usual (like .img).

When trying to burn multitrack .nrg images like .isos you will only get the first track recorded!

Copyright (c) 2000-2004 Øyvind Sæther. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ["GNU Free Documentation License"].

Meet new people