System Administration Guide, Volume 1

Chapter 15 Using CDs From the Command Line (Tasks)

This chapter describes all the tasks required to use CDs in the Solaris environment from the command line. This is a list of the step-by-step instructions in this chapter.

Using CDs Task Map

Table 15-1 Using CDs Task Map



For Instructions, Go To ... 

1. Load the CD 

Insert the CD into the CD-ROM drive.  

"How to Load a CD"

2. Examine Its Contents 

Optional. To examine the contents of the CD, look in the appropriate directory under /cdrom.

"How to Examine the Contents of a CD"

3. Copy Files or Directories 

Optional. Copy files or directories from the CD as you would from any other location in the file system.

"How to Copy Information From a CD"

4. Is CD Still in Use? 

Optional. Before ejecting the CD, find out if it is still in use.

"How to Find Out If a CD Is Still in Use"

5. Eject the CD 

When you finish, eject the CD from the CD-ROM drive. 

"How to Eject a CD"

Using CD Names

When working with CDs, you can identify them by name or with a designator from the table below. For brevity, task descriptions use cdrom0, but you can replace this with either the CD name or a different designator.

Table 15-2 How to Identify CDs


Alternate Name 

First CD-ROM drive 


Second CD-ROM drive 


Third CD-ROM drive 


How to Load a CD

Insert the CD. Shortly after the light stops flashing (about five to ten seconds), the CD is mounted to /cdrom. To verify that the CD is mounted, perform the task "How to Examine the Contents of a CD".

Note -

Most CDs are formatted to the ISO 9660 standard, which is portable, so most CDs can be mounted by Volume Management. However, as described in Chapter 18, How Volume Management Works (Reference), UFS CDs are not portable between architectures, so they must be used on the architecture for which they were designed. If you are having trouble mounting a CD, particularly if it is an installation CD, make sure its UFS file system is appropriate for your system's architecture (check the label on the CD).

How to Examine the Contents of a CD

Use the ls -L command to view the contents of /cdrom directory.

$ ls -L [-l] /cdrom/cdrom0


Includes symbolic links in the output. 


Long format. Includes permissions and owners in the output. 

Example--Examining the Contents of a CD

The following example lists the contents of the CD loaded into the first CD-ROM directory, /cdrom/cdrom0.

$ ls -L -l /cdrom/cdrom0
total 166
drwxr-xr-x   4 root     root        2048 Jul 21 05:18 MU
drwxr-xr-x   4 root     root        2048 Jul 21 05:18 Solaris_7_MU3
-rwxr-xr-x   1 root     root       30952 Jul 21 05:18 backout_mu
-rwxr-xr-x   1 root     root       49604 Jul 21 05:18 install_mu

How to Copy Information From a CD

You can access a CD's files and directories just like any other file system. The only significant restrictions are ownership and permissions. For instance, if you copy a file from a CD into your file system, you'll be the owner, but you won't have write permissions (because the file never had them on the CD); you'll have to change the permissions yourself.

  1. Make sure the CD is mounted.

    $ ls /cdrom

    The ls command displays the contents of a mounted CD. If no contents are displayed, see "How to Load a CD".

  2. Copy the files or directories.

    To Copy ... 

    Use ... 

    A file 


    A directory 

    cp -r

Example--Copying Information From a CD

The following example uses cp to copy a single file from the /cdrom/solstice_sysmgt_2_3 directory into the system's working directory (denoted by the ".").

$ cp /cdrom/solstice_sysmgt_2_3/README .
$ ls -l
-r--r--r--   1 pmorph   users       4618 May  9 08:09 README

Note that when a file or directory is copied from a CD into your file system, you become its owner, but it retains the permissions it had on the CD:


To overwrite it, you'll need to change the permissions with the chmod command. See "Securing Files (Tasks)" in System Administration Guide, Volume 2 for more information on using the chmod command.

How to Find Out If a CD Is Still in Use

  1. Become superuser.

  2. Identify the processes accessing the CD.

    The fuser(1M) command lists the processes that are currently accessing the CD that you specify.

    # fuser -u [-k] /cdrom/cdrom0


    Displays the user of the CD. 


    Kills the process accessing the CD. 

The fuser command might not always identify all the killed processes. To be sure, run it again with the -u option.

Example--Finding Out If a CD Is Still in Use

In the following example, the processes 6400c and 6399c are accessing the /cdrom/cdrom0 directory, and the process owners are root and smith, respectively.

# fuser -u /cdrom/cdrom0
/cdrom/cdrom0: 6400c(root)  6399c(smith)

You can kill the processes individually (as superuser), or you can use the fuser command with the -k option, which kills all the processes accessing that file system, as shown in the following example.

# fuser -u -k /cdrom/cdrom0
/cdrom/cdrom0: 6400c(root)Killed  6399c(smith)Killed

How to Eject a CD

  1. Make sure the CD is not being used.

    Remember, a CD is "being used" if a shell or an application is accessing any of its files or directories. If you are not sure whether you have found all users of a CD (a shell hidden behind a desktop tool might be accessing it), use the fuser command, as described in "How to Find Out If a CD Is Still in Use".

  2. Eject the CD.

    # eject cdrom0

How to Access CDs on Other Systems

You can access a CD on another system by mounting it manually into your file system--provided the other system has shared its CD-ROM according to the instructions in "How to Make Local CDs Available to Other Systems".

  1. Select an existing directory to serve as the mount point or create one.

    $ mkdir directory


    The name of the directory that you create to serve as a mount point for the other system's CD.  

  2. Find the name of the CD you want to mount.

    $ showmount -e system-name
    export list for system-name:
    /cdrom/sol_8_sparc (everyone)
  3. As superuser, mount the CD.

    # mount -F nfs -o ro system-name:/cdrom/cd-name local-mount-point


    The name of the system whose CD you will mount. 


    The name of the CD you want to mount. 


    The local directory onto which you will mount the remote CD. 

  4. Log out as superuser.

  5. Verify that the CD is mounted by using the ls command to list the contents of the mount point.

    $ ls /cdrom

Example--Accessing CDs on Other Systems

This example mounts the CD named sol_8_sparc from the remote system mars onto the /cdrom directory of the local system.

$ showmount -e starbug
export list for starbug:
/cdrom/sol_8_sparc (everyone)
$ su
Password: password
# mount -F nfs -o ro starbug:/cdrom/sol_8_sparc /cdrom
# exit
$ ls /cdrom
cdrom0     sol_8_sparc

How to Make Local CDs Available to Other Systems

You can configure your system to share its CD-ROM drives; in other words, make any CDs in those drives available to other systems. (This does not apply to musical CDs.) Once your CD-ROM drives are shared, other systems can access the CDs they contain simply by mounting them, as described in "How to Access CDs on Other Systems".

  1. Become superuser.

  2. Find out whether the NFS daemon (nfsd) is running.

    # ps -ef | grep nfsd
    root 14533    1 17 10:46:55 ?     0:00 /usr/lib/nfs/nfsd -a 16
    root 14656  289  7 14:06:02 pts/3 0:00 grep nfsd

    If the daemon is running, a line for /usr/lib/nfs/nfsd will appear, as shown above. If the daemon is not running, only the grep nfsd line will appear.

  3. Select an option from the following table.

    If ... 

    Then ... 

    nfsd is running

    Go to Step 8

    nfsd is not running

    Continue with Step 4

  4. Create a dummy directory for nfsd to share.

    # mkdir / dummy-dir


    Can be any directory name; for example, dummy. This directory will not contain any files. Its only purpose is to "wake up" the NFS daemon so that it notices your shared CD-ROM.

  5. Add the following entry into the /etc/dfs/dfstab file.

    share -F nfs -o ro [-d comment] /dummy-dir

    When you start the NFS daemon, it will see this entry, "wake up," and notice the shared CD-ROM drive. Note that the comment (preceded by -d) is optional.

  6. Start the NFS daemon.

    # /etc/init.d/nfs.server start
  7. Verify that the NFS daemon is indeed running.

    # ps -ef | grep nfsd
    root 14533    1 17 10:46:55 ?     0:00 /usr/lib/nfs/nfsd -a 16
    root 14656  289  7 14:06:02 pts/3 0:00 /grep nfsd
  8. Eject any CD currently in the drive.

    # eject cdrom0
  9. Assign root write permissions to the /etc/rmmount.conf file.

    # chmod 644 /etc/rmmount.conf
  10. Add the following lines to the /etc/rmmount.conf file.

    # File System Sharing
    share cdrom*

    These lines share any CD loaded into your system's CD-ROM drive. You can, however, limit sharing to a particular CD or series of CDs, as described in share(1M).

  11. Remove write permissions from the /etc/rmmount.conf file.

    # chmod 444 /etc/rmmount.conf

    This step returns the file to its default permissions.

  12. Load a CD.

    The CD you now load, and all subsequent CDs, will be available to other systems. Remember to wait until the light on the drive stops blinking before you verify this task.

    To access the CD, the remote user must mount it by name, according to the instructions in "How to Access CDs on Other Systems".

  13. Verify that the CD is indeed available to other systems by using the share command.

    If the CD is available, its share configuration will be displayed. (The shared dummy directory will also be displayed.)

    # share
    -    /dummy  ro "dummy dir to wake up NFS daemon"
    -    /sol_7_sparc  ro  ""

Example--Making Local CDs Available to Other Systems

The following example makes any CD loaded into the local system's CD-ROM drive available to other systems on the network.

# ps -ef | grep nfsd
    root 10127  9986  0 08:25:01 pts/2    0:00 grep nfsd
    root 10118     1  0 08:24:39 ?        0:00 /usr/lib/nfs/nfsd -a
# mkdir /dummy
# vi /etc/dfs/dfstab
(Add the following line:)
share -F nfs -o ro  /dummy
# eject cdrom0
# chmod 644 /etc/rmmount.conf
# vi /etc/rmmount
(Add the following line to the File System Sharing section:)
share cdrom*
# chmod 444 /etc/rmmount.conf
(Load a CD.)
# share
-               /dummy   ro   ""  
-               /cdrom/sol_7_sparc/s5   ro   ""  
-               /cdrom/sol_7_sparc/s4   ro   ""  
-               /cdrom/sol_7_sparc/s3   ro   ""  
-               /cdrom/sol_7_sparc/s2   ro   ""  
-               /cdrom/sol_7_sparc/s1   ro   ""  
-               /cdrom/sol_7_sparc/s0   ro   ""  

How to Configure a System to Play Musical CDs

You can play musical CDs from a CD-ROM attached to your Solaris system. You'll need to access Workman, which is public domain software, and you must attach external speakers or headphones independently to the CD-ROM drive; speakers attached to the system hardware will not work.

Once you configure your system, you can play a musical CD simply by inserting it into the CD-ROM drive. The Workman control panel is automatically displayed on your desktop.

  1. Become superuser.

  2. Edit /etc/rmmount.conf.

    Add the following line under # Actions, before the cdrom action, as shown in the example below.

    # Actions
    action cdrom path/workman workman-options


    The directory in which you have placed the Workman software. 


    The options allowed by the Workman software. 

Example--Configuring a System to Play Musical CDs

This example shows an /etc/rmmount.conf file modified to support the Workman software.

# @(#)rmmount.conf 1.3     96/05/10 SMI
# Removable Media Mounter configuration file.
# File system identification
ident hsfs cdrom
ident ufs cdrom floppy rmscsi pcmem
ident pcfs floppy rmscsi pcmem
# Actions
action cdrom /usr/dist/exe/workman
action cdrom
action floppy
action rmscsi
# File System Sharing
share cdrom*
share floppy*

How to Prepare a System for a New CD-ROM Drive

Preparing the system involves creating the /reconfigure file and rebooting the system so that Volume Management recognizes the new CD-ROM drive.

  1. Become superuser.

  2. Create a file called /reconfigure.

    # touch /reconfigure
  3. Reboot the system.

    # init 6

Configuring Volume Management

Occasionally, you might want to manage diskettes or CDs without the help of Volume Management. This section describes how to stop and restart Volume Management.

How to Stop Volume Management

  1. Make sure no diskettes or CDs are being used.

    If you are not sure whether you have found all users of the diskette or CD, use the fuser command, as described in "How to Find Out If a CD Is Still in Use".

  2. Become superuser.

  3. Enter the volmgt stop command.

    # /etc/init.d/volmgt stop

How to Restart Volume Management

  1. Become superuser.

  2. Enter the volmgt start command.

    # /etc/init.d/volmgt start
    volume management starting.