CDWRITE(1)

NAME
cdwrite - record audio or data Compact Discs

SYNOPSIS
cdwrite [-v] [-dummy] [-speed #] device [[-audio] [-data] [-preemp] [-nopreemp] [-pad] [-nopad] [-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.

The device in the command line refers to the generic SCSI device name (typically starting with /dev/sg) corresponding to the CD writer. Each source is a file (or a dash - indicating standard input) containing the data for a single track. If no source is specified, cdwrite will write a single track using data from standard input.

  GLOBAL OPTIONS

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

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

-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.

  TRACK OPTIONS
All track options except -bytes affect all subsequent tracks unless cancelled by another option.

-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.

-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.

-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.

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

-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.

-nopad
    Do not pad data tracks. This is the default.

-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 mkisofs 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/sg1 is the generic SCSI device for the CD writer.

To write a pure CD-ROM, using data from the file cdimage.iso:

    mkisofs -v /dev/sg1 cdimage.iso

To write a pure CD-ROM, with padding, using an ISO 9660 filesystem from /dev/sda3:

    mkisofs -v /dev/sg1 -pad -bytes `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:

    mkisofs -v -speed 2 /dev/sg1 -audio track*.cdr

To dummy-write 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:

    mkisofs -v -dummy /dev/sg1 -bytes `isosize /dev/sda3` /dev/sda3 -audio -preemp track*.cdr

AUTHORS
Originally written by Adam Richter <adam@yggdrasil.com>.
Progress reporting by Dan Quinlan <quinlan@yggdrasil.com>.
Improved buffering by Ross Biro <biro@yggdrasil.com>.
Red Book audio support by Peter Anvin <hpa@yggdrasil.com>.

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.

So far, cdwrite has only been tested on Philips CDD-52x CD writers. It is not known if it will work on other units. It has been tested at single and double speed only, using an Adaptec 1542 SCSI controller. If you have information on any other configurations that do or do not work, please contact Peter Anvin <hpa@yggdrasil.com>.

It is not recommended to use more than single speed when reading data off a filesystem (as opposed to a raw disk partition).

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. (On a Philips CDD-521, this often results in writing nothing but a corrupt table of contents.)

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), sox(1).