Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
User Commandscdrw(1)


NAME

 cdrw - CD read and write

SYNOPSIS

 cdrw -i [-vSCO] [-d device] [-p speed] [image-file]
 cdrw -a [-vSCO] [-d device] [-p speed] [-T audio-type] audio-file1 [audio-file2 ...]
 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
 cdrw -M [-v] [-d device]
 cdrw -l [-v]
 cdrw -h

DESCRIPTION

 

The cdrw command provides the ability to create data and audio CDs. It also provides the ability to extract audio tracks from an audio CD. Any MMC-compliant CD-R or CD-RW drive can be used with cdrw.

cdrw will search for a CD writer device connected to the system, unless the user specifies a device with the -d option. If it finds a single such writer device, it will use that as the default CD writer device for the command.

When more than one CD 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 symbolic name used by volume manager, such as cdrom or cdrom1. The -l option will provide a list of CD writers.

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

Creating Data CDs

 

When creating data CDs, cdrw uses the track-at-once mode of writing. With the -i option, the user will specify a file that contains the data to write on CD media. In the absence of such a file, cdrw will read data from standard input.

In either case, the data will typically first have been prepared by using the mkisofs(1m) 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 Audio CDs

 

For creating an audio CD, using the -a option, single or multiple audio files can be specified. All of the audio files should be in the supported audio formats. Currently approved formats are:

sun
Sun .au files with data in Red Book CDDA form
wav
RIFF (.wav) files with data in Red Book CDDA form
cda
.cda files having raw CD audio data (that is, 16 bit PCM stereo at 44.1 KHz sample rate in little-endian byteorder)
aur
.aur files having raw CD data in big-endian byteorder

If no audio format is specified, cdrw tries to understand 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 will be assumed as the audio file type for all the files specified. Also, -cdrw will close 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 using the -T option.

Copying CDs

 

cdrw can be used to copy single session data CD-ROMs and Red Book audio CDs. For copying a CD, cdrw looks for a specified source device. If no source device is specified when using the -c option, the current CD writing device is assumed to be the source. cdrw will extract the track or tracks into a temporary file and will look for a blank writable CD-R/RW media in the current CD writing device. If no such media is found, the user will be asked to insert a blank writable CD media in the current CD writing device. If enough space is not available in the default temporary directory, an alternative directory can be specified using the -m option.

Erasing CD-RW Media

 

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

session
Erase the last session.
all
Erase the entire media.

If the session erasing type is used, cdrw will erase the last session. If there is only one session recorded on the CD-RW (for example, a data/audio CD-RW created by this tool), then session erasing is useful as it will only erase the portion that is recorded, leaving behind a blank disk. This is faster than erasing the entire media.

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

Checking device-list or media-status

 

The user can get a list of CD writing devices currently present in the system with the -l option. Also, for a particular media, the user can get the blanking status and table of contents through the -M option. The -M option also prints information about the last session start address and the next writable address. This information, along with the -O option, can be used to create multisession CDs. Please refer to mkisofs(1m) 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 a CD-RW media. The type of erasing must be specified by the all or session argument.
-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 copying operation will read the source media into a temporary directory and will prompt the user to place a blank media into the drive for copying to proceed.
-C
Uses media stated capacity. Without this option, cdrw will use a default value for writable CD media, which is 74 minutes for an audio CD or 681984000 bytes for a data CD.
-d
Specifies CD writing device.
-h
Help. Prints usage message.
-i
Specifies image file for creating data CDs. The file size should be less than what can be written on a CD-R or CD-RW media, which is 681984000 bytes by default or the media stated capacity if the -C option is used. Also, it is better to have the file locally available instead of having it on an NFS-mounted filesystem, because the CD writing process expects data to be available continuously without interruptions.
-l
Lists all the CD writers found in the system.
-m
Uses an alternate temporary directory instead of system default temporary directory for storing track data while copying a CD. An alternate temporary directory might be required 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.
-M
Reports media status. cdrw will report 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.
-O
Keeps the disk open. cdrw will close the session, but it will keep 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, -p 4 will set the speed to 4X. If this option is not specified, cdrw will use the default speed of the CD writer. If this option is specified, cdrw will try to set the drive write speed to this value, but there is no guarantee of the speed actually used by the drive.
-s
Specifies source device for copying CD.
-S
Simulation mode. In this mode, cdrw will do everything with the drive laser turned off, so nothing will be written to the media. This can be used to verify if the system can provide data at a rate good enough for CD writing.
-T
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.
-v
Verbose mode.
-x
Extracts audio data from an audio track.

EXAMPLES

 Example 1. Creating a data CD
 
 
example% cdrw -i /local/iso_image
Example 2. Creating a CD from a directory
 

This example creates a CD 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 extracts 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 creates an audio CD from wav files on disk:

 
example% cdrw -a song1.wav song2.wav song3.wav song4.wav
Example 5. Erasing a CD-RW media
 

This example erases a CD-RW media in a CD-RW drive:

 
example% cdrw -b all
Example 6. Creating a data CD with multiple drives
 

This example creates a data CD on a system with multiple CD-R/RW drives:

 
example% cdrw -d c1t6d0s2 -i /home/foo/iso-image
Example 7. Checking data delivery rate
 

This example checks if the system can provide data to a CD-RW 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 runs 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
 

Create the first session image using mkisofs(1m) and record 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(1m) 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

ATTRIBUTES

 

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

ATTRIBUTE TYPEATTRIBUTE VALUE
AvailabilitySUNWcdrw

SEE ALSO

 

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

NOTES

 

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

When making copies or extracting audio tracks, it is better to use an MMC compliant source CD-ROM drive. The CD writing device can be used for this purpose.

Before writing a CD, ensure that the media is blank by using the -M option and use the -S simulation mode to test the system to make sure it can provide data at the required rate. In case the system is not able to provide data at the required rate, try simulation with a slower write speed set through the -p option. Users can also try to run cdrw at a higher priority using the priocntl(1) command.

The -p option is provided for users who are aware of the CD-R/RW drive and its capabilities to operate at different write speeds. 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, such capability of writing beyond 74 minutes might not be supported by the drive in use. If the drive being used supports such capability, 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. Please refer to "Administering CD-R/CD-RW devices" in the System Administration Guide: Basic Administration for more information.


SunOS 5.9Go To TopLast Changed 21 Aug 2001

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.