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 | fast
cdrw -L [-v] [-d device]
cdrw -M [-v] [-d device]
cdrw -l [-v]
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).
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.
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.
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.
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.
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.
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:
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.
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:
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).
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.