The process of writing to a CD cannot be interrupted and needs a constant stream of data. Consider using the cdrw -S option to simulate writing to the media to verify if the system can provide data at a rate good enough for writing to the CD.
Write errors can be caused by one of the following:
The media cannot handle the drive speed. For example, some media are only certified for 2x or 4x speeds.
The system is running too many heavy processes that can starve the writing process.
Network congestion can cause delays in reading the image if the image is on a remote system.
The source drive might be slower than the destination drive when copying from CD-to-CD.
If any of these problems occur, you can lower the writing speed of the device with the cdrw -p option.
For example, simulate writing at 4x speed.
$ cdrw -iS -p 4 image.iso |
You can also use the cdrw -C option to use the stated media capacity for copying an 80–minute CD. Otherwise, the cdrw command uses a default value of 74 minutes for copying an audio CD.
For more information, see cdrw(1).
By default, all users can access removable media starting in the Solaris 9 release. However, you can restrict user access to removable media by setting up a role through role based access control (RBAC). Access to removable media is restricted by assigning the role to a limited set of users.
For a discussion of using roles, see “RBAC Roles” in System Administration Guide: Security Services.
Become superuser or assume an equivalent role.
Start the Solaris Management Console.
$ /usr/sadm/bin/smc & |
For more information on starting the console, see How to Start the Solaris Management Console in a Name Service Environment.
Set up a role that includes the Device Management rights.
For more information, see “How to Create a Role by Using the Administrative Roles Tool” in System Administration Guide: Security Services.
Add users who need to use the cdrw command to the newly created role.
Comment the following line in the /etc/security/policy.conf file.
AUTHS_GRANTED=solaris.device.cdrw |
If you do not do this step, all users still have access to the cdrw command, not just the members of the device management role.
After this file is modified, the device management role members are the only users who can use the cdrw command. Everyone else is denied access with the following message:
Authorization failed, Cannot access disks. |
Use the cdrw -l command to identify the CD writers on the system.
$ cdrw -l Looking for CD devices... Node | Connected Device | Device type ----------------------+--------------------------------+----------------- cdrom0 | YAMAHA CRW8424S 1.0d | CD Reader/Writer |
If you want to use a specific CD writer, use the -d option. For example:
$ cdrw -a filename.wav -d cdrom2 |
Use the cdrw -M command to to identify whether the media is blank or whether there is an existing table of contents.
$ cdrw -M Device : YAMAHA CRW8424S Firmware : Rev. 1.0d (06/10/99) Media is blank % |
The cdrw command works with or without vold running. However, you must have superuser or role access to stop and start the vold daemon.
Insert a CD into the CD-RW device.
The CD can be any CD that the device can read.
Check that the CD-RW drive is connected properly by listing the device.
$ cdrw -l Looking for CD devices... Node Connected Device Device type ----------------------+--------------------------------+----------------- cdrom1 | YAMAHA CRW8424S 1.0d | CD Reader/Writer |
(Optional) If you do not see the drive in the list, you might have to do a reconfiguration boot so that the system recognizes the device.
# touch /reconfigure # init 6 |
Or, use the following commands to add the CD-RW device without rebooting the system.
# drvconfig # disks |
Then restart vold.
# /etc/init.d/vold stop # /etc/init.d/vold start |
Prepare the data first by using the mkisofs command to convert the file and file information into the High Sierra format used on CDs.
Insert a blank CD into the CD-RW device.
Create the ISO 9660 file system on the new CD.
$ mkisofs -r /pathname > cd-file-system |
-r |
Creates Rock Ridge information and resets file ownerships to zero. |
/pathname |
Identifies the pathname used to create the ISO 9660 file system. |
> cd-file-system |
Identifies the name of the file system to be put on the CD. |
Copy the CD file system onto the CD.
$ cdrw -i cd-file-system |
-i cd-file-system |
Specifies the image file for creating a data CD. |
The following example shows how to create a ISO 9660 file system for a data CD.
$ mkisofs -r /home/dubs/ufs_dir > ufs_cd Total extents actually written = 56 Total translation table size: 0 Total rockridge attributes bytes: 329 Total directory bytes: 0 Path table size(bytes): 10 Max brk space used 8000 56 extents written (0 Mb) |
Then copy the CD file system onto the CD. For example:
$ cdrw -i ufs_cd Initializing device...done. Writing track 1...done. Finalizing (Can take several minutes)...done. |
This procedure describes how to put more than one session on the CD. This procedure includes an example of copying the infoA and infoB directories onto the CD.
Create the file system for the first CD session.
$ mkisofs -o infoA -r -V my_infoA /data/infoA Total translation table size: 0 Total rockridge attributes bytes: 24507 Total directory bytes: 34816 Path table size(bytes): 98 Max brk space used 2e000 8929 extents written (17 Mb) |
-o infoA |
Identifies the name of the ISO file system. |
-r |
Creates Rock Ridge information and resets file ownerships to zero. |
-V my_infoA |
Identifies a volume label to be used as the mount point by vold. |
/data/infoA |
Identifies the ISO image directory to create. |
Copy the ISO file system for the first session onto the CD.
$ cdrw -iO infoA Initializing device...done. Writing track 1...done. done. Finalizing (Can take several minutes)...done. |
-i infoA |
Identifies the name of the image file to write to the CD. |
-O |
Keeps the CD open for writing. |
Re-insert the CD after it is ejected.
Identify the pathname of the CD media to include in the next write session.
$ eject -n . . . cdrom0 -> /vol/dev/rdsk/c2t4d0/my_infoA |
Note the /vol/dev/... pathname.
Identify the next writeable address on the CD to write the next session.
% cdrw -M /cdrom Device : YAMAHA CRW8424S Firmware : Rev. 1.0d (06/10/99) Track No. |Type |Start address ----------+--------+------------- 1 |Audio |0 2 |Audio |33057 3 |Data |60887 4 |Data |68087 5 |Data |75287 Leadout |Data |84218 Last session start address: 75287 Next writable address: 91118 |
Note the address in the Next writable address: output so you can provide this when you write the next session.
Create the next ISO file system for the next CD session and write it onto the CD.
$ mkisofs -o infoB -r -C 0,91118 -M /vol/dev/rdsk/c2t4d0/my_infoA /data/infoB Total translation table size: 0 Total rockridge attributes bytes: 16602 Total directory bytes: 22528 Path table size(bytes): 86 Max brk space used 20000 97196 extents written (189 Mb) |
-o infoB |
Identifies the name of the ISO file system. |
-r |
Creates Rock Ridge information and resets file ownerships to zero. |
-C 0,91118 |
Identifies the starting address of the first session and the next writable address. |
-M /vol/dev/rdsk/c2t4d0/my_infoA |
Specifies the path of the existing ISO image to be merged. |
/data/infoB |
Identifies the ISO image directory to create. |
You can use the cdrw command to create audio CDs from individual audio tracks or from .au and .wav files.
The supported audio formats are:
Format |
Description |
---|---|
sun |
Sun .au files with data in Red Book CDDA format |
wav |
RIFF (.wav) files with data in Red Book CDDA format |
cda |
.cda files with raw CD audio data, which is 16–bit PCM stereo at 44.1 kHz sample rate in little-endian byte order) |
aur |
.aur files with raw CD data in big-endian byte order |
If no audio format is specified, the cdrw command tries to determine the audio file format based on the file extension. The case of the characters in the extension is ignored.
This procedure describes how to copy audio files onto a CD.
Insert a blank CD into the CD-RW device.
Change to the directory that contains the audio files.
$ cd /myaudiodir |
Copy the audio files onto the CD.
$ cdrw -a track1.wav track2.wav track3.wav |
The -a option creates an audio CD.
The following example shows how to create an audio CD.
$ cdrw -a bark.wav chirp.au meow.wav Initializing device...done. Writing track 1...done. done. Writing track 2...done. Writing track 3...done. done. Finalizing (Can take several minutes)...done. |
The following example shows how to create a multisession audio CD. The CD is ejected after the first session is written. Re-insert the CD before the next writing session.
$ cdrw -aO groucho.wav chico.au harpo.wav Initializing device...done. Writing track 1...done. done. Writing track 2...done. Writing track 3...done. done. Finalizing (Can take several minutes)...done. <Re-insert CD> $ cdrw -a zeppo.au Initializing device...done. Writing track 1...done. done. Finalizing (Can take several minutes)...done. |
Use the following procedure to extract an audio track from a CD and copy it to a new CD.
If you don't use the cdrw -T option to specify the audio file type, cdrw uses the filename extension to determine the audio file type. For example, the cdrw command detects that this file is a .wav file.
$ cdrw -x 1 testme.wav |
Insert a audio CD into the CD-RW device.
Extract an audio track.
$ cdrw -x -T audio-type 1 audio-file |
-x |
Extracts audio data from an audio CD. |
T audio-type |
Identifies the type of audio file to be extracted. Supported audio types are sun, wav, cda, or aur. |
Copy the track to a new CD.
$ cdrw -a audio-file |
The following example shows how to extract the first track from an audio CD and names the file song1.wav.
$ cdrw -x -T wav 1 song1.wav Extracting audio from track 1...done. |
This example describes how to copy a track to an audio CD.
$ cdrw -a song1.wav Initializing device...done. Writing track 1...done. Finalizing (Can take several minutes)...done. |
This procedure describes how to extract all the tracks from an audio CD into a directory and then copy all them onto a blank CD.
By default, the cdrw command copies the CD into the /tmp directory. The copying might require up to 700 Mbytes of free space. If there is insufficient space in the /tmp directory for copying the CD, use the -m option to specify an alternate directory.
Insert an audio CD into a CD-RW device.
Extract the tracks from the audio CD.
$ mkdir music_dir $ cdrw -c -m music_dir |
An Extracting audio ... message is display for each track.
The CD is ejected when all the tracks are extracted.
Insert a blank CD and press Return.
After the tracks are extracted, the audio CD is ejected, and you are prompted to insert a blank CD.
This example describes how to copy one CD to another CD. You must have two CD-RW devices to do this task.
$ cdrw -c -s cdrom0 -d cdrom1 |
You have to erase existing CD-RW data before the CD can be rewritten.
Erase the entire media or just the last session on the CD by selecting one of the following:
Erase the last session only.
$ cdrw -d cdrom0 -b session |
Erasing just the last session with the -b session option is faster than erasing the entire media with the -b all option. You can use the -b session option even if you used the cdrw command to create a data or audio CD in just one session.
Erase the entire media.
$ cdrw -d cdrom0 -b all |