<chapter id="medaccess-29267"><title>Accessing Removable Media (Tasks)</title><highlights><para>This chapter describes how to access removable media from the command
line in the Solaris OS.</para><para>For information on the procedures associated with accessing removable
media, see the following:</para><itemizedlist><listitem><para><olink targetptr="medaccess-1" remap="internal">Accessing Removable Media (Task
Map)</olink></para>
</listitem><listitem><para><olink targetptr="medaccess-22" remap="internal">Accessing Removable Media
on a Remote System (Task Map)</olink></para>
</listitem>
</itemizedlist><para>For background information on removable media, see <olink targetptr="medintro-55492" remap="internal">Chapter&nbsp;1, Managing Removable Media (Overview)</olink>.</para>
</highlights><sect1 id="medaccess-1"><title>Accessing Removable Media (Task Map)</title><para>The following task map describes the tasks for accessing removable media.</para><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="33*"/><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>1. (Optional) Add the removable media drive.</para>
</entry><entry><para>Add the removable media drive to your system, if necessary. </para>
</entry><entry><para><olink targetptr="medaccess-95763" remap="internal">How to Add a New Removable Media
Drive</olink></para>
</entry>
</row><row><entry><para>2. (Optional) Decide whether you want to use removable media with or
without volume management (<command>vold</command>).</para>
</entry><entry><para>Volume management (<command>vold</command>) runs by default. Decide
whether you want to use removable media with or without volume management.</para>
</entry><entry><para><olink targetptr="medaccess-12244" remap="internal">How to Disable or Enable Removable
Media Services</olink></para>
</entry>
</row><row><entry><para>3. Access removable media.</para>
</entry><entry><para>Access different kinds of removable media with or without volume management
running.</para>
</entry><entry><para><olink targetptr="medaccess-49551" remap="internal">How to Access Information on Removable
Media</olink></para>
</entry>
</row><row><entry><para>4. (Optional) Copy files or directories.</para>
</entry><entry><para>Copy files or directories from the media as you would from any other
location in the file system.</para>
</entry><entry><para><olink targetptr="medaccess-17081" remap="internal">How to Copy Information From Removable
Media</olink></para>
</entry>
</row><row><entry><para>5. Find out if the media is still in use.</para>
</entry><entry><para>Before ejecting the media, find out if it is still in use.</para>
</entry><entry><para><olink targetptr="medaccess-60234" remap="internal">How to Determine If Removable Media
Is Still in Use</olink></para>
</entry>
</row><row><entry><para>6. Eject the media.</para>
</entry><entry><para>When you finish, eject the media from the drive.</para>
</entry><entry><para><olink targetptr="medaccess-46529" remap="internal">How to Eject Removable Media</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="medaccess-54"><title>Accessing Removable Media</title><para>You can access information on removable media with or without using
volume management. For information on accessing information on removable media
with GNOME's File Manager, see the GNOME desktop documentation.</para><para>Volume management (<command>vold</command>) actively manages all removable
media devices. So, any attempt to access removable media with device names
such as <filename>/dev/rdsk/c</filename><replaceable>n</replaceable><filename>t</filename><replaceable>n</replaceable><filename>d</filename><replaceable>n</replaceable><filename>s</filename><replaceable>n</replaceable> or <filename>/dev/dsk/c</filename><replaceable>n</replaceable><filename>t</filename><replaceable>n</replaceable><filename>d</filename><replaceable>n</replaceable><filename>s</filename><replaceable>n</replaceable> will be unsuccessful.</para><sect2 id="medaccess-3"><title>Using Removable Media Names</title><para>You can access all removable media with different names. The following
table describes the different media names that can be accessed with or without
volume management. </para><table frame="topbot" pgwide="100" id="medaccess-37633"><title>Removable Media
Names</title><tgroup cols="4" colsep="0" rowsep="0"><colspec colname="column1" colwidth="132.00*"/><colspec colname="column2" colwidth="204.00*"/><colspec colname="colspec4" colwidth="295.95*"/><colspec colname="colspec0" colwidth="292.05*"/><thead><row rowsep="1"><entry><para>Media</para>
</entry><entry><para>Volume Management Device Name</para>
</entry><entry><para>Volume Management Device Alias Name</para>
</entry><entry><para>Device Name</para>
</entry>
</row>
</thead><tbody><row><entry><para>First diskette drive</para>
</entry><entry><para><filename>/floppy</filename></para>
</entry><entry><para><filename>/vol/dev/aliases/floppy0</filename></para>
</entry><entry><para><filename>/dev/rdiskette</filename></para><para><filename>/vol/dev/rdiskette0/</filename></para><para><replaceable>volume-name</replaceable></para>
</entry>
</row><row><entry><para>First, second, third CD-ROM or DVD-ROM drives</para>
</entry><entry><para><filename>/cdrom0</filename></para><para><filename>/cdrom1</filename></para><para><filename>/cdrom2</filename></para>
</entry><entry><para><filename>/vol/dev/aliases/cdrom0</filename></para><para><filename>/vol/dev/aliases/cdrom1</filename></para><para><filename>/vol/dev/aliases/cdrom2</filename></para>
</entry><entry><para><filename>/vol/dev/rdsk/c</filename><replaceable>n</replaceable><filename>t</filename><replaceable>n</replaceable><filename>[d</filename><replaceable>n</replaceable>]<filename>/</filename></para><para><replaceable>volume-name</replaceable></para>
</entry>
</row><row><entry><para>USB memory stick</para>
</entry><entry><para><filename>/rmdisk/noname</filename></para>
</entry><entry><para><filename>/vol/dev/aliases/</filename><filename>rmdisk0</filename></para>
</entry><entry><para><filename>/vol/dev/dsk</filename>/c<replaceable>n</replaceable><filename>t</filename><replaceable>n</replaceable><filename>d</filename><replaceable>n</replaceable>/<replaceable>volume-name</replaceable><filename>:c</filename></para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2><sect2 id="medaccess-57"><title>Guidelines for Accessing Removable Media Data</title><para>Most CDs and DVDs are formatted to the ISO 9660 standard, which is portable.
So, most CDs and DVDs can be mounted by volume management. However, CDs or
DVDs with UFS file systems are not portable between architectures. So, they
must be used on the architecture for which they were designed.</para><para>For example, a CD or DVD with a UFS file system for a <trademark>SPARC</trademark> platform
cannot be recognized by an x86 platform. Likewise, an x86 UFS CD cannot
be mounted by volume management on a SPARC platform. The same limitation generally
applies to diskettes. However, some architectures share the same bit structure,
so occasionally a UFS format specific to one architecture will be recognized
by another architecture. Still, the UFS file system structure was not designed
to guarantee this compatibility.</para><para>To accommodate the different formats, the CD or DVD is split into slices.
Slices are similar in effect to partitions on hard disks. The 9660 portion
is portable, but the UFS portion is architecture-specific. If you are having
trouble mounting a CD or DVD, particularly if it is an installation CD or
DVD, make sure that its UFS file system is appropriate for your system's architecture.
For example, you can check the label on the CD or DVD.</para>
</sect2><task id="medaccess-95763"><title>How to Add a New Removable Media Drive</title><tasksummary><para>Generally, most modern bus types support hot-plugging. If your system's
bus type supports hot-plugging, you might only need to do step 5 below. If
your system's bus type does not support hot-plugging, you might have to do
the following tasks, which are described in steps 1-6 below.</para><itemizedlist><listitem><para>Create the <filename>/reconfigure</filename> file.</para>
</listitem><listitem><para>Reboot the system so that volume management recognizes the
new media drive.</para>
</listitem>
</itemizedlist><para>For more information about hot-plugging devices, see <olink targetptr="devconfig2-1" remap="internal">Chapter&nbsp;6, Dynamically Configuring Devices (Tasks)</olink>.</para>
</tasksummary><procedure><step id="medaccess-step-42"><para>Become superuser.</para>
</step><step id="medaccess-step-43"><para>Create the <filename>/reconfigure</filename> file.</para><screen># <userinput>touch /reconfigure</userinput></screen>
</step><step id="medaccess-step-51"><para>Bring the system to run level 0.</para><screen># <userinput>init 0</userinput></screen>
</step><step id="medaccess-step-1"><para>Turn off power to the system.</para>
</step><step id="medaccess-step-2"><para>Connect the new media drive.</para><para>See
your hardware handbook for specific instructions.</para>
</step><step id="medaccess-step-3"><para>Turn on power to the system.</para><para>The
system automatically comes up to multiuser mode.</para>
</step>
</procedure>
</task><task id="medaccess-12244"><title>How to Disable or Enable Removable Media
Services</title><tasksummary><para>Occasionally, you might want to manage media without using removable
media services. This section describes how to disable and enable removable
media services.</para><para>Disabling these services means that you would have to mount all media
manually by using the <command>mount</command> command.</para>
</tasksummary><procedure><step id="medaccess-step-45"><para>Ensure that the media is not being used.</para><para>If you are not sure whether you have found all users of the media,
use the <command>fuser</command> command, see <olink targetptr="medaccess-60234" remap="internal">How to Determine If Removable Media Is Still in Use</olink>.</para>
</step><step id="medaccess-step-46"><para>Become superuser.</para>
</step><step id="medaccess-step-47"><para>Select one of the following: </para><itemizedlist><listitem><para>You can disable some or all removable
media features in this release:</para><itemizedlist><listitem><para>To prevent volumes from mounting outside of user sessions,
disable the <command>rmvolmgr</command> service. For example:</para><screen># svcadm disable rmvolmgr</screen>
</listitem><listitem><para>To prevent any volume management, disable the <command>dbus</command>, <command>hal</command>, and <command>rmvolmgr</command> services.</para><screen># svcadm disable rmvolmgr
# svcadm disable dbus
# svcadm disable hal</screen><para>Disabling these services means that you would have to mount all media
manually by using the <command>mount</command> command.</para>
</listitem>
</itemizedlist>
</listitem><listitem><para>Enable removable media services.</para><screen># svcadm enable rmvolmgr
# svcadm enable dbus
# svcadm enable hal</screen>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><task id="medaccess-49551"><title>How to Access Information on Removable Media</title><procedure><step id="medaccess-step-62"><para>Insert the media.</para><para>The media
is mounted after a few seconds. </para>
</step><step id="medaccess-step-56"><para>List the contents of the media.</para><screen>% <userinput>ls</userinput> /<replaceable>media</replaceable></screen><para>Use the appropriate device name to access information by using the command-line
interface. See <olink targetptr="medaccess-37633" remap="internal">Table&nbsp;3&ndash;1</olink> for
an explanation of device names.</para>
</step>
</procedure><example id="fncpw"><title>Accessing Information on Removable Media</title><para>This example shows how to access information on a diskette.</para><screen>$ ls /media/floppy</screen><para>This example shows how to access information on a USB memory stick.</para><screen>$ ls /media/<replaceable>usb-name</replaceable></screen><para>This example shows how to access information on a DVD or CD.</para><screen>$ ls /media
SOL_10_305_sparc  cdrom</screen>
</example>
</task><task id="medaccess-17081"><title>How to Copy Information From Removable Media</title><tasksummary><para>You can access files and directories on removable media as with any
other file system. The only significant restrictions are related to ownership
and permissions.</para><para>For instance, if you copy a file from a CD into your file system, you
are the owner. However, you won't have write permissions because the file
on the CD never had them. You must change the permissions yourself.</para>
</tasksummary><procedure><step id="medaccess-step-6"><para>Ensure that the media is mounted.</para><screen>$ <userinput>ls</userinput> <replaceable>/media</replaceable></screen><para>The <command>ls</command> command displays the contents of a mounted
media. If no contents are displayed, see <olink targetptr="medaccess-49551" remap="internal">How
to Access Information on Removable Media</olink>.</para>
</step><step id="medaccess-step-7"><para>(Optional) Copy the files or directories.</para><para>For example, for a DVD, you would do the following:</para><screen>$ <userinput>cp /media/sol_10_305_sparc/s0/Solaris_10/Tools/add_install_client .</userinput>
$ <userinput>ls -l</userinput>
-rwxr-xr-x   1 pmorph	  gelfs   66393 Jun 14 16:08 add_install_client</screen>
</step>
</procedure>
</task><task id="medaccess-60234"><title>How to Determine If Removable Media Is Still
in Use</title><procedure><step id="medaccess-step-10"><para>Become superuser.</para>
</step><step id="medaccess-step-11"><para>Identify the processes that are accessing
the media.</para><screen># <userinput>fuser -u</userinput> <replaceable>/media</replaceable></screen><para>The <option>u</option> displays the user of the media.</para><para>For
more information, see <olink targetdoc="refman1m" targetptr="fuser-1m" remap="external"><citerefentry><refentrytitle>fuser</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para>
</step><step id="medaccess-step-60"><para>(Optional) Kill the process accessing the
media.</para><screen># <userinput>fuser -u -k</userinput> <replaceable>/media</replaceable></screen><para>The <option>k</option> kills the processes accessing the media.</para><caution><para>Killing the processes that are accessing the media should only
be used in emergency situations. </para>
</caution>
</step><step id="medaccess-step-24"><para>Verify that the process is gone.</para><screen># <userinput>pgrep</userinput> <replaceable>process-ID</replaceable></screen>
</step>
</procedure><example id="fncpx"><title>Determining If the Media Is Still in Use</title><para>The following example shows that the user <literal>pmorph</literal>, is accessing
the  <filename>/media/sol_10_305_sparc/s0/Solaris_10/Tools</filename> directory.</para><screen># fuser -u /media/sol0_10_305_SPARC/Solaris_10/Tools
/media/SOL_9_SPARC/Solaris_9/Tools:      723c(pmorph)     316c(pmorph)</screen>
</example>
</task><task id="medaccess-46529"><title>How to Eject Removable Media</title><procedure><step id="medaccess-step-14"><para>Ensure that the media is not being used.</para><para>Remember, media is &ldquo;being used&rdquo; 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 (for example, a shell hidden behind a desktop
tool might be accessing it), use the <command>fuser</command> command. See <olink targetptr="medaccess-60234" remap="internal">How to Determine If Removable Media Is Still in
Use</olink>. </para>
</step><step id="medaccess-step-15"><para>Eject the media.</para><screen># <userinput>eject</userinput> <replaceable>media</replaceable></screen><para>For example, for a CD, you would do the following:</para><screen># <userinput>eject cdrom</userinput></screen><para>For example, for a USB memory stick, you would do the following:</para><screen># <userinput>eject rmdisk0</userinput></screen><tip><para>You can view the removable device name with the <command>eject</command> <option>l</option> command.</para>
</tip>
</step>
</procedure>
</task>
</sect1><sect1 id="medaccess-22"><title>Accessing Removable Media on a Remote System
(Task Map)</title><para>The following task map describes the tasks need to access removable
media on a remote system.</para><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="33*"/><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>1. Make local media available to remote systems.</para>
</entry><entry><para>configure your system to share its media drives to make any media in
those drives available to other systems.</para>
</entry><entry><para><olink targetptr="medaccess-60181" remap="internal">How to Make Local Media Available
to Other Systems</olink></para>
</entry>
</row><row><entry><para>2. Access removable media on remote systems.</para>
</entry><entry><para>Access the remote media on the local system.</para>
</entry><entry><para><olink targetptr="medaccess-49551" remap="internal">How to Access Information on Removable
Media</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><task id="medaccess-60181"><title>How to Make Local Media Available to Other
Systems</title><tasksummary><para>You can configure your system to share its media drives to make any
media in those drives available to other systems. One exception is musical
CDs. Once your media drives are shared, other systems can access the media
they contain simply by mounting them. For instructions, see <olink targetptr="medaccess-78168" remap="internal">How to Access Removable Media on Remote Systems</olink>. </para>
</tasksummary><procedure><step id="medaccess-step-23"><para>Become superuser.</para>
</step><step><para>Confirm that the media is loaded.</para>
</step><step id="medaccess-step-27"><para>Add the following entry to the <filename>/etc/dfs/dfstab</filename> file. </para><para>For example:</para><screen>share -F nfs -o ro /media/sol_10_305_SPARC</screen>
</step><step id="medaccess-step-21"><para>Determine whether the NFS server service
is running.</para><screen># <userinput>svcs *nfs*</userinput></screen><para>The following output is returned from the <command>svcs</command> command
if NFS server service is running:</para><screen>online         14:28:43 svc:/network/nfs/server:default</screen>
</step><step id="medaccess-step-25"><para>Identify the NFS server status, and select
one of the following:</para><itemizedlist><listitem><para>If the NFS server service is running, go to <olink targetptr="medaccess-step-53" remap="internal">Step&nbsp;7</olink>.</para>
</listitem><listitem><para>If the NFS server service is <emphasis>not</emphasis> running,
go to the next step.</para>
</listitem>
</itemizedlist>
</step><step id="medaccess-step-8"><para>Start the NFS server service.</para><screen># <userinput>svcadm enable network/nfs/server</userinput></screen><para>Verify that the NFS daemons are running.</para><para>For example:</para><screen># <userinput>svcs -p svc:/network/nfs/server:default</userinput>
STATE          STIME    FMRI
online         Aug_30   svc:/network/nfs/server:default
               Aug_30        319 mountd
               Aug_30        323 nfsd</screen>
</step><step id="medaccess-step-53"><para>Verify that the media is indeed available
to other systems.</para><para>If the media is available, its share configuration
is displayed.</para><screen># share
-               /media/sol_10_305_SPARC   sec=sys,ro   ""  </screen>
</step>
</procedure><example id="fncqb"><title>Making Local DVDs or CDs Available to Other Systems</title><para>The following example shows how to make any local DVD or CD available
to other systems on the network.</para><screen># <userinput>vi /etc/dfs/dfstab</userinput>
(<emphasis>Add the following line:</emphasis>)
# <userinput>share -F nfs -o ro</userinput> <replaceable>/media</replaceable>
# <userinput>svcs *nfs*</userinput>
# <userinput>svcadm enable network/nfs/server</userinput>
# <userinput>svcs -p svc:/network/nfs/server:default</userinput>
# <userinput>share</userinput>
-               /media/sol_10_305_sparc   sec=sys,ro   "" </screen>
</example><example id="fncqc"><title>Making Local Diskettes Available to Other Systems</title><para>The following example shows how to make any local diskette available
to other systems on the network.</para><screen># <userinput>vi /etc/dfs/dfstab</userinput>
(<emphasis>Add the following line, for example</emphasis>)
<userinput>share -F nfs -o ro</userinput> <replaceable>/media/myfiles</replaceable>
# <userinput>svcs *nfs*</userinput>
# <userinput>svcadm enable network/nfs/server</userinput>
# <userinput>svcs -p svc:/network/nfs/server:default</userinput>
# <userinput>volcheck -v</userinput>
media was found
# <userinput>share</userinput>
-               /media/myfiles   rw   ""  </screen>
</example>
</task><task id="medaccess-78168"><title>How to Access Removable Media on Remote
Systems</title><tasksummary><para>You can access media on a remote system by manually mounting the media
into your file system. Also, the remote system must have shared its media
according to the instructions in <olink targetptr="medaccess-60181" remap="internal">How to
Make Local Media Available to Other Systems</olink>.</para>
</tasksummary><procedure><step id="medaccess-step-17"><para>Select an existing directory to serve as
the mount point. Or create a mount point.</para><screen>$ <userinput>mkdir</userinput> <replaceable>/directory</replaceable></screen><para>where <replaceable>/directory</replaceable> is the name of the directory
that you create to serve as a mount point for the remote system's CD. </para>
</step><step id="medaccess-step-18"><para>Find the name of the media you want to
mount.</para><screen>$ <userinput>showmount -e</userinput> <replaceable>system-name</replaceable></screen>
</step><step><para>As superuser, mount the media.</para><screen># <userinput>mount -F nfs -o ro</userinput> <replaceable>system-name</replaceable><replaceable>:/media/media-name</replaceable> <replaceable>local-mount-point</replaceable></screen><variablelist><varlistentry><term><replaceable>system-name:</replaceable></term><listitem><para>Is the name of the system whose media you will mount.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>media-name</replaceable></term><listitem><para>Is the name of the media you want to mount.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>local-mount-point</replaceable></term><listitem><para>Is the local directory onto which you will mount the remote
media.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="medaccess-step-52"><para>Log out as superuser.</para>
</step><step id="medaccess-step-54"><para>Verify that the media has been mounted.</para><screen>$ <userinput>ls</userinput> <replaceable>/media</replaceable></screen>
</step>
</procedure><example id="fncqd"><title>Accessing DVDs or CDs on Remote Systems</title><para>The following example shows how to automatically access the remote DVD
named <filename>sol_10_305_sparc</filename> from the remote system <literal>starbug</literal> using AutoFS.</para><screen>$ <userinput>showmount -e starbug</userinput>
export list for starbug:
/media/sol_10_305_sparc (everyone)
$ <userinput>ls /net/starbug/media/</userinput>
sol_10_305_sparc</screen>
</example><example id="fncqi"><title>Accessing Diskettes on Other Systems</title><para>The following example shows how to automatically access <filename>myfiles</filename> from
the remote system <literal>mars</literal> using AutoFS. </para><screen># <userinput>showmount -e mars</userinput>
export list for fractional:
/media/floppy (everyone)
$ <userinput>cd /net/mars</userinput>
$ <userinput>ls media</userinput>
myfiles</screen>
</example>
</task>
</sect1>
</chapter>