Cdrecord

From LQWiki
Jump to navigation Jump to search

cdrecord is a cd burning console command and arguably the most popular tool used to burn CDs on Linux, particularly since most (if not all) of the graphical CD burning tools use cdrecord as a back-end.

A certain amount of knowledge is generally required in order to burn CDs using cdrecord. For data CDs, it is first necessary to produce an ISO filesystem with the tool mkisofs, whereas for audio CDs the audio files must be converted into the correct format, normally using sox.

If you have questions, you can search or post your questions to this Cdrecord forum.

Using cdrecord

Because cdrecord needs to access the CD writing device directly, it is necessary to run the program with root privileges, either by becoming root with the su command or by configuring cdrecord as a command callable with sudo.

Addressing IDE drives

Historically, cdrecord insisted on addressing SCSI drives only, but this has been fixed in the most recent versions. This meant that for systems with IDE ATAPI CD-writers - which is most of them - it was necessary to use the kernel's ide-scsi emulation layer.

To determine the SCSI ID of your CD writer, use these two commands

# cdrecord -scanbus
# cdrecord dev=ATAPI -scanbus

These commands will print out the IDs of all devices in the system along with their identifying text. If the CD-writer you wish to use is listed by the first command, it is either a SCSI CD-writer or an IDE CD-writer being addresses by the ide-scsi emulation layer. If the CD-writer you wish to use is listed by the second command it is an IDE ATAPI CD-writer being addressed directly.

Typical command-lines

A typical command line for burning a data CD would be:

# cdrecord dev=0,0,0 speed=8 -v -data cdimage.iso

A typical command line for burning audio CDs would be:

# cdrecord dev=0,0,0 speed=8 -v -audio *.cdr

In both of these cases, the dev=0,0,0 refers to the SCSI ID of the CD writer, the speed parameter is obvious, the -v enables verbose output which shows more clearly what is going on, and the final argument specifies either the ISO image or the audio tracks that are to be written to the CD.

If IDE ATAPI is being used directly, the above example commands would look like:

# cdrecord dev=ATAPI:0,0,0 speed=8 -v -data cdimage.iso
# cdrecord dev=ATAPI:0,0,0 speed=8 -v -audio *.cdr

These ATAPI addresses still look somewhat SCSI-like - but ATAPI is actually the SCSI MMC protocol carried over the ATA bus - so this is understandable.

Other common options

These are some of the more common options used when burning a CD with cdrecord.

-dao
Selects DAO, or disk-at-once recording. This eliminates the two-second gap between audio tracks but also prevents any more data being written to the disk after the initial burn is completed.
-dummy
Perform a simulation write. If this completes successfully, you must manually start the actual burn by repeating the command without the -dummy option.
-blank=<type>
Blank a CD-RW media. <type> is normally fast or all.
-toc
Print out the Table Of Contents of the currently-loaded CD.
-atip
Print out useful information about the type of CD currently in the drive, including the maximum and minimum write speeds.
driveropts=burnfree
Enable buffer underrun protection, which can prevent bad burnings, in your drive. To make sure you can use this, type cdrecord dev=<device> driveropts=help -checkdrive into a terminal. You should see "burnfree" somewhere in the output.

See also

to get DVD Burn support with K3b

  • K3b - a powerful and user-friendly graphical CD burning tool.
  • cdrdao - another command-line tool that burns disks in Disk-At-Once mode, with a slightly different interface.