---
name: "cdwrite"
section: "1"
platform: "linux"
package: "cdwrite"
version: "2.0-2"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/cdwrite"
---

# cdwrite(1)

record audio or data Compact Discs

## NAME

cdwrite - record audio or data Compact Discs

## SYNOPSIS

**cdwrite** \[-ehvyV\] \[-s  *speed*\] \[-D *device*\] \[--eject\] \[--help\] \[--version\] \[--dummy\] \[--verbose\] \[--speed  *speed*\] \[--device *device*\] \[--philips\] \[--ims\] \[--kodak\] \[--hp\] \[--yamaha\] \[\[-adpnPN\] \[-b *bytes*\] \[--audio\] \[--data\] \[--preemp\] \[--nopreemp\] \[--pad\] \[--nopad\] \[--bytes *bytes*\] *source*

## DESCRIPTION

**cdwrite** is used to record data or audio Compact Discs on an Orange Book CD-R recorder.  This version will only write single session, Red/Yellow Book compatible discs.  These discs are suitable for direct mass production by CD manufacturers, as well as direct use in regular players.

Each *source* is a file (or a dash - indicating standard input) containing the data for a single track.  Unlike previous versions of **cdwrite**, reading from standard input must be indicated explicitly.

### GLOBAL OPTIONS

- *-e, --eject*

  Eject the disk on completion.  If no source files are specified, eject the disk, then exit.

- *-h, --help*

  Print a short help message, then exit.

- *-v, --verbose*

  Present a verbose display, including a progress display as each track writes.

- *-y, --dummy*

  Makes the CD recorder go through all the motions of a write procedure, but with the laser turned off.  Used for testing.

- *-V, --version*

  Print the program version, then exit.

- *-s speed, --speed speed*

  Sets the writing speed (# is an integer; 1 = single speed, 2 = double speed, etc.).  Specifying a speed your CD writer cannot handle may have unpredictable effects.  The default is double speed (on HP, the default is \`\`maximum speed'', which is drive dependent; it is double speed for the HP 4020i.)

- *-D device, --device device*

  Sets the device name for the CD writer.  The  *device* argument must refer to a generic SCSI device name (typically starting with */dev/sg*). Default is */dev/cdwriter*, which is assumed to be a symbolic link to the appropriate standard device name.

- *--philips, --ims, --kodak*

  Sets Philips/IMS/Kodak mode.

- *--yamaha*

  Sets Yamaha mode.

- *--hp*

  Sets Hewlett-Packard mode.

### TRACK OPTIONS

All track options except *-b, --bytes* affect all subsequent tracks unless cancelled by another option.

- *-a, --audio*

  Indicates subsequent tracks should be written in Red Book audio format.  The data for this track should be 2-channel, 16-bit, signed (2's complement) digital audio sampled at a rate of 44100 Hz.  Each sample should be written in the following byte order: MSB left, LSB left, MSB right, LSB right.  The track should be a multiple of 2352 bytes (588 samples).

-

  The audio format conversion program **sox** can be used to create data in this format by specifying the **cdr** output format.  If used on a littleendian system, such as Linux/i386, **sox** requires the *-x* option on the output file as well.

- *-d, --data*

  Indicates subsequent tracks should be written in Yellow Book (CD-ROM) format.  The data for this track should be a multiple of 2048 bytes, and will typically be an ISO 9660 filesystem image.  The program **mkisofs** can be used to generate such an image.

-

  This is the default.

- *-p, --preemp*

  Indicates that subsequent audio tracks have been mastered with preemphasis.  Preemphasis provides a larger dynamic range at the expense of added distortion of high-volume segments.  This option does not affect the data written to the disc; the preemphasis must be reflected in the input data.  This option has no effect on data tracks.

- *-n, --nopreemp*

  Indicates that subsequent audio tracks have been mastered with linear data.  This is the default.

- *-P, --pad*

  Add 30 kilobytes (15 sectors) of nulls to the end of each data track. This is a workaround for a bug in Linux up to and including at least version 1.2.8, which would at times not correctly read the last few sectors written.  This option has no effect on audio tracks.

- *-N, --nopad*

  Do not pad data tracks.  This is the default.

- *-b bytes, --bytes bytes*

  Specifies the length of the data for the next track only.  If the source for a track is not a regular file, this option should be used to specify the length of the input.  The **isosize** program, usually included in the **cdwrite** distribution, can be used to determine the length of an ISO 9660 filesystem image.

-

  This option is typically used when writing an ISO 9660 filesystem image which has previously been written to a raw block device.

## EXAMPLES

For all examples, it will be assumed */dev/cdwriter* is the generic SCSI device for the CD writer, unless other is indicated.

To write a pure CD-ROM, using data (usually an ISO 9660 filesystem image) from the file *cdimage.iso*:

	cdwrite -v cdimage.iso

To write a pure CD-ROM, with padding, using an ISO 9660 filesystem from */dev/sda3*, to the CD writer connected to */dev/sg2*:

	cdwrite -v -D /dev/sg2 --pad -b \`isosize /dev/sda3\` /dev/sda3

To write a pure audio CD, at double speed, with each track contained in a file named *track01.cdr*, *track02.cdr*, etc:

	cdwrite -v --speed 2 --audio track\*.cdr

To simulate writing a mixed-mode CD with an ISO 9660 filesystem from */dev/sda3* on the first track, the other tracks being audio tracks with preemphasis from the files *track01.cdr*, *track02.cdr*, etc:

	cdwrite -vy -b \`isosize /dev/sda3\` -d /dev/sda3 -ap track\*.cdr

## SUPPORTED HARDWARE

So far, **cdwrite** has been tested on and is known to work on:\
 Philips CDD-521, CDD-522, using an Adaptec 1542 SCSI controller.  This unit is also sold under the IMS brand name.  All CDD-52x models should work.\
 Kodak 522 (an OEM version of the Philips CDD-522.)\
 Yamaha CDR100, using a BusLogic SCSI controller (audio untested.)  All CDR10x models should work.\
 HP 4020i (C4324/C4325).

**cdwrite** is known *not* to work on:\
 All Sony models.

If you have tested a different model of CD writer, please send your results to *\<hpa@storm.net\>* for reference.  Please do not email the author to ask about writers not listed here; however, a Web page will be made available at *http://terminus.storm.net/~hpa/cdwrite\_comp.html* for your reference.

## AUTHORS

Originally written by Adam Richter *\<adam@yggdrasil.com\>*.\
 Currently maintained by H. Peter Anvin *\<hpa@storm.net\>*.\
 Progress reporting by Dan Quinlan *\<quinlan@bucknell.edu\>*.\
 Improved buffering by Ross Biro *\<ross.biro@linux.org\>*.\
 Yamaha support by Leonard N. Zubkoff *\<lnz@dandelion.com\>*.\
 HP support mostly by Eric Smith *\<eric@goonsquad.spies.com\>*. Also thanks to all the alpha testers.

## HINTS

When generating a CD-ROM, it is often useful to write the filesystem image directly to a hard disk partition rather than a file; this makes it easy to verify the proper setup of the filesystem before writing, and improves throughput.  See the second example above.

## CAVEATS

Unless your SCSI controller and driver support disconnect/reconnects, you will probably not be able to write a CD correctly if the CD writer and hard disk are on the same SCSI bus.  It is not recommended that IDE drives are used on CD-writing system; if they are, it is imperative that interruptible operation is enabled using the **hdparm** command.

It is not recommended to use more than single speed when reading data off a filesystem (as opposed to a raw disk partition).  Although it is possible to write a CD from a pipe process, there is always the risk of stalls if the source process falls behind.

It is recommended that your system is left as lightly loaded as possible during the write operation, since CD writing is a realtime operation.  If **cdwrite** is run as root, it will automatically elevate its priority to reduce the likelihood of fatal interruptions.

**cdwrite** does not verify that the input data will fit on the media.  In the case of media overrun, the resulting disc is usually unreadable.

A Compact Disc can have no more than 100 tracks.

When creating a disc with both audio and data tracks, it is conventional to place the data on track 1.  Some CD players or CD-ROM drives may respond incorrectly to any other arrangement, although the specifications permit it.

Many systems are not able to read more than a single data track, or need special software to do so.

Some CD players have problems reading \`\`gold'' CD's, and some have problems reading the outermost tracks (i.e. very long CD's).

Compiling **cdwrite** depends on the header files included in the Linux kernel source under the directory */usr/src/linux/drivers*. If you update your kernel, there is a possibility you may have to recompile **cdwrite**.

## SEE ALSO

**hdparm**(1), [**mkisofs**(1)](/mkisofs/1.md), [**sox**(1)](/sox/1.md).
