Description

The cdrw command provides the ability to create data and audio CDs. This command also provides the ability to extract audio tracks from an audio CD and to create data DVDs. The CD or DVD device must be MMC-compliant to create a CD or DVD with the cdrw command.

cdrw searches for a CD or DVD writer connected to the system, unless you specify a device with the -d option. If cdrw finds a single such device, it uses that device as the default CD or DVD writer for the command.

When more than one CD or DVD writer is connected to the system, use the -d option to indicate which device is desired. The device name can be specified in one of the following ways: /dev/rdsk/cNtNdNsN, cNtNdNsN, cNtNdN, or a name used by volume manager, such as cdrom or cdrom1. Using the -l option provides a list of CD or DVD writers.

For instructions on adding a USB-mass-storage-class-compliant CD-RW or DVD–RW device to your system, see scsa2usb(7D).

Creating Data 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 don't specify this option, cdrw reads data from standard input.

In either case, the data is typically prepared by using the mkisofs command to convert the file and file information into the High Sierra format used on CDs. See the examples that include use of this command.

Creating Data DVDs

cdrw can create single-session data DVDs on DVD+RW or DVD-RW devices using images generated from mkisofs. These disks can be mounted as HSFS file systems. When making data DVDs, cdrw uses Disk-At-Once (DAO) mode of writing, which closes
the media when writing is completed and prevents any further sessions from being added. The image should be prepared in advance when writing an image to the DVD media since DAO mode requires that the size of the image be known in advance.

Creating Audio CDs

Use the -a option to create an audio CD. Single or multiple audio files can be specified with this option. All of the audio files should be in a supported audio format. Currently approved formats are:

If no audio format is specified, cdrw tries to identify the audio file format based on the file extension. The case of the characters in the extension is ignored. If a format is specified using the -T option, it is assumed to be the audio file type for
all the files specified. Also, using the -c option closes the session after writing the audio tracks. Therefore, the tracks to be written should be specified in a single command line.

Extracting Audio

cdrw can also be used for extracting audio data from an audio CD with the -x option. The CD should have tracks in Red Book CDDA form. By default, the output format is based on the file extension. A user can specify a sun, wav, cda, or aur output format with the -T option.

Copying CDs

cdrw can be used to copy single session data CD-ROMs and Red Book audio CDs. When copying a CD, cdrw looks for a specified source device. If no source device is specified when using the -c option, the current CD writer is assumed to be
the source. cdrw extracts the track or tracks into a temporary file and looks for a blank writable CD-R/RW media in the current CD writer. If no media is found, insert a blank writable CD media in the current CD writer. If the default temporary directory does not have enough
space, an alternate directory can be specified by using the -m option.

Erasing CD-RW or DVD-RW Media

Users have to erase the CD-RW media before it can be rewritten. With the -b option, the following flavors of erasing are currently supported:

session

Erases the last session.

fast

Minimally erases the media.

all

Erases the entire media.

If the session erasing type is used, cdrw erases the last session. If there is only one session recorded on the CD-RW (for example, a data or audio CD-RW created by this tool), then session erasing only erases the portion that is recorded, leaving behind a blank disk.
This is faster than erasing the entire media. For DVD media, using the -b session erases the whole media.

The fast erasing type minimally erases the entire media by removing the PMA and TOC of the first session. It does not erase the user data and subsequent tracks on the media, but the media is treated as if it were a blank disk. If a
complete erase is of the media is necessary, use the all option.

The all erasing type should be used if it is a multisession disk, the last session is not closed, or disk status is unknown, and you want to erase the disk. With this type of erasing, cdrw erases the entire disk.

DVD+RW media does not support erasing. To re-use DVD+RW media, simply write a new image onto the media. cdrw formats and overwrites the existing media automatically.

Checking device-list or media-status

You can list a system's CD or DVD writers by using the -l option. Also, for a particular media, you can get the blanking status and table of contents by using the -M option. The -M option also prints information about the last session's start
address and the next writable address. This information, along with the -O option, can be used to create multisession CDs. Refer to the mkisofs(8) man page, (/usr/share/man/man8/mkisofs.8),
in the SUNWfsman package for more information.

Options

The following options are supported:

-a

Creates an audio disk. At least one audio-file name must be specified. A CD can not have more than 99 audio tracks, so no more than 99 audio files can be specified. Also, the maximum audio data that can be written to the media by default is 74 minutes,
unless -C is specified.

-b

Blanks CD-RW or DVD-RW media. The type of erasing must be specified by the all, fast, or session argument. DVD+RW media does not support blanking, but can be rewritten without the need for blanking.

-c

Copies a CD. If no other argument is specified, the default CD writing device is assumed to be the source device as well. In this case, the copy operation reads the source media into a temporary directory and prompts you to place a blank media into the drive for the copy operation
to proceed.

-C

Uses stated media capacity. Without this option, cdrw uses a default value for writable CD media, which is 74 minutes for an audio CD, 681984000 bytes for a data CD, or 4.7 Gbytes for a DVD.

-d

Specifies the CD or DVD writing device.

-h

Help. Prints usage message.

-i

Specifies the image file for creating data CDs or DVDs. The file size should be less than what can be written on the media. Also, consider having the file locally available instead of having the file on an NFS-mounted file system. The CD writing process expects data to be available
continuously without interruptions.

-l

Lists all the CD or DVD writers available on the system.

-L

Closes the disk. If the media was left in an open state after the last write operation, it is closed to prevent any further writing. This operation can only be done on re-writable CD-RW media.

-m

Uses an alternate temporary directory instead of the default temporary directory for storing track data while copying a CD or DVD. An alternate temporary directory might be required because the amount of data on a CD can be huge. For example, the amount of data can be as much as
800 Mbytes for an 80 minute audio CD and 4.7 Gbytes for a DVD. The default temporary directory might not have that much space available.

-M

Reports media status. cdrw reports if the media is blank or not, its table of contents, the last session's start address, and the next writable address if the disk is open. DVD+RW does not support erasing and always has some content on the media.

-O

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

-p

Sets the CD writing speed. For example, -p4 sets the speed to 4X. If this option is not specified, cdrw uses the default speed of the CD writer. If this option is specified, cdrw tries to set the drive write
speed to this value, but there is no guarantee of the actual speed that is used by the drive.

-s

Specifies the source device for copying a CD or DVD.

-S

Simulation mode. In this mode, cdrw operates with the drive laser turned off, so nothing is written to the media. Use this option to verify if the system can provide data at a rate good enough for CD writing.

Notes

The CD writing process requires data to be supplied at a constant rate to the drive. Keep I/O activity to a minimum and shut down any related I/O applications while writing CDs.

When making copies or extracting audio tracks, use an MMC compliant source CD-ROM drive. The CD writer can be used for this purpose.

Before writing a CD, ensure that the media is blank by using the -M option. You can use the -S simulation mode to test the system to make sure it can provide data at the required rate. cdrw turns on buffer underrun protection for drives
that support it and recovers from most stalls. If the system is not able to provide data at a constant rate or frequent stalling occurs, you can lower the speed by using the -p option. You can also try to run cdrw at a higher priority by using the priocntl(1) command.

If you know that the CD-R/RW drive can operate at different write speeds, use the -p option. Some commercially available drives handle the drive speed setting command differently, so use this option judiciously.

Most commercially available drives allow writing beyond 74 minutes as long as the media has the capacity (such as 80–minute media). However, the ability to write beyond 74 minutes might not be supported by the drive in use. If the drive supports this feature, then use the -C option
to indicate that the tool should rely on the capacity indicated by the media.