[ Team LiB ] Previous Section Next Section

Writing CD Discs


You can use the cdrw command to create data and audio CDs. You can also use this command to extract audio tracks from an audio CD. The cdrw command works with any MMC-compliant CD-R or CD-RW drive.

The cdrw command was initially provided starting with the Solaris 8 Update 2 (10/00) release on the separate Software Supplement CD for the Solaris 8 Operating Environment. Starting with the Solaris 9 release, the cdrw command is included in the Solaris 9 release and is available when you install the SUNWcdrw package.

Table 64 lists the options to the cdrw command.

Table 64. Options to the cdrw Command




Create an audio disc. You must specify at least one audio-file name. Because a CD cannot have more than 99 audio tracks, you can specify no more than 99 audio files. The maximum audio data that can be written to the CD by default is 74 minutes unless you specify the -C option.

-b all | session


Blank a CD-RW disc. You must specify the type of erasing by specifying the all or session argument.


Copy a CD. If you specify no other argument, the default CD writing device is assumed to be the source device as well. In this case, the copying operation reads the source CD into a temporary directory and prompts you to put a blank CD into the drive for copying to proceed.


Use the CD stated capacity. Without this option, cdrw uses a default value for writable discs, which is 74 minutes for an audio CD or 681,984,000 bytes for a data CD.


Specify CD writing device.


Help. Print usage message.


Specify an image file for creating data CDs. The file size should be less than what can be written on a CD-R or CD-RW disc, which is 681,984,000 bytes by default or the CD stated capacity when you use the -C option. Also, it is better to have the file locally available instead of having it on an NFS-mounted file system because the CD writing process expects data to be available continuously without interruptions.


List all the CD writers found in the system.


Use an alternative temporary directory instead of the system default temporary directory for storing track data while copying a CD. You might use an alternative temporary directory because the amount of data on a CD can be huge (as much as 800 Mbytes for an 80-minute audio CD) and the system default temporary directory might not have that much space.


Report CD status. cdrw reports whether the disc is blank; if not, cdrw reports the table of contents, the last session's start address, and the next writable address if the disc is open.


Keep the disc open. cdrw closes the session, but it keeps the disc open so that another session can be added later to create a multisession disc.


Set the CD writing speed. For example, -p 4 sets the speed to 4X. If you do not specify this option, cdrw uses the default speed of the CD writer. If you specify this option, cdrw tries to set the drive write speed to this value, but the speed actually used by the drive is not guaranteed.


Specify the source device for copying to the CD.


Operate in simulation mode. In this mode, cdrw does everything with the drive laser turned off, so nothing is written to the CD. You can use this option to verify that the system can provide data at a rate good enough for CD writing.


Specify the audio format to use extracting audio files or reading audio files for audio CD creation. The audio type can be sun, wav, cda, or aur.


Use verbose mode.


Extract audio data from an audio track.

Creating Data CDs

To create a data CD, you first prepare the data with the mkisofs(1M) command to convert the file and file format into the High Sierra format used on CDs. When creating data CDs, cdrw uses the track-at-once mode of writing. Use the -i option to specify a file that contains the data to write on CD media. If you do not specify a file, cdrw reads data from standard input.

The following example creates a data CD.

example% cdrw -i /local/iso_image

The following example creates a CD from the directory tree /home/foo.

example% mkisofs -r /home/foo 2>/dev/null | cdrw -i -p 1

Creating Audio CDs

Use the -a option to create an audio CD. You can specify single or multiple audio files. All of the audio files should be in the supported audio formats.

The currently approved formats are listed in Table 65.

Table 65. Supported Audio Formats for the cdrw Command




Sun .au files with data in Red Book CDDA form.


RIFF (.wav) files with data in Red Book CDDA form.


.cda files with raw CD audio data (that is, 16-bit PCM stereo at 44.1 kHz sample rate in little-endian byte order).


.aur files with raw CD data in big-endian byte order.

The following example extracts an audio track number 1 to /home/foo/song1.wav.

example% cdrw -x -T wav 1 /home/foo/song1.wav

The following example creates an audio CD from wav files on disc.

example% cdrw -a song1.wav song2.wav song3.wav song4.wav

See the cdrw(1) manual page for more information about this command.

    [ Team LiB ] Previous Section Next Section