<chapter id="medcdrw-1"><title>Writing CDs and DVDs (Tasks)</title><highlights><para>This chapter provides step-by-step instructions for writing and copying
data CDs and DVDs and audio CDs with the <command>cdrw</command> command.</para><itemizedlist><listitem><para><olink targetptr="medcdrw-17" remap="internal">How to Restrict User Access
to Removable Media With RBAC</olink></para>
</listitem><listitem><para><olink targetptr="medcdrw-13" remap="internal">How to Identify a CD or DVD
Writer</olink></para>
</listitem><listitem><para><olink targetptr="medcdrw-2" remap="internal">How to Check the CD or DVD Media</olink></para>
</listitem><listitem><para><olink targetptr="medaccess-5" remap="internal">How to Create an ISO 9660 File
System for a Data CD or DVD</olink></para>
</listitem><listitem><para><olink targetptr="medcdrw-24" remap="internal">How to Create a Multi-Session
Data CD</olink></para>
</listitem><listitem><para><olink targetptr="medcdrw-8" remap="internal">How to Create an Audio CD</olink></para>
</listitem><listitem><para><olink targetptr="medcdrw-10" remap="internal">How to Extract an Audio Track
on a CD</olink></para>
</listitem><listitem><para><olink targetptr="medcdrw-12" remap="internal">How to Copy a CD</olink></para>
</listitem><listitem><para><olink targetptr="medcdrw-18" remap="internal">How to Erase CD-RW Media</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="medcdrw-4"><title>Working With Audio CDs and Data CDs and DVDs</title><para>You can use the <command>cdrw</command> command to write file systems
for CDs and DVDs in ISO 9660 format with Rock Ridge or Joliet extensions on
CD-R,CD-RW, DVD-RW, or DVD+RW media devices.</para><para>You can use the <command>cdrw</command> command to perform the following
tasks:</para><itemizedlist><listitem><para>Create data CDs and DVDs.</para>
</listitem><listitem><para>Create audio CDs.</para>
</listitem><listitem><para>Extract audio data from an audio CD.</para>
</listitem><listitem><para>Copy CDs and DVDs.</para>
</listitem><listitem><para>Erase CD-RW media.</para>
</listitem>
</itemizedlist><para>The <command>cdrw</command> command is available starting in the following
releases:</para><itemizedlist><listitem><para>Software Supplement for the Solaris 8 Operating Environment
1/01 CD</para>
</listitem><listitem><para>Part of the <trademark>Solaris</trademark> release starting
in the Solaris 9 release</para>
</listitem>
</itemizedlist><para>For information on recommended CD-R or CD-RW devices, go to:</para><para><ulink url="http://www.sun.com/io_technologies/ihvindex.html" type="url">http://www.sun.com/io_technologies/ihvindex.html</ulink></para><sect2 id="medcdrw-14"><title>CD/DVD Media Commonly Used Terms</title><para>This section defines commonly used terms related to CD/DVD media.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="colspec0" colwidth="36.16*"/><colspec colname="colspec1" colwidth="63.84*"/><thead><row rowsep="1"><entry><para>Term</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para>CD-R</para>
</entry><entry><para>CD read media that can be written once and after that, can only be read
from.</para>
</entry>
</row><row><entry><para>CD-RW</para>
</entry><entry><para>CD rewritable media that can be written to and erased. CD-RW media can
only be read by CD-RW devices.</para>
</entry>
</row><row><entry><para>DVD-R</para>
</entry><entry><para>Digital video disk (recordable) that can be written once and after that,
can only be read from. These devices have much larger capacity than CD-R media.</para>
</entry>
</row><row><entry><para>DVD+R</para>
</entry><entry><para>Digital video disk (recordable) that can be written once and after that,
can only be read from. DVD+R devices have more complete error management system
than DVD-R, which allows for more accurate burning to media, independent of
the quality of the media.</para>
</entry>
</row><row><entry><para>DVD-RW</para>
</entry><entry><para>Digital video disk (rewritable) with storage capacity equal to a DVD-R.
This media can be re-recorded by first erasing the entire disk.</para>
</entry>
</row><row><entry><para>DVD+RW</para>
</entry><entry><para>Digital video disk (random-access rewritable) with storage capacity
equal to a DVD+R.  This medium allows overwriting of individual blocks without
erasing the entire disk.</para>
</entry>
</row><row><entry><para>DVD-RAM</para>
</entry><entry><para>Digital video disk (random access memory, rewritable) with circular
rather than spiral tracks and hard sectoring.</para>
</entry>
</row><row><entry><para>ISO 9660</para>
</entry><entry><para>ISO, an acronym for Industry Standards Organization, is an organization
that sets standards for computer storage formats.</para><para>An ISO 9660 file system is a standard CD or DVD file system that enables
you to read the same CD or DVD on any major computer platform. The standard,
issued in 1988, was written by an industry group named High Sierra, named
after the High Sierra Hotel in Nevada. Almost all computers with CD or DVD
drives can read files from an ISO 9660 file system.</para>
</entry>
</row><row><entry><para>Joliet extensions</para><para>Rock Ridge extensions</para>
</entry><entry><para>Adds Windows file system information.</para><para>Adds UNIX file system information. (Rock Ridge is named after the town
in the movie Blazing Saddles.)</para><note><para>These extensions are not exclusive. You can specify both <command>mkisofs</command> <option>R</option> and <option>j</option> options for compatibility
with both systems. (See mkisofs(1M) for details.)</para>
</note>
</entry>
</row><row><entry><para>MMC-compliant recorder</para>
</entry><entry><para>Acronym for Multi Media Command, which means these recorders comply
with a common command set. Programs that can write to one MMC-compliant recorder
should be able to write to all other recorders.</para>
</entry>
</row><row><entry><para>Red Book CDDA</para>
</entry><entry><para>Acronym for Compact Disc Digital Audio, which is an industry standard
method for storing digital audio on compact discs. Also known by the term &ldquo;Red
Book&rdquo; format. The official industry specification calls for one or more
audio files sampled in 16-bit stereo sound at a sampling rate of 44.1 kilohertz
(kHz).</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>Commonly used terms when writing to CD media are:</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="colspec0" colwidth="36.36*"/><colspec colname="colspec1" colwidth="63.64*"/><thead><row rowsep="1"><entry><para>Term</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para>blanking</para>
</entry><entry><para>The process of erasing data from the CD-RW media.</para>
</entry>
</row><row><entry><para><command>mkisofs</command></para>
</entry><entry><para>The command to create ISO file system on a CD.</para>
</entry>
</row><row><entry><para>session</para>
</entry><entry><para>A complete track with lead-in and lead-out information.</para>
</entry>
</row><row><entry><para>track</para>
</entry><entry><para>A complete data or audio unit.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect2>
</sect1><sect1 id="medcdrw-33"><title>Writing CD and DVD Data and Audio CDs</title><para>The process of writing to a CD or DVD cannot be interrupted and needs
a constant stream of data. Consider using the <command>cdrw</command> <option>S</option> 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.</para><itemizedlist><para>Write errors can be caused by one of the following problems:</para><listitem><para>The media cannot handle the drive speed. For
example, some media are only certified for 2x or 4x speeds.</para>
</listitem><listitem><para>The system is running too many heavy processes that are starving
the writing process.</para>
</listitem><listitem><para>Network congestion is causing delays in reading the image,
and the image is on a remote system.</para>
</listitem><listitem><para>The source drive is slower than the destination drive.</para>
</listitem>
</itemizedlist><para>If any of these problems occur, you can lower the writing speed of the
device by using the <command>cdrw</command> <option>p</option> option.</para><para>For example, the following command shows how to simulate writing at
4x speed:</para><screen>$ <userinput>cdrw -iS -p 4 image.iso</userinput></screen><note><para>CD-R, CD-RW (not MRW formatted), DVD-R, and DVD-RW media support
simulation mode (<option>S</option>), 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:</para><screen>Media does not support simulated writing</screen><para>For more information about media types, see <olink targetptr="medcdrw-14" remap="internal">CD/DVD
Media Commonly Used Terms</olink>.</para>
</note><para>You can also use the <command>cdrw</command> <option>C</option> option
to use the stated media capacity for copying an 80-minute CD. Otherwise, the <command>cdrw</command> command uses a default value of 74 minutes for copying an audio
CD.</para><para>For more information, see <olink targetdoc="refman1" targetptr="cdrw-1" remap="external"><citerefentry><refentrytitle>cdrw</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>.</para><sect2 id="medcdrw-16"><title>Restricting User Access to Removable Media With
RBAC</title><para>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.</para><para>For a discussion of using roles, see <olink targetdoc="sysadv6" targetptr="rbac-1" remap="external"><citetitle remap="section">Role-Based Access Control (Overview)</citetitle> in <citetitle remap="book">System Administration Guide: Security Services</citetitle></olink>.</para>
</sect2><task id="medcdrw-17"><title>How to Restrict User Access to Removable Media
With RBAC</title><procedure><step><para>Become superuser or assume an equivalent role.</para>
</step><step id="medcdrw-step-23"><para>Start the Solaris Management Console.</para><screen>$ <userinput>/usr/sadm/bin/smc &amp;</userinput> </screen><para>For more information on starting the console, see <olink targetdoc="sysadv1" targetptr="smcover-18" remap="external"><citetitle remap="section">Starting the Solaris Management Console</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</step><step id="medcdrw-step-20"><para>Set up a role that includes the Device Management
rights.</para><para>For more information, see <olink targetdoc="sysadv6" targetptr="rbactask-1" remap="external">Chapter 9, <citetitle remap="chapter">Using Role-Based Access Control (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Security Services</citetitle></olink>.</para>
</step><step id="medcdrw-step-21"><para>Add users who need to use the <command>cdrw</command> command
to the newly created role.</para>
</step><step id="medcdrw-step-22"><para>Comment the following line in the <userinput>/etc/security/policy.conf</userinput> file:</para><screen>AUTHS_GRANTED=solaris.device.cdrw</screen><para>If you do not do this step, all users still have access to the <command>cdrw</command> command, not just the members of the device management role.</para><para>After this file is modified, the device management role members are
the only users who can use the <command>cdrw</command> command. Everyone else
is denied access with the following message:</para><screen>Authorization failed, Cannot access disks.</screen>
</step>
</procedure>
</task><task id="medcdrw-13"><title>How to Identify a CD or DVD Writer</title><procedure><step><para>Identify the CD or DVD writers on the system.</para><para>For
example:</para><screen>$ <userinput>cdrw -l</userinput>
Looking for CD devices...
    Node              |    Connected Device            |  Device type
----------------------+--------------------------------+-----------------
 cdrom0               | YAMAHA   CRW8824S         1.0d | CD Reader/Writer</screen>
</step><step><para>Identify a specific CD or DVD writer.</para><para>For example:</para><screen>$ <userinput>cdrw -a</userinput> <replaceable>filename.wav</replaceable> <userinput>-d cdrom2</userinput></screen>
</step><step><para>Identify whether the media is blank or whether a table of contents
exists on the media.</para><para>For example:</para><screen>$ <userinput>cdrw -M</userinput>

Device : YAMAHA   CRW8824S        
Firmware : Rev. 1.00 (26/04/00)
Media is blank
%</screen>
</step>
</procedure>
</task><task id="medcdrw-2"><title>How to Check the CD or DVD Media</title><tasksummary><para>The <command>cdrw</command> command works with or without removable
media services running. For more information about disabling or enabling removable
media services, see <olink targetptr="medaccess-12244" remap="internal">How to Disable or Enable
Removable Media Services</olink>.</para>
</tasksummary><procedure><step id="medcdrw-step-1"><para>Insert a CD or DVD into the drive.</para><para>The
CD or DVD can be any CD or DVD that the drive can read.</para>
</step><step id="medcdrw-step-4"><para>Check that the drive is connected properly
by listing the drive.</para><screen>$ <userinput>cdrw -l</userinput>
 Looking for CD devices...
    Node                   Connected Device                Device type
----------------------+--------------------------------+-----------------
 cdrom1               | YAMAHA   CRW8824S         1.0d | CD Reader/Writer</screen>
</step><step id="medcdrw-step-5"><para>(Optional) If you do not see the drive in
the list, select one of the following so that the system recognizes the drive.</para><itemizedlist><listitem><para>Add the drive without rebooting the system</para><screen># <userinput>drvconfig</userinput>
# <userinput>disks</userinput></screen><para>Then restart removable media services.</para>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><sect2 id="medcdrw-20"><title>Creating a Data CD or DVD</title><para>Prepare the data first by using the <command>mkisofs</command> command
to convert the file and file information into the High Sierra format used
on CDs or DVDs.</para>
</sect2><task id="medaccess-5"><title>How to Create an ISO 9660 File System for a
Data CD or DVD</title><procedure><step id="medcdrw-step-10"><para>Insert a blank CD or DVD into the drive.</para>
</step><step id="medcdrw-step-2"><para>Create the ISO 9660 file system on the new
CD or DVD.</para><screen>$ <userinput>mkisofs -r</userinput> <replaceable>/pathname</replaceable> <replaceable>> cd-file-system</replaceable></screen><variablelist><varlistentry><term><option>r</option></term><listitem><para>Creates Rock Ridge information and resets file ownerships
to zero.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>/pathname</replaceable></term><listitem><para>Identifies the path name used to create the ISO 9660 file
system.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>> cd-file-system</replaceable></term><listitem><para>Identifies the name of the file system to be put on the CD
or DVD.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="medcdrw-step-8"><para>Copy the file system onto the CD or DVD.</para><screen>$ <userinput>cdrw -i</userinput> <replaceable>cd-file-system</replaceable></screen><para>The <option>i</option> <replaceable>cd-file-system</replaceable> specifies
the image file for creating a data CD or DVD.</para>
</step>
</procedure><example id="fncpn"><title>Creating an ISO 9660 File System for a Data CD or DVD</title><para>The following example shows how to create an ISO 9660 file system for
a data CD or DVD.</para><screen>$ <userinput>mkisofs -r /home/dubs/ufs_dir > ufs_cd</userinput>
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)</screen><para>Then, copy the file system onto the CD or DVD.</para><screen>$ <userinput>cdrw -i ufs_cd</userinput>
Initializing device...done.
Writing track 1...done.
Finalizing (Can take several minutes)...done.</screen>
</example>
</task><task id="medcdrw-24"><title>How to Create a Multi-Session Data CD</title><tasksummary><para>This procedure describes how to put more than one session on a CD. This
procedure includes an example of copying the <filename>infoA</filename> and <filename>infoB</filename> directories onto the CD.</para>
</tasksummary><procedure><step id="medcdrw-step-27"><para>Create the file system for the first CD session.</para><screen>$ <userinput>mkisofs -o infoA -r -V my_infoA /data/infoA</userinput>
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)</screen><variablelist><varlistentry><term><option>o</option> <filename>infoA</filename></term><listitem><para>Identifies the name of the ISO file system.</para>
</listitem>
</varlistentry><varlistentry><term><option>r</option></term><listitem><para>Creates Rock Ridge information and resets file ownerships
to zero.</para>
</listitem>
</varlistentry><varlistentry><term><option>V</option> <filename>my_infoA</filename></term><listitem><para>Identifies a volume label to be used as the mount point by
removable media services.</para>
</listitem>
</varlistentry><varlistentry><term><filename>/data/infoA</filename></term><listitem><para>Identifies the ISO image directory to create.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="medcdrw-step-28"><para>Copy the ISO file system for the first session
onto the CD.</para><screen>$ <userinput>cdrw -iO infoA</userinput>
Initializing device...done.
Writing track 1...done.
done. 
Finalizing (Can take several minutes)...done.</screen><variablelist><varlistentry><term><option>i</option> <replaceable>infoA</replaceable></term><listitem><para>Identifies the name of the image file to write to the CD.</para>
</listitem>
</varlistentry><varlistentry><term><option>O</option></term><listitem><para>Keeps the CD open for writing.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="medcdrw-step-31"><para>Re-insert the CD after it is ejected.</para>
</step><step id="medcdrw-step-32"><para>Identify the path name of the CD media to
include in the next write session.</para><screen>$ <userinput>eject -n</userinput>
.
.
.
cdrom0 -> /vol/dev/rdsk/c2t4d0/my_infoA</screen><para>Note the <literal>/vol/dev/...</literal> path name.</para>
</step><step id="medcdrw-step-29"><para>Identify the next writeable address on the
CD to write the next session.</para><screen><userinput>% cdrw -M /cdrom</userinput>
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</screen><para>Note the address in the <literal>Next writable address</literal> output
so that you can provide this address when you write the next session.</para>
</step><step id="medcdrw-step-30"><para>Create the next ISO file system for the next
CD session, and write it onto the CD.</para><screen><userinput>$ mkisofs -o infoB -r -C 0,91118 -M /vol/dev/rdsk/c2t4d0/my_infoA 
/data/infoB</userinput>
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)</screen><variablelist><varlistentry><term><option>o</option> <replaceable>infoB</replaceable></term><listitem><para>Identifies the name of the ISO file system.</para>
</listitem>
</varlistentry><varlistentry><term><option>r</option></term><listitem><para>Creates Rock Ridge information and resets file ownerships
to zero.</para>
</listitem>
</varlistentry><varlistentry><term><option>C</option> <replaceable>0,91118</replaceable></term><listitem><para>Identifies the starting address of the first session and the
next writable address.</para>
</listitem>
</varlistentry><varlistentry><term><option>M</option> <filename>/vol/dev/rdsk/c2t4d0/my_infoA</filename></term><listitem><para>Specifies the path of the existing ISO image to be merged.</para>
</listitem>
</varlistentry><varlistentry><term><filename>/data/infoB</filename></term><listitem><para>Identifies the ISO image directory to create.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure>
</task><sect2 id="medcdrw-11"><title>Creating an Audio CD</title><para>You can use the <command>cdrw</command> command to create audio CDs
from individual audio tracks or from <filename>.au</filename> and <filename>.wav</filename> files.</para><para>The supported audio formats are describes in the following table:</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="36.97*"/><colspec colwidth="63.03*"/><thead><row rowsep="1"><entry><para>Format</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>sun</literal></para>
</entry><entry><para>Sun .<filename>au</filename> file with data in Red Book CDDA format</para>
</entry>
</row><row><entry><para><literal>wav</literal></para>
</entry><entry><para>RIFF (.<filename>wav</filename>) file with data in Red Book CDDA format</para>
</entry>
</row><row><entry><para><literal>cda</literal></para>
</entry><entry><para><filename>.cda</filename> file with raw CD audio data, which is 16-bit
PCM stereo at 44.1 kHz sample rate in little-endian byte order</para>
</entry>
</row><row><entry><para><literal>aur</literal></para>
</entry><entry><para><filename>.aur</filename> files with raw CD data in big-endian byte
order</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>If no audio format is specified, the <command>cdrw</command> command
tries to determine the audio file format based on the file extension. The
case of the characters in the extension is ignored.</para>
</sect2><task id="medcdrw-8"><title>How to Create an Audio CD</title><tasksummary><para>This procedure describes how to copy audio files onto a CD.</para>
</tasksummary><procedure><step id="medcdrw-step-12"><para>Insert a blank CD into the CD-RW drive.</para>
</step><step id="medcdrw-step-13"><para>Change to the directory that contains the
audio files.</para><screen>$ <userinput>cd</userinput> <replaceable>/myaudiodir</replaceable></screen>
</step><step id="medcdrw-step-3"><para>Copy the audio files onto the CD.</para><screen>$ <userinput>cdrw -a</userinput> <replaceable>track1.wav track2.wav track3.wav</replaceable></screen><para>The <option>a</option> option creates an audio CD.</para>
</step>
</procedure><example id="fncpo"><title>Creating an Audio CD</title><para>The following example shows how to create an audio CD.</para><screen>$ <userinput>cdrw -a bark.wav chirp.au meow.wav</userinput>
Initializing device...done.
Writing track 1...done.
done. 
Writing track 2...done.
Writing track 3...done.
done. 
Finalizing (Can take several minutes)...done.</screen><para>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.</para><screen>$ <userinput>cdrw -aO groucho.wav chico.au harpo.wav</userinput>
Initializing device...done.
Writing track 1...done.
done. 
Writing track 2...done.
Writing track 3...done.
done. 
Finalizing (Can take several minutes)...done.
&lt;<emphasis>Re-insert CD</emphasis>>
$ <userinput>cdrw -a zeppo.au</userinput>
Initializing device...done.
Writing track 1...done.
done. 
Finalizing (Can take several minutes)...done.</screen>
</example>
</task><task id="medcdrw-10"><title>How to Extract an Audio Track on a CD</title><tasksummary><para>Use the following procedure to extract an audio track from a CD and
copy the audio track to a new CD.</para><para>If you don't use the <command>cdrw</command> <option>T</option> option
to specify the audio file type, the <command>cdrw</command> command uses the
filename extension to determine the audio file type. For example, the <command>cdrw</command> command detects that this file is a <filename>.wav</filename> file.</para><screen>$ <userinput>cdrw -x 1 testme.wav</userinput></screen>
</tasksummary><procedure><step id="medcdrw-step-9"><para>Insert an audio CD into the CD-RW drive.</para>
</step><step id="medcdrw-step-7"><para>Extract an audio track.</para><screen>$ <userinput>cdrw -x -T</userinput> <replaceable>audio-type</replaceable> <userinput>1</userinput> <replaceable>audio-file</replaceable></screen><variablelist><varlistentry><term><option>x</option></term><listitem><para>Extracts audio data from an audio CD.</para>
</listitem>
</varlistentry><varlistentry><term>T <replaceable>audio-type</replaceable></term><listitem><para>Identifies the type of audio file to be extracted. Supported
audio types are <literal>sun</literal>, <literal>wav</literal>, <literal>cda</literal>,
or <literal>aur</literal>. </para>
</listitem>
</varlistentry><varlistentry><term><replaceable>audio-file</replaceable></term><listitem><para>Identifies the audio track to be extracted.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="medcdrw-step-16"><para>Copy the track to a new CD.</para><screen>$ <userinput>cdrw -a</userinput> <replaceable>audio-file</replaceable></screen>
</step>
</procedure><example id="fncps"><title>Extracting and Creating Audio CDs</title><para>The following example shows how to extract the first track from an audio
CD and name the file <filename>song1.wav</filename>.</para><screen>$ <userinput>cdrw -x -T wav 1 song1.wav</userinput>
Extracting audio from track 1...done.</screen><para>This example shows how to copy a track to an audio CD.</para><screen>$ <userinput>cdrw -a song1.wav</userinput>
Initializing device...done.
Writing track 1...done.
Finalizing (Can take several minutes)...done.</screen>
</example>
</task><task id="medcdrw-12"><title>How to Copy a CD</title><tasksummary><para>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.</para><note><para>By default, the <command>cdrw</command> command copies the CD
into the <filename>/tmp</filename> directory. The copying might require up
to 700 Mbytes of free space. If there is insufficient space in the <filename>/tmp</filename> directory for copying the CD, use the <option>m</option> option
to specify an alternate directory.</para>
</note>
</tasksummary><procedure><step><para>Insert an audio CD into a CD-RW drive.</para>
</step><step><para>Create a directory for the audio files.</para><screen>$ <userinput>mkdir /music_dir</userinput></screen>
</step><step id="medcdrw-step-14"><para>Extract the tracks from the audio CD.</para><screen>$ <userinput>cdrw -c -m music_dir</userinput></screen><para>An <literal>Extracting audio ...</literal> message is display for each
track.</para><para>The CD is ejected when all the tracks are extracted.</para>
</step><step id="medcdrw-step-15"><para>Insert a blank CD and press Return.</para><para>After the tracks are extracted, the audio CD is ejected. You are prompted
to insert a blank CD.</para>
</step>
</procedure><example id="fncpt"><title>Copying a CD</title><para>This example shows how to copy one CD to another CD. You must have two
CD-RW devices to do this task.</para><screen>$ <userinput>cdrw -c -s cdrom0 -d cdrom1</userinput></screen>
</example>
</task><task id="medcdrw-18"><title>How to Erase CD-RW Media</title><tasksummary><para>You have to erase existing CD-RW data before the CD can be rewritten.</para>
</tasksummary><procedure remap="single-step"><step id="medcdrw-step-11"><para>Erase the entire media or just the last session
on the CD by selecting one of the following:</para><itemizedlist><listitem><para>Erase the last session only.</para><screen>$ <userinput>cdrw -d cdrom0 -b session</userinput></screen><para>Erasing just the last session with the <option>b session</option> option
is faster than erasing the entire media with the <option>b all</option> option.
You can use the <option>b session</option> option even if you used the <command>cdrw</command> command to create a data or audio CD in just one session.</para>
</listitem><listitem><para>Erase the entire media.</para><screen>$ <userinput>cdrw -d cdrom0 -b all</userinput></screen>
</listitem>
</itemizedlist>
</step>
</procedure>
</task>
</sect1>
</chapter>