System Administration Guide: Devices and File Systems
Previous Next

Writing CD and DVD Data and Audio CDs

The process of writing to a CD or DVD cannot be interrupted and needs a constant stream of data. Consider using the cdrw -S option to simulate writing to the media to verify that the system can provide data at a sufficient rate for writing to the CD or DVD.

Write errors can be caused by one of the following problems:

  • 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 are starving the writing process.

  • Network congestion is causing delays in reading the image, and the image is on a remote system.

  • The source drive is slower than the destination drive.

If any of these problems occur, you can lower the writing speed of the device by using the cdrw -p option.

For example, the following command shows how to simulate writing at 4x speed:

$ cdrw -iS -p 4 image.iso

Note - CD-R, CD-RW (not MRW formatted), DVD-R, and DVD-RW media support simulation mode (-S), but DVD-RAM, DVD+R, DVD+RW, and any MRW-formatted media and some others do not support simulation mode. The following message is displayed if simulation mode is not supported:

Media does not support simulated writing

For more information about media types, see CD/DVD Media Commonly Used Terms.


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).

Restricting User Access to Removable Media With RBAC

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 Role-Based Access Control (Overview) in System Administration Guide: Security Services.

How to Restrict User Access to Removable Media With RBAC

  1. Become superuser or assume an equivalent role.
  2. Start the Solaris Management Console.
    $ /usr/sadm/bin/smc & 

    For more information on starting the console, see Starting the Solaris Management Console in System Administration Guide: Basic Administration.

  3. Set up a role that includes the Device Management rights.

    For more information, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  4. Add users who need to use the cdrw command to the newly created role.
  5. 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.

How to Identify a CD or DVD Writer

  1. Identify the CD or DVD writers on the system.

    For example:

    $ cdrw -l
    Looking for CD devices...
        Node              |    Connected Device            |  Device type
    ----------------------+--------------------------------+-----------------
     cdrom0               | YAMAHA   CRW8824S         1.0d | CD Reader/Writer
  2. Identify a specific CD or DVD writer.

    For example:

    $ cdrw -a filename.wav -d cdrom2
  3. Identify whether the media is blank or whether a table of contents exists on the media.

    For example:

    $ cdrw -M
    
    Device : YAMAHA   CRW8824S        
    Firmware : Rev. 1.00 (26/04/00)
    Media is blank
    %

How to Check the CD or DVD Media

The cdrw command works with or without removable media services running. For more information about disabling or enabling removable media services, see How to Disable or Enable Removable Media Services.

  1. Insert a CD or DVD into the drive.

    The CD or DVD can be any CD or DVD that the drive can read.

  2. Check that the drive is connected properly by listing the drive.
    $ cdrw -l
     Looking for CD devices...
        Node                   Connected Device                Device type
    ----------------------+--------------------------------+-----------------
     cdrom1               | YAMAHA   CRW8824S         1.0d | CD Reader/Writer
  3. (Optional) If you do not see the drive in the list, select one of the following so that the system recognizes the drive.
    • Add the drive without rebooting the system

      # drvconfig
      # disks

      Then restart removable media services.

Creating a Data CD or DVD

Prepare the data first by using the mkisofs command to convert the file and file information into the High Sierra format used on CDs or DVDs.

How to Create an ISO 9660 File System for a Data CD or DVD

  1. Insert a blank CD or DVD into the drive.
  2. Create the ISO 9660 file system on the new CD or DVD.
    $ mkisofs -r /pathname > cd-file-system
    -r

    Creates Rock Ridge information and resets file ownerships to zero.

    /pathname

    Identifies the path name used to create the ISO 9660 file system.

    > cd-file-system

    Identifies the name of the file system to be put on the CD or DVD.

  3. Copy the file system onto the CD or DVD.
    $ cdrw -i cd-file-system

    The -i cd-file-system specifies the image file for creating a data CD or DVD.

Example 4-1 Creating an ISO 9660 File System for a Data CD or DVD

The following example shows how to create an ISO 9660 file system for a data CD or DVD.

$ 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 file system onto the CD or DVD.

$ cdrw -i ufs_cd
Initializing device...done.
Writing track 1...done.
Finalizing (Can take several minutes)...done.

How to Create a Multi-Session Data CD

This procedure describes how to put more than one session on a CD. This procedure includes an example of copying the infoA and infoB directories onto the CD.

  1. 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 removable media services.

    /data/infoA

    Identifies the ISO image directory to create.

  2. 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.

  3. Re-insert the CD after it is ejected.
  4. Identify the path name of the CD media to include in the next write session.
    $ eject -n
    .
    .
    .
    cdrom0 -> /vol/dev/rdsk/c2t4d0/my_infoA

    Note the /vol/dev/... path name.

  5. 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 that you can provide this address when you write the next session.

  6. 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.

Creating an Audio CD

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 describes in the following table:

Format

Description

sun

Sun .au file with data in Red Book CDDA format

wav

RIFF (.wav) file with data in Red Book CDDA format

cda

.cda file 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.

How to Create an Audio CD

This procedure describes how to copy audio files onto a CD.

  1. Insert a blank CD into the CD-RW drive.
  2. Change to the directory that contains the audio files.
    $ cd /myaudiodir
  3. Copy the audio files onto the CD.
    $ cdrw -a track1.wav track2.wav track3.wav

    The -a option creates an audio CD.

Example 4-2 Creating 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. You would need to 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.

How to Extract an Audio Track on a CD

Use the following procedure to extract an audio track from a CD and copy the audio track to a new CD.

If you don't use the cdrw -T option to specify the audio file type, the cdrw command 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
  1. Insert an audio CD into the CD-RW drive.
  2. 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.

    audio-file

    Identifies the audio track to be extracted.

  3. Copy the track to a new CD.
    $ cdrw -a audio-file
Example 4-3 Extracting and Creating Audio CDs

The following example shows how to extract the first track from an audio CD and name the file song1.wav.

$ cdrw -x -T wav 1 song1.wav
Extracting audio from track 1...done.

This example shows 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.

How to Copy a CD

This procedure describes how to extract all the tracks from an audio CD into a directory and then copy all of them onto a blank CD.


Note - 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.


  1. Insert an audio CD into a CD-RW drive.
  2. Create a directory for the audio files.
    $ mkdir /music_dir
  3. Extract the tracks from the audio CD.
    $ cdrw -c -m music_dir

    An Extracting audio ... message is display for each track.

    The CD is ejected when all the tracks are extracted.

  4. Insert a blank CD and press Return.

    After the tracks are extracted, the audio CD is ejected. You are prompted to insert a blank CD.

Example 4-4 Copying a CD

This example shows 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

How to Erase CD-RW Media

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
Previous Next