Content-type: text/html Man page of cdrw


Section: User Commands (1)
Updated: 20 Mar 2008
Index Return to Main Contents


cdrw - CD read and write  


cdrw -i [-vSCO] [-d device] [-p speed] [image-file]

cdrw -a [-vSCO] [-d device] [-p speed] [-T audio-type] audio-file1 

cdrw -x [-v] [-d device] [-T audio-type] track-number out-file

cdrw -c [-vSC] [-d device] [-p speed] [-m tmp-dir] 
    [-s src-device]

cdrw -b [-v] [-d device] all | session | fast

cdrw -L [-v] [-d device]

cdrw -M [-v] [-d device]

cdrw -l [-v]

cdrw -h



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:


Sun .au files with data in Red Book CDDA form


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


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


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

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:


Erases the last session.


Minimally erases the media.


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.  


The following options are supported:


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.


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.


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.


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.


Specifies the CD or DVD writing device.


Help. Prints usage message.


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.


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


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.


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.


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.


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.


Sets the CD writing speed. For example, -p 4 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.


Specifies the source device for copying a CD or DVD.


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.

CD-R, CD-RW (not MRW formatted), DVD-R, and DVD-RW media support simulation mode (-S). DVD-RAM, DVD+R, DVD+RW, any MRW-formatted media, and some others do not support simulation mode (-S).


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


Verbose mode.


Extracts audio data from an audio track.



Example 1 Creating a Data CD or DVD

example% cdrw -i /local/iso_image

Example 2 Creating a CD or DVD from a Directory

This example shows how to create a CD or DVD from the directory tree /home/foo.

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

Example 3 Extracting an Audio Track Number

This example shows how to extract audio track number 1 to /home/foo/song1.wav.

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

Example 4 Using wav Files

This example shows how to create an audio CD from wav files on disk.

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

Example 5 Erasing CD-RW or DVD-RW Media

This example shows how to erase rewritable media.

example% cdrw -b all

Example 6 Creating a Data CD or DVD with Multiple Drives

This example shows how to create a data CD or DVD on a system with multiple CD, DVD-R, or DVD-RW drives.

example% cdrw -d c1t6d0s2 -i /home/foo/iso-image

Example 7 Checking Data Delivery Rate

This example shows how to verify that the system can provide data to a CD-RW or a DVD drive at a rate sufficient for the write operation.

example% cdrw -S -i /home/foo/iso-image

Example 8 Running at a Higher Priority

This example shows how to run cdrw at a higher priority (for root user only).

example# priocntl -e -p 60 cdrw -i /home/foo/iso-image

Example 9 Creating a Multi-session Disk

This examples shows how to create the first session image by using mkisofs and recording it onto the disk without closing the disk.

example% cdrw -O -i /home/foo/iso-image

Additional sessions can be added to an open disk by creating an image with mkisofs using the session start and next writable address reported by cdrw.

example% cdrw -M

Track No. |Type    |Start address
1        |Data    | 0
Leadout   |Data    | 166564

Last session start address: 162140
Next writable address: 173464

example% mkisofs -o /tmp/image2 -r -C 0,173464 -M \
  /dev/rdsk/c0t2d0s2 /home/foo



See attributes(5) for descriptions of the following attributes:





audioconvert(1), priocntl(1), attributes(5), rbac(5), scsa2usb(7D), sd(7D)

mkisofs(8), (/usr/share/man/man8/mkisofs.8), in the SUNWfsman package



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.

The cdrw command uses rbac(5) to control user access to the devices. By default, cdrw is accessible to all users but can be restricted to individual users. Refer to the for more information.



Creating Data CDs
Creating Data DVDs
Creating Audio CDs
Extracting Audio
Copying CDs
Erasing CD-RW or DVD-RW Media
Checking device-list or media-status

This document was created by man2html, using the manual pages.
Time: 02:39:28 GMT, October 02, 2010