How to Find Out If Removable Media Is Still in Use
Identify the processes accessing the media.
# fuser -u [-k] /media
-u
Displays the user of the media.
-k
Kills the process accessing the media.
For more information on using the fuser command, see fuser(1M).
(Optional) Kill the process accessing the media.
# fuser -u -k /media
Caution - Killing the process accessing the media should only be used in emergency situations.
Verify the process is gone.
# pgrep process-ID
Example--Finding Out If the Media Is Still in Use
The following example shows that the process 26230c, owner ripley, is accessing the /cdrom/cdrom0/Solaris_8/EA/products/Live_Upgrade_1.0 directory.
# fuser -u /cdrom/cdrom0/Solaris_8/EA/products/Live_Upgrade_1.0 /cdrom/cdrom0/Solaris_8/EA/products/Live_Upgrade_1.0: 26230c(ripley) |
How to Eject Removable Media
Make sure the media is not being used.
Remember, media 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 Removable Media Is Still in Use".
Eject the media.
# eject media
For example, for a CD, you would do the following
# eject cdrom
For example, for a PCMCIA memory card, you would do the following:
# eject pcmem0
Accessing Removable Media on a Remote System (Task Map)
The following table describes the tasks need to access removable media on a remote system.
Task | Description | For Instructions |
---|---|---|
1. Make local media available to remote systems | Add the removable media drive to your system, if necessary. | |
2. Access removable media on remote systems | Insert the media into the drive. |
How to Make Local Media Available to Other Systems
You can configure your system to share its media drives to make any media in those drives available to other systems. (This does not apply to musical CDs.) Once your media drives are shared, other systems can access the media they contain simply by mounting them, as described in "How to Access Removable Media on Remote 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.
Identify the nfsd status and select one of the following:
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 media drive.
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 media 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 media currently in the drive.
# eject media
Assign root write permissions to the /etc/rmmount.conf file.
# chmod 644 /etc/rmmount.conf
Add the following lines to the /etc/rmmount.conf file.
# File System Sharing share media*
These lines share any media 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 the /etc/rmmount.conf file.
# chmod 444 /etc/rmmount.conf
This step returns the file to its default permissions.
Load the media.
The media you now load, and all subsequent media, 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 media, the remote user must mount it by name, according to the instructions in "How to Access Removable Media on Remote Systems".
Verify that the media is indeed available to other systems by using the share command.
If the media 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" - /cdrom/sol_9_sparc ro ""
Example--Making Local CDs Available to Other Systems
The following example shows how to make any local CD 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_9_sparc/s5 ro "" - /cdrom/sol_9_sparc/s4 ro "" - /cdrom/sol_9_sparc/s3 ro "" - /cdrom/sol_9_sparc/s2 ro "" - /cdrom/sol_9_sparc/s1 ro "" - /cdrom/sol_9_sparc/s0 ro "" # |