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.
Task |
Description |
For Instructions, Go To |
|||||
---|---|---|---|---|---|---|---|
Load the CD |
Insert the CD into the CD-ROM drive. | ||||||
Examine Its Contents |
Optional. To examine the contents of the CD, look in the appropriate directory under /cdrom . | ||||||
| |||||||
Copy Files or Directories |
Optional. Copy files or directories from the CD as you would from any other location in the file system. | ||||||
| |||||||
Is CD Still in Use? |
Optional. Before ejecting the CD, find out if it is still in use. | ||||||
| |||||||
Eject the CD |
When you finish, eject the CD from the CD-ROM drive. | ||||||
|
When working with CDs, you can identify them by name or with a designator from Table 12-2, below. For brevity, task descriptions use cdrom0, but you can replace this with either the CD name or a different designator.
Table 12-2 How to Identify CDs
CD |
Alternate Name |
---|---|
First CD-ROM drive |
cdrom0 |
Second CD-ROM drive |
cdrom1 |
Third CD-ROM drive |
cdrom2 |
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".
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 15, How Volume Management Works (Overview), 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).
Use the -L option to the ls command, because some directories under /floppy and /cdrom are symbolic links.
$ ls -L [-l] /cdrom/cdrom0 |
-L |
Includes symbolic links in the output. |
-l |
Long format. Includes permissions and owners in the output. |
The following example lists the contents of the CD loaded into the first CD-ROM directory, /cdrom/cdrom0.
$ ls -L -l /cdrom/cdrom0 dr-xr-xr-x 2 root sys 2048 Dec 31 1993 tools dr-xr-xr-x 2 root sys 2048 Dec 31 1993 graphics |
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.
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".
Copy the files or directories.
To Copy ... |
Use ... |
---|---|
A file |
cp |
A directory |
cp -r |
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:
-r--r--r--
To overwrite it, you'll need to change the permissions with the chmod command. See Chapter 51, Securing Files (Tasks) for more information on using the chmod command.
Enter the fuser command.
The fuser command lists the processes that are currently accessing the CD that you specify.
# fuser -u [-k] /cdrom/cdrom0 |
-u |
Displays the user of the CD. |
|
-k |
Kills the process accessing the CD. |
The fuser command may not always identify all the killed processes. To be sure, run it again with the -u option.
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 |
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 may be accessing it), use the fuser command, as described in "How to Find Out If a CD Is Still in Use".
Eject the CD.
# eject cdrom0 |
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".
Select an existing directory to serve as the mount point or create one.
$ mkdir directory |
directory |
The name of the directory that you create to serve as a mount point for the other system's CD. |
Find the name of the CD you want to mount.
When you manually mount a remote CD, you cannot use the cdrom0 or cdrom1 variables available with your local CDs. You must use the exact CD name. To find it, use the ls command on the remote system's /cdrom directory. If the automounter is running, you can simply cd to the system whose CD you want to mount and then use the ls command. If the automounter is not running, you'll have to use another method, such as logging in remotely.
# mount -F nfs -o ro system-name:/cdrom/cd-name local-mount-point |
system-name |
The name of the system whose CD you will mount. |
cd-name |
The name of the CD you want to mount. |
local-mount-point |
The local directory onto which you will mount the remote CD. |
Log out as superuser.
Verify that the CD is mounted by using the ls command to list the contents of the mount point.
$ ls /cdrom |
This example mounts the CD named Solaris_2.6_sparc from the remote system mars onto the /cdrom directory of the local system.
$ cd /net/mars $ ls /cdrom cdrom0 Solaris_2.6_sparc $ su Password: password # mount -F nfs ro mars:/cdrom/Solaris_2.6_sparc /cdrom # exit $ ls /cdrom Solaris_2.6_sparc |
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".
Become superuser.
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.
Select an option from the following table.
If ... |
Then ... |
---|---|
nfsd is running |
Go to Step 8 |
nfsd is not running |
Continue with Step 4 |
Create a dummy directory for nfsd to share.
# mkdir /dummy-dir |
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. |
Add the following entry into /etc/dfs/dfstab.
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.
# /etc/init.d/nfs.server start |
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 |
Eject any CD currently in the drive.
# eject cdrom0 |
Assign root write permissions to /etc/rmmount.conf.
# chmod 644 /etc/rmmount.conf |
Add the following lines to /etc/rmmount.conf.
# 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).
Remove write permissions from /etc/rmmount.conf.
# chmod 444 /etc/rmmount.conf |
This step returns the file to its default permissions.
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".
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" - /Solaris_2.6_sparc ro "" |
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/solaris_2_6_sparc/s5 ro "" - /cdrom/solaris_2_6_sparc/s4 ro "" - /cdrom/solaris_2_6_sparc/s3 ro "" - /cdrom/solaris_2_6_sparc/s2 ro "" - /cdrom/solaris_2_6_sparc/s1 ro "" - /cdrom/solaris_2_6_sparc/s0 ro "" |
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.
Become superuser.
Edit /etc/rmmount.conf.
Add the following line under # Actions, before the cdrom action, as shown in the example below.
# Actions action cdrom action_workman.so path/workman workman-options |
path |
The directory in which you have placed the Workman software. |
workman-options |
The options allowed by the Workman software |
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 ident_hsfs.so cdrom ident ufs ident_ufs.so cdrom floppy rmscsi pcmem ident pcfs ident_pcfs.so floppy rmscsi pcmem # Actions action cdrom action_workman.so /usr/dist/exe/workman action cdrom action_filemgr.so action floppy action_filemgr.so action rmscsi action_filemgr.so # File System Sharing share cdrom* share floppy* |
On a system that is properly booted with the boot -r command, Volume Management will automatically recognize a new CD-ROM drive. However, to make sure Volume Management always recognizes a new drive, create the /reconfigure file.
Become superuser.
Create a file called /reconfigure.
# touch /reconfigure |
The /reconfigure file makes the Solaris environment check for the presence of any newly installed peripheral devices when you power on or boot your system. After that, Volume Management locates the new device and automatically manages it for you.
Occasionally, you may want to manage diskettes or CDs without the help of Volume Management. This section describes how to stop and restart Volume Management.
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".
Become superuser.
Enter the volmgt stop command.
# /etc/init.d/volmgt stop # |