Chapter 20 Writing CDs (Tasks)
This chapter provides step-by-step instructions for writing
and copying data and audio CDs with the cdrw command.
Working with Audio and Data CDs
This Solaris release provides the cdrw command, which
enables you to write CD file systems in ISO 9660 format with Rock Ridge or
Joliet extensions on CD-R or CD-RW media devices.
You can use the cdrw command to:
The cdrw command is available on the Software Supplement
for the Solaris 8 Operating Environment 1/01 CD and is also part of the Solaris
9 release.
For information on recommended CD-R or CD-RW devices, go to http://www.sun.com/io_technologies/pci/removable.html.
For information on copying a Solaris CD, see the Building
a Bootable JumpstartTM Installation CD-ROM
article from http://www.sun.com/blueprints/browsesubject.html.
CD Media Commonly Used Terms
Commonly used terms when referring to CD media are:
|
Term
|
Description
|
|
CD-R
|
CD read media that can be written once and after that, can only be read from.
|
|
CD-RW
|
CD rewritable media that can be written to and erased. CD-RW media can only
be read by CD-RW devices.
|
|
ISO 9660
|
ISO, an acronym for Industry Standards Organization, is an organization that
sets standards computer storage formats.
An ISO 9660 file system
is a standard CD-ROM file system that enables you to read the same CD-ROM
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-ROM drives can read files from an
ISO 9660 file system.
|
|
Joliet extensions
Rock Ridge
extensions
|
Adds WindowsTM file system information.
Adds UNIXTM file system information. (Rock Ridge is named after the town
in Blazing Saddles.)
Note –
These extensions are not exclusive.
You can specify both mkisofs -R and -j options for compatibility with both systems. (See mkisofs(1M) for
details).
|
|
MMC-compliant record
|
Acronym for Multi Media Command, which means these
recorder comply with a common command set. Programs that can write to one
MMC-compliant recorder should be able to write to all others.
|
|
Red Book CDDA
|
Acronym for Compact
Disc Digital Audio, which is an industry standard method for storing digital
audio on compact discs. It is also known by the term "Red Book" 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).
|
Commonly used terms when working with the CD media are:
|
Term
|
Description
|
|
blanking
|
The process of erasing data from the CD-RW media.
|
|
mkisofs
|
Command for making a ISO file system to write
onto a CD.
|
|
session
|
A complete track with
lead-in and lead-out information.
|
|
track
|
A complete data or audio unit.
|
Writing Data and Audio CDs
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) .
Restricting User Access to Removable Media with RBAC
By default, all users can access removable media 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.
How to Restrict User Access to Removable Media with RBAC
-
Become superuser or assume an equivalent role.
-
Start the Solaris Management Console.
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.
|
How to Identify a CD Writer
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
%
|
How to Check the CD Media
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.
Then restart vold.
# /etc/init.d/vold stop
# /etc/init.d/vold start
|
Creating a Data CD
Prepare the data first by using the mkisofs command
to convert the file and file information into the High Sierra format used
on CDs.
How to Create an ISO 9660 File System for a Data CD
-
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.
|
-i cd-file-system
|
Specifies the image file for creating a data CD.
|
Example—Creating an ISO 9660 File System for 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.
|
How to Create a Multi-Session Data CD
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.
|
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:
|
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.
How to Create an Audio CD
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.
-
Copy the audio files onto the CD.
% cdrw -a track1.wav track2.wav track3.wav
|
The -a option creates an audio CD.
Examples—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. 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 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.
-
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.
Examples—Extracting and Creating Audio CDs
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.
|
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 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.
-
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.
Example—Copying a 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
|
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.