<chapter id="fsmount-42780"><title>Mounting and Unmounting File Systems
(Tasks)</title><highlights><para>This chapter describes how to mount and unmount file systems in the Solaris OS.</para><para>This is a list of the step-by-step instructions in this chapter.</para><itemizedlist><listitem><para><olink targetptr="fsmount-31406" remap="internal">How to Determine Which File
Systems Are Mounted</olink></para>
</listitem><listitem><para><olink targetptr="fsmount-29904" remap="internal">How to Add an Entry to the
/etc/vfstab File</olink></para>
</listitem><listitem><para><olink targetptr="fsmount-14643" remap="internal">How to Mount a File System
(/etc/vfstab File)</olink></para>
</listitem><listitem><para><olink targetptr="fsmount-13147" remap="internal">How to Mount a UFS File System
(mount Command)</olink></para>
</listitem><listitem><para><olink targetptr="fsmount-40" remap="internal">How to Mount a UFS File System
Without Large Files (mount Command)</olink></para>
</listitem><listitem><para><olink targetptr="fsmount-69423" remap="internal">How to Mount an NFS File
System (mount Command)</olink></para>
</listitem><listitem><para><olink targetptr="fsmount-80332" remap="internal">How to Mount a PCFS (DOS)
File System From a Hard Disk (mount Command)</olink></para>
</listitem><listitem><para><olink targetptr="fsmount-36" remap="internal">How to Verify a File System
is Unmounted</olink></para>
</listitem><listitem><para><olink targetptr="fsmount-85827" remap="internal">How to Stop All Processes
Accessing a File System</olink></para>
</listitem><listitem><para><olink targetptr="fsmount-73813" remap="internal">How to Unmount a File System</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="fsmount-43249"><title>Overview of Mounting File Systems</title><para>After you create a file system, you need to make it available to the
system so that you can use it. You make a file system available by mounting
it, which attaches the file system to the system directory tree at the specified
mount point. The root (<filename>/</filename>) file system is always mounted. </para><para>The following table provides guidelines on mounting file systems based
on how you use them.</para><informaltable frame="all"><tgroup cols="2" colsep="1" rowsep="1"><colspec colwidth="198*"/><colspec colwidth="198*"/><thead><row><entry><para>Mount Type Needed</para>
</entry><entry><para>Suggested Mount Method</para>
</entry>
</row>
</thead><tbody><row><entry><para>Local or remote file systems that need to be mounted infrequently</para>
</entry><entry><para>The <command>mount</command> command that you type manually from the
command line.</para>
</entry>
</row><row><entry><para>Local file systems that need to be mounted frequently</para>
</entry><entry><para>The <filename>/etc/vfstab</filename> file, which mounts the file system
automatically when the system is booted in multi user state.</para>
</entry>
</row><row><entry><para>Remote file systems,, such as home directories, that need to be mounted
frequently</para>
</entry><entry><itemizedlist><listitem><para>The <filename>/etc/vfstab</filename> file, which automatically
mounts the file system when the system is booted in multiuser state.</para>
</listitem><listitem><para>AutoFS, which automatically mounts the file system when you
access it or unmounts the file system when you change to another directory.</para>
</listitem>
</itemizedlist><para>To enhance performance, you can also cache the remote file systems by
using the CacheFS file system.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>You can mount removable media that contains a file system by inserting
the media into the drive and running the <command>volcheck</command> command,
if necessary. For more information on mounting removable media, see <olink targetptr="medintro-55492" remap="internal">Chapter&nbsp;1, Managing Removable Media (Overview)</olink>.</para><sect2 id="fsmount-11"><title>Commands for Mounting and Unmounting File Systems</title><para>The following table lists the commands in the <filename>/usr/sbin</filename> directory
that you use to mount and unmount file systems.</para><table frame="topbot" id="fsmount-19943"><title>Commands for Mounting and
Unmounting File Systems</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="120.19*"/><colspec colname="colspec8" colwidth="267.63*"/><colspec colname="colspec6" colwidth="120.19*"/><thead><row rowsep="1"><entry><para>Command</para>
</entry><entry><para>Description</para>
</entry><entry><para>Man Page</para>
</entry>
</row>
</thead><tbody><row><entry><para><command>mount</command></para>
</entry><entry><para>Mounts file systems and remote resources.</para>
</entry><entry><para><olink targetdoc="refman1m" targetptr="mount-1m" remap="external"><citerefentry><refentrytitle>mount</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>mountall</command></para>
</entry><entry><para>Mounts all file systems that are specified in the <filename>/etc/vfstab</filename> file.
The <command>mountall</command> command runs automatically when the system
enters multiuser mode. </para>
</entry><entry><para><olink targetdoc="refman1m" targetptr="mountall-1m" remap="external"><citerefentry><refentrytitle>mountall</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>umount</command></para>
</entry><entry><para>Unmounts file systems and remote resources.</para>
</entry><entry><para><olink targetdoc="refman1m" targetptr="mount-1m" remap="external"><citerefentry><refentrytitle>mount</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>umountall</command></para>
</entry><entry><para>Unmounts all file systems that are specified in the <filename>/etc/vfstab</filename> file.</para>
</entry><entry><para><olink targetdoc="refman1m" targetptr="mountall-1m" remap="external"><citerefentry><refentrytitle>mountall</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>Keep the following key points in mind when using the <command>mount</command> and <command>mountall</command> commands:</para><itemizedlist><listitem><para>The <command>mount</command> and <command>mountall</command> commands
cannot mount a read/write file system that has known inconsistencies. If you
receive an error message from the <command>mount</command> or <command>mountall</command> command,
you might need to check the file system. See <olink targetptr="fstroublefsck-61446" remap="internal">Chapter&nbsp;21, Checking UFS File System
Consistency (Tasks)</olink> for information on how to check the file system.</para>
</listitem><listitem><para>The <command>umount</command> and <command>umountall</command> commands
do not unmount a file system that is busy. A file system is considered busy
if one of the following is true:</para><itemizedlist><listitem><para>A user is accessing a file or directory in the file system.</para>
</listitem><listitem><para>A program has a file open in that file system.</para>
</listitem><listitem><para>The file system is shared.</para>
</listitem>
</itemizedlist>
</listitem><listitem><para>You can use the <literal>remount</literal> option when remounting
from read-only access to read-write access only. You cannot remount from read-write
access to read-only access.</para>
</listitem>
</itemizedlist>
</sect2><sect2 id="fsmount-3"><title>Commonly Used Mount Options</title><para>The following table describes the commonly used options that you can
specify with the  <command>mount</command> <option>o</option> option. If you
specify multiple options, separate them with commas (no spaces). For example, <option>o ro,nosuid</option>. </para><para>For a complete list of mount options for each file system type, refer
to the specific mount man page (for example, <olink targetdoc="refman1m" targetptr="mount-ufs-1m" remap="external"><citerefentry><refentrytitle>mount_ufs</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>).</para><table frame="topbot" id="fsmount-66498"><title>Commonly Used <option>o</option> Mount
Options</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="101*"/><colspec colname="column2" colwidth="87*"/><colspec colname="column3" colwidth="208*"/><thead><row rowsep="1"><entry><para>mount Option</para>
</entry><entry><para>File System</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>bg | fg</literal></para>
</entry><entry><para>NFS</para>
</entry><entry><para>If the first mount attempt fails, retries another mount in the background
(<literal>bg</literal>) or in the foreground (<literal>fg</literal>). This
option is safe for non critical <filename>vfstab</filename> entries. The default
is <literal>fg</literal>.</para>
</entry>
</row><row><entry><para><literal>hard | soft</literal></para>
</entry><entry><para>NFS</para>
</entry><entry><para>Specifies the procedure if the server does not respond. The <literal>soft</literal> option
indicates that an error is returned. The <literal>hard</literal> option indicates
that the retry request is continued until the server responds. The default
is <literal>hard</literal>.</para>
</entry>
</row><row><entry><para><literal>intr | nointr</literal></para>
</entry><entry><para>NFS</para>
</entry><entry><para>Specifies whether keyboard interrupts are delivered to a hung process
while waiting for a response on a hard-mounted file system. The default is <literal>intr</literal> (interrupts allowed).</para>
</entry>
</row><row><entry><para><literal>largefiles | nolargefiles</literal></para>
</entry><entry><para>UFS</para>
</entry><entry><para>Enables you to create files larger than 2 Gbytes. The <literal>largefiles</literal> option
means that a file system mounted with this option <emphasis>might</emphasis> contain
files larger than 2 Gbytes. If the <literal>nolargefiles</literal> option
is specified, the file system cannot be mounted on a system that is running
Solaris 2.6 or compatible versions. The default is <literal>largefiles</literal>. </para>
</entry>
</row><row><entry><para><literal>logging | nologging</literal></para>
</entry><entry><para>UFS</para>
</entry><entry><para>Enables or disables logging for the file system. UFS logging is the
process of storing transactions (changes that comprise a complete UFS operation)
into a log before the transactions are applied to the UFS file system. Logging
helps prevent UFS file systems from becoming inconsistent, which means <command>fsck</command> can be bypassed. Bypassing <command>fsck</command> reduces the
time to reboot a system if it crashes, or after a system is shut down uncleanly.</para><para>The log is allocated from free blocks on the file system, and is sized
at about 1 Mbyte per 1 Gbyte of file system, up to a maximum of 64 Mbytes.
The default is <literal>logging</literal>.</para>
</entry>
</row><row><entry><para><literal>atime | noatime</literal></para>
</entry><entry><para>UFS</para>
</entry><entry><para>Suppresses access time updates on files, except when they coincide with
updates to the time of the last file status change or the time of the last
file modification. For more information, see <olink targetdoc="refman2" targetptr="stat-2" remap="external"><citerefentry><refentrytitle>stat</refentrytitle><manvolnum>2</manvolnum></citerefentry></olink>. This option reduces disk activity on file systems
where access times are unimportant (for example, a Usenet news spool). The
default is normal access time (<literal>atime</literal>) recording.</para>
</entry>
</row><row><entry><para><literal>remount</literal></para>
</entry><entry><para>All</para>
</entry><entry><para>Changes the mount options associated with an already-mounted file system.
This option can generally be used with any option except <literal>ro</literal>.
However, what can be changed with this option depends on the file system type.</para>
</entry>
</row><row><entry><para><literal>retry=</literal><replaceable>n</replaceable></para>
</entry><entry><para>NFS</para>
</entry><entry><para>Retries the mount operation when it fails. <replaceable>n</replaceable> is
the number of times to retry.</para>
</entry>
</row><row><entry><para><literal>ro | rw</literal></para>
</entry><entry><para>CacheFS, NFS, PCFS, UFS, HSFS</para>
</entry><entry><para>Specifies read/write (<literal>rw</literal>) or read-only (<literal>ro</literal>).
If you do not specify this option, the default is <literal>rw</literal>. The
default option for HSFS is <literal>ro</literal>.</para>
</entry>
</row><row><entry><para><literal>suid | nosuid</literal></para>
</entry><entry><para>CacheFS, HSFS, NFS,  UFS</para>
</entry><entry><para>Allows or disallows <literal>setuid</literal> execution. The default
is to allow <literal>setuid</literal> execution.</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2><sect2 id="fsmount-81772"><title>Field Descriptions for the <filename>/etc/vfstab</filename> File</title><para>An entry in the <filename>/etc/vfstab</filename> file has seven fields,
which are described in the following table. </para><table frame="topbot" id="fsmount-57365"><title>Field Descriptions for the <filename>/etc/vfstab</filename> File</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="91*"/><colspec colname="column2" colwidth="305*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>device to mount</literal> </para>
</entry><entry><para>This field identifies one of the following:</para><itemizedlist><listitem><para>The block device name for a local UFS file system (for example, <filename>/dev/dsk/c0t0d0s0</filename>).</para>
</listitem><listitem><para>The resource name for a remote file system (for example, <filename>myserver:/export/home</filename>). For more information about NFS, see <olink targetdoc="sysadv3" remap="external"><citetitle remap="book">System Administration Guide: IP Services</citetitle></olink>.</para>
</listitem><listitem><para>The block device name of the slice on which to swap (for example, <filename>/dev/dsk/c0t3d0s1)</filename>.</para>
</listitem><listitem><para>A  directory for a virtual  file system.</para>
</listitem>
</itemizedlist>
</entry>
</row><row><entry><para><literal>device to fsck</literal></para>
</entry><entry><para>The raw (character) device name that corresponds to the UFS file system
identified by the <literal>device to mount</literal> field (for example, <filename>/dev/rdsk/c0t0d0s0</filename>). This field determines the raw interface that
is used by the <command>fsck</command> command. Use a dash (<literal>-</literal>)
when there is no applicable device, such as for a read-only file system or
a remote file system.</para>
</entry>
</row><row><entry><para><literal>mount point</literal> </para>
</entry><entry><para>Identifies where to mount the file system (for example, <filename>/usr</filename>).</para><para> </para>
</entry>
</row><row><entry><para><literal>FS type</literal></para>
</entry><entry><para>Identifies the type of file system.</para>
</entry>
</row><row><entry><para><literal>fsck pass</literal> </para>
</entry><entry><para>The pass number used by the <command>fsck</command> command to decide
whether to check a file system. When the field contains a dash (<literal>-</literal>),
the file system is not checked. Currently, the <literal>fsck pass</literal> value in the <filename>/etc/vfstab</filename> file is ignored during the boot process.</para><para>When the field contains a zero, UFS file systems are not checked. However,
non-UFS file systems are checked. When the field contains a value greater
than zero, the file system is always checked. </para><para>All file systems with a value of <literal>1</literal> in this field
are checked one at a time in the order they appear in the <filename>vfstab</filename> file.
When the <command>fsck</command> command is run on multiple UFS file systems
that have <literal>fsck pass</literal> values greater than 1 and the preen
option (<option>o p</option>) is used, the <command>fsck</command> command
automatically checks the file systems on different disks in parallel to maximize
efficiency. Otherwise, the value of the pass number does not have any effect. </para>
</entry>
</row><row><entry><para><literal>mount at boot</literal></para>
</entry><entry><para>Set to <literal>yes</literal> or <literal>no</literal> for whether the
file system should be automatically mounted by the <command>mountall</command> command
when the system is booted. Note that this field has nothing to do with AutoFS.
The root (<filename>/</filename>), <filename>/usr</filename> and <filename>/var</filename> file
systems are not mounted from the <filename>vfstab</filename> file initially.
This field should always be set to <literal>no</literal> for these file systems
and for virtual file systems such as <filename>/proc</filename> and <filename>/dev/fd</filename>.</para>
</entry>
</row><row><entry><para><filename>mount options</filename></para>
</entry><entry><para>A list of comma-separated options (with no spaces) that are used for
mounting the file system. Use a dash (<literal>-</literal>) to indicate no
options. For a list of commonly used mount options, see <olink targetptr="fsmount-66498" remap="internal">Table&nbsp;18&ndash;2</olink>.</para>
</entry>
</row>
</tbody>
</tgroup>
</table><note><para>You must have an entry in each field in the <filename>/etc/vfstab</filename> file.
 If there is no value for a field, be sure to specify a dash (<literal>-</literal>).
Otherwise, the system might not boot successfully. Similarly, white space
should not be used as a field value.</para>
</note>
</sect2>
</sect1><sect1 id="fsmount-5"><title>Mounting File Systems</title><para>The following sections describe how to mount a file system by adding
an entry in the <filename>/etc/vfstab</filename> file or by using the <command>mount</command> command from the command line.</para><sect2 id="fsmount-31406"><title>How to Determine Which File Systems Are Mounted</title><para>You can determine which file systems are already mounted by using
the <command>mount</command> command.</para><screen>$ <userinput>mount</userinput> [ <userinput>-v</userinput> ]</screen><para>The <option>v</option> displays the list of mounted file systems in
verbose mode.</para><example id="fsmount-4"><title>Determining Which File Systems Are Mounted</title><para>This example shows how to use the <command>mount</command> command to
display information about the file systems that are currently mounted.</para><screen>$ <userinput>mount</userinput>
/ on /dev/dsk/c0t0d0s0 read/write/setuid/intr/largefiles/xattr/onerror=...
/devices on /devices read/write/setuid/dev=46c0000 on Thu Sep  ...
/system/contract on ctfs read/write/setuid/devices/dev=43c0001 ... 
/usr on /dev/dsk/c0t0d0s6 read/write/setuid/intr/largefiles/xattr/...
/proc on /proc read/write/setuid/dev=4700000 on Thu Sep  2 ...
/etc/mnttab on mnttab read/write/setuid/dev=47c0000 on Thu Sep  2 ...
/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4480001 ...
/system/object on objfs read/write/setuid/devices/dev=44c0001 ...
/dev/fd on fd read/write/setuid/dev=4800000 on Thu Sep  2 ...
/var/run on swap read/write/setuid/xattr/dev=1 on Thu Sep  2 ...
/tmp on swap read/write/setuid/xattr/dev=2 on Thu Sep  2 ...
/stuff on /dev/dsk/c0t0d0s5 read/write/setuid/intr/largefiles/xattr...
/export/home on /dev/dsk/c0t0d0s7 read/write/setuid/intr/largefiles/...
/home/rimmer on pluto:/export/home/rimmer remote/read/write/setuid/xattr/...
$</screen>
</example>
</sect2><task id="fsmount-29904"><title>How to Add an Entry to the <filename>/etc/vfstab</filename> File</title><procedure><step id="fsmount-step-6"><para>Become superuser or assume an equivalent role.</para>
</step><step id="fsmount-step-11"><para>Create a mount point for the file system
to be mounted, if necessary.</para><screen># <userinput>mkdir</userinput> <replaceable>/mount-point</replaceable></screen><para>There must be a mount point
on the local system to mount a file system. A <emphasis>mount point</emphasis> is
a directory to which the mounted file system is attached.</para>
</step><step id="fsmount-step-7"><para>Edit the <filename>/etc/vfstab</filename> file and add an entry.
Ensure that you do the following:</para><substeps><step id="fsmount-step-8"><para>Separate each field with white space (a space
or a tab). </para>
</step><step id="fsmount-step-9"><para>Specify a dash (<literal>-</literal>) if a
field has no contents.</para>
</step><step id="fsmount-step-10"><para>Save the changes.</para>
</step>
</substeps><para>For detailed information about the <filename>/etc/vfstab</filename> field
entries, see <olink targetptr="fsmount-57365" remap="internal">Table&nbsp;18&ndash;3</olink>.</para><note><para>Because the root (<filename>/</filename>) file system is mounted
read-only by the kernel during the boot process, only the <literal>remount</literal> option
(and options that can be used in conjunction with <literal>remount</literal>)
affect the root (<filename>/</filename>) entry in the <filename>/etc/vfstab</filename> file.</para>
</note>
</step>
</procedure><example id="fncqz"><title>Adding an Entry to the <command>/etc/vfstab</command> File</title><para>The following example shows how to mount the disk slice <filename>/dev/dsk/c0t3d0s7</filename> as a UFS file system to the mount point <filename>/files1</filename>.
The raw character device <filename>/dev/rdsk/c0t3d0s7</filename> is specified
as the <literal>device to fsck</literal>. The <literal>fsck pass</literal> value
of <literal>2</literal> means that the file system will be checked, but not
sequentially. </para><screen width="100">#device           device             mount    FS       fsck   mount    mount
#to mount         to fsck            point    type     pass   at boot  options
#
/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /files1  ufs      2      yes       -</screen><para>The
following example shows how to mount the <filename>/export/man</filename> directory
from the system <literal>pluto</literal> as an NFS file system on mount point <filename>/usr/man</filename>. Neither a <literal>device to fsck</literal> nor a <literal>fsck
pass</literal> is specified because it's an NFS file system. In this example, <literal>mount options</literal> are <literal>ro</literal> (read-only) and <literal>soft</literal>.</para><screen width="100">#device           device             mount    FS       fsck   mount    mount
#to mount         to fsck            point    type     pass   at boot  options
pluto:/export/man   -                /usr/man nfs      -      yes       ro,soft</screen><para>The following example shows
how to mount the root (<filename>/</filename>) file system on a loopback mount
point, <filename>/tmp/newroot</filename>. LOFS file systems must always be
mounted after the file systems that are in the LOFS file system.   </para><screen width="100">#device           device             mount    FS       fsck   mount    mount
#to mount         to fsck            point    type     pass   at boot  options
#
/                   -                /tmp/newroot lofs -      yes       -                   </screen>
</example>
</task><task id="fsmount-14643"><title>How to Mount a File System (<filename>/etc/vfstab</filename> File)</title><procedure><step id="fsmount-step-15"><para>Become superuser or assume an equivalent
role.</para>
</step><step id="fsmount-step-16"><para>Mount a file system listed in the <filename>/etc/vfstab</filename> file.</para><screen># <userinput>mount</userinput> <replaceable>/mount-point</replaceable></screen><para>where <replaceable>/mount-point</replaceable> specifies an entry in
the <literal>mount point</literal> or <literal>device to mount</literal> field
in the <filename>/etc/vfstab</filename> file. It is usually easier to specify
the mount point.</para>
</step>
</procedure><example id="fncra"><title>Mounting a File System (<filename>/etc/vfstab</filename> File)</title><para>The following example shows how to mount the <filename>/usr/dist</filename> file
system that is listed in the <filename>/etc/vfstab</filename> file.</para><screen># <userinput>mount /usr/dist</userinput></screen>
</example><example id="fncqp"><title>Mounting All File Systems (<filename>/etc/vfstab</filename> File)</title><para>The following example shows the messages that are displayed when you
use the <command>mountall</command> command and the file systems are already
mounted.</para><screen># <userinput>mountall</userinput>
/dev/rdsk/c0t0d0s7 already mounted
mount: /tmp already mounted
mount: /dev/dsk/c0t0d0s7 is already mounted, /export/home is busy,
        or the allowable number of mount points has been exceeded</screen><para>When using the <command>mountall</command> command, all the file systems
with a <literal>device to fsck</literal> entry are checked and fixed, if necessary,
before they are mounted.</para><para>The following example shows how to mount all the local systems that
are listed in the <filename>/etc/vfstab</filename> file.</para><screen># <userinput>mountall -l</userinput>
# <userinput>mount</userinput>
/ on /dev/dsk/c0t0d0s0 read/write/setuid/intr/largefiles/xattr/onerror=...
/devices on /devices read/write/setuid/dev=46c0000 on Thu Sep  ...
/system/contract on ctfs read/write/setuid/devices/dev=43c0001 ... 
/usr on /dev/dsk/c0t0d0s6 read/write/setuid/intr/largefiles/xattr/...
/proc on /proc read/write/setuid/dev=4700000 on Thu Sep  2 ...
/etc/mnttab on mnttab read/write/setuid/dev=47c0000 on Thu Sep  2 ...
/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4480001 ...
/system/object on objfs read/write/setuid/devices/dev=44c0001 ...
/dev/fd on fd read/write/setuid/dev=4800000 on Thu Sep  2 ...
/var/run on swap read/write/setuid/xattr/dev=1 on Thu Sep  2 ...
/tmp on swap read/write/setuid/xattr/dev=2 on Thu Sep  2 ...
/stuff on /dev/dsk/c0t0d0s5 read/write/setuid/intr/largefiles/xattr...
/export/home on /dev/dsk/c0t0d0s7 read/write/setuid/intr/largefiles/...</screen><para>The following example shows how to mount all the remote file systems
that are listed in the <filename>/etc/vfstab</filename> file.</para><screen># <userinput>mountall -r</userinput>
# <userinput>mount</userinput>
/ on /dev/dsk/c0t0d0s0 read/write/setuid/intr/largefiles/xattr/onerror=...
/devices on /devices read/write/setuid/dev=46c0000 on Thu Sep  ...
/system/contract on ctfs read/write/setuid/devices/dev=43c0001 ... 
/usr on /dev/dsk/c0t0d0s6 read/write/setuid/intr/largefiles/xattr/...
/proc on /proc read/write/setuid/dev=4700000 on Thu Sep  2 ...
/etc/mnttab on mnttab read/write/setuid/dev=47c0000 on Thu Sep  2 ...
/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4480001 ...
/system/object on objfs read/write/setuid/devices/dev=44c0001 ...
/dev/fd on fd read/write/setuid/dev=4800000 on Thu Sep  2 ...
/var/run on swap read/write/setuid/xattr/dev=1 on Thu Sep  2 ...
/tmp on swap read/write/setuid/xattr/dev=2 on Thu Sep  2 ...
/stuff on /dev/dsk/c0t0d0s5 read/write/setuid/intr/largefiles/xattr...
/stuff on /dev/dsk/c0t0d0s5 read/write/setuid/intr/largefiles/xattr...
/export/home on /dev/dsk/c0t0d0s7 read/write/setuid/intr/largefiles/...
/home/rimmer on pluto:/export/home/rimmer remote/read/write/setuid/xattr/...</screen>
</example>
</task><task id="fsmount-13147"><title>How to Mount a UFS File System (<command>mount</command> Command)</title><procedure><step id="fsmount-step-19"><para>Become superuser or assume an equivalent
role.</para>
</step><step id="fsmount-step-18"><para>Create a mount point for the file system
to be mounted, if necessary.</para><screen># <userinput>mkdir</userinput> <replaceable>/mount-point</replaceable></screen><para>There must be a mount point on the local system to mount a file system.
A <emphasis>mount point</emphasis> is a directory to which the mounted file
system is attached.</para>
</step><step id="fsmount-step-20"><para>Mount the UFS file system.</para><screen># <userinput>mount</userinput> [<userinput>-o</userinput> <replaceable>mount-options</replaceable>] <userinput>/dev/dsk/</userinput><replaceable>device-name</replaceable> <replaceable>/mount-point</replaceable></screen><variablelist><varlistentry><term><option>o</option> <replaceable>mount-options</replaceable></term><listitem><para>Specifies mount options that you can use to mount a UFS file
system. For a list of options, see <olink targetptr="fsmount-66498" remap="internal">Table&nbsp;18&ndash;2</olink> or <olink targetdoc="refman1m" targetptr="mount-ufs-1m" remap="external"><citerefentry><refentrytitle>mount_ufs</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para>
</listitem>
</varlistentry><varlistentry><term><command>/dev/dsk/</command><replaceable>device-name</replaceable></term><listitem><para>Specifies the disk device name for the slice that contains
the file system (for example, <filename>/dev/dsk/c0t3d0s7</filename>).  To
view slice information for a disk, see <olink targetptr="disksprep-23207" remap="internal">How
to Display Disk Slice Information</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>/mount-point</replaceable></term><listitem><para>Specifies the directory on which to mount the file system.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="fncqr"><title>Mounting a UFS File System (<command>mount</command> Command)</title><para>The following example shows how to mount <filename>/dev/dsk/c0t3d0s7</filename> on
the <filename>/files1</filename> directory.</para><screen># <userinput>mount /dev/dsk/c0t3d0s7 /files1</userinput></screen>
</example>
</task><task id="fsmount-40"><title>How to Mount a UFS File System Without Large
Files (<command>mount</command> Command)</title><tasksummary><para>When you mount a file system, the <literal>largefiles</literal> option
is selected by default. This option enables you to create files larger than
2 Gbytes. Once a file system contains large files, you cannot remount the
file system with the <literal>nolargefiles</literal> option or mount it on
a system that is running Solaris 2.6 or compatible versions, until you remove
any large files and run the <command>fsck</command> command to reset the state
to <literal>nolargefiles</literal>.</para><para>This procedure assumes that the file system is in the <filename>/etc/vfstab</filename> file.</para>
</tasksummary><procedure><step id="fsmount-step-4"><para>Become superuser or assume
an equivalent role.</para>
</step><step id="fsmount-step-14"><para>Create a mount point for the file system
to be mounted, if necessary.</para><screen># <userinput>mkdir</userinput> <replaceable>/mount-point</replaceable></screen><para>There must be a mount point on the local system to mount a file system.
A <emphasis>mount point</emphasis> is a directory to which the mounted file
system is attached.</para>
</step><step id="fsmount-step-5"><para>Ensure that no large files exist in the file
system.</para><screen># <userinput>cd</userinput> <replaceable>/mount-point</replaceable>
# <userinput>find . -xdev -size +20000000 -exec ls -l {} \;</userinput></screen><para>where <replaceable>/mount-point</replaceable> identifies the mount point
of the file system you want to check for large files.</para>
</step><step id="fsmount-step-22"><para>Remove or move any large files in this file
system to another file system, if necessary.</para>
</step><step id="fsmount-step-1"><para>Unmount the file system.</para><screen># <userinput>umount <replaceable>/mount-point</replaceable></userinput></screen>
</step><step id="fsmount-step-2"><para>Reset the file system state.</para><screen># <userinput>fsck <replaceable>/mount-point</replaceable></userinput></screen>
</step><step id="fsmount-step-3"><para>Remount the file system with the <command>nolargefiles</command> option.</para><screen># <userinput>mount -o nolargefiles <replaceable>/mount-point</replaceable></userinput></screen>
</step>
</procedure><example id="fncqt"><title>Mounting a File System Without Large Files (<command>mount</command> Command)</title><para>The following example shows how to check the <filename>/datab</filename> file
system and remount it with the <literal>nolargefiles</literal> option.</para><screen># <userinput>cd /datab</userinput>
# <userinput>find . -xdev -size +20000000 -exec ls -l {} \;</userinput>
# <userinput>umount /datab</userinput> 
# <userinput>fsck /datab</userinput>
# <userinput>mount -o nolargefiles /datab</userinput></screen>
</example>
</task><task id="fsmount-69423"><title>How to Mount an NFS File System (<command>mount</command> Command)</title><procedure><step id="fsmount-step-23"><para>Become superuser or assume an equivalent
role.</para>
</step><step id="fsmount-step-13"><para>Create a mount point for the file system
to be mounted, if necessary.</para><screen># <userinput>mkdir</userinput> <replaceable>/mount-point</replaceable></screen><para>There must be a mount point on the local system to mount a file system.
A mount point is a directory to which the mounted file system is attached.</para>
</step><step id="fsmount-step-24"><para>Ensure that the resource (file or directory)
is available from a server.</para><para>To mount an NFS file system, the resource
must be made available on the server by using the <command>share</command> command.
For information on how to share resources, see <olink targetdoc="sysadv4" targetptr="rfsintro-7" remap="external"><citetitle remap="section">About the NFS Service</citetitle> in <citetitle remap="book">System Administration Guide: Network Services</citetitle></olink>.</para>
</step><step id="fsmount-step-25"><para>Mount the NFS file system.</para><screen># <userinput>mount -F nfs</userinput> [<userinput>-o</userinput> <replaceable>mount-options</replaceable>] <replaceable>server</replaceable><userinput>:/</userinput><replaceable>directory</replaceable> <replaceable>/mount-point</replaceable></screen><variablelist><varlistentry><term><option>o</option> <replaceable>mount-options</replaceable></term><listitem><para>Specifies mount options that you can use to mount an NFS file
system. See <olink targetptr="fsmount-66498" remap="internal">Table&nbsp;18&ndash;2</olink> for
the list of commonly used <command>mount</command> options or <olink targetdoc="refman1m" targetptr="mount-nfs-1m" remap="external"><citerefentry><refentrytitle>mount_nfs</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> for a complete
list of options.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>server:/directory</replaceable></term><listitem><para>Specifies the server's host name that contains the shared
resource, and the path to the file or directory to mount.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>/mount-point</replaceable></term><listitem><para>Specifies the directory on which to mount the file system.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="fncqu"><title>Mounting an NFS File System (<command>mount</command> Command)</title><para>The following example shows how to mount the <filename>/export/packages</filename> directory
on <filename>/mnt</filename> from the server <literal>pluto</literal>.</para><screen># <userinput>mount -F nfs pluto:/export/packages /mnt</userinput></screen>
</example>
</task><task id="fsmount-80332" arch="x86"><title>How to Mount a PCFS (DOS) File
System From a Hard Disk (<command>mount</command> Command)</title><tasksummary><para>Use the following procedure to mount a PCFS (DOS) file system from a
hard disk.</para>
</tasksummary><procedure><step id="fsmount-step-32"><para>Become superuser or assume an equivalent
role.</para>
</step><step id="fsmount-step-21"><para>Create a mount point for the file system
to be mounted, if necessary.</para><screen># <userinput>mkdir</userinput> <replaceable>/mount-point</replaceable></screen><para>There must be a mount point on the local system to mount a file system.
A <emphasis>mount point</emphasis> is a directory to which the mounted file
system is attached.</para>
</step><step id="fsmount-step-33"><para>Mount the PCFS file system.</para><screen># <userinput>mount -F pcfs</userinput> [<userinput>-o rw</userinput> | <userinput>ro</userinput>] <userinput>/dev/dsk/</userinput><replaceable>device-name</replaceable><userinput>:</userinput><replaceable>logical-drive</replaceable> <replaceable>/mount-point</replaceable></screen><variablelist><varlistentry><term><option>o rw | ro</option></term><listitem><para>Specifies that you can mount a PCFS file system read/write
(<literal>rw</literal>) or read-only (<literal>ro</literal>). If you do not
specify this option, the default is <literal>rw</literal>.</para>
</listitem>
</varlistentry><varlistentry><term><command>/dev/dsk/</command><replaceable>device-name</replaceable></term><listitem><para>Specifies the device name of the whole disk (for example, <filename>/dev/dsk/c0t0d0p0</filename>).</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>logical-drive</replaceable></term><listitem><para>Specifies either the DOS logical drive letter (c through z)
or a drive number (1 through 24). Drive c is equivalent to drive 1 and represents
the primary DOS slice on the drive. All other letters or numbers represent
DOS logical drives within the extended DOS slice.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>/mount-point</replaceable></term><listitem><para>Specifies the directory on which to mount the file system.</para>
</listitem>
</varlistentry>
</variablelist><para>Note that the <emphasis>device-name</emphasis> and <emphasis>logical-drive</emphasis> must
be separated by a colon.</para>
</step>
</procedure><example id="fsmount-34" arch="x86"><title>Mounting a PCFS (DOS) File System From a Hard Disk (<command>mount</command> Command)</title><para>The following example shows how to mount the logical drive in the primary
DOS slice on the <filename>/pcfs/c</filename> directory.  </para><screen># <userinput>mount -F pcfs /dev/dsk/c0t0d0p0:c /pcfs/c</userinput></screen><para>The following example shows how to mount read-only the first logical
drive in the extended DOS slice on the <filename>/mnt</filename> directory.</para><screen># <userinput>mount -F pcfs -o ro /dev/dsk/c0t0d0p0:2 /mnt</userinput></screen>
</example>
</task>
</sect1><sect1 id="fsmount-35"><title>Unmounting File Systems</title><para>The unmounting of a file system removes it from the file system mount
point, and deletes the entry from the <filename>/etc/mnttab</filename> file.
Some file system administration tasks cannot be performed on mounted file
systems. You should unmount a file system when the following occurs:</para><itemizedlist><listitem><para>The file system is no longer needed or has been replaced by
a file system that contains more current software.</para>
</listitem><listitem><para>You need to check and repair the file system by using the <command>fsck</command> command. For more information about the <command>fsck</command> command,
see <olink targetptr="fstroublefsck-61446" remap="internal">Chapter&nbsp;21, Checking UFS File
System Consistency (Tasks)</olink>.</para><para>File systems should be unmounted
before doing a complete backup. For more information about doing backups,
see <olink targetptr="bkuptasks2-64128" remap="internal">Chapter&nbsp;24, Backing Up Files
and File Systems (Tasks)</olink>.</para><note><para>File systems are automatically unmounted as part of the system
shutdown procedure.</para>
</note>
</listitem>
</itemizedlist><para>In an emergency situation, you can use the <command>umount</command> <option>f</option> option to forcibly unmount a busy file system. This practice is
not recommended under normal circumstances because the unmounting of a file
system with open files could cause a loss of data. This option is only available
for UFS and NFS file systems.</para><sect2 id="fsmount-51852"><title>Prerequisites for Unmounting File Systems</title><para>The prerequisites for unmounting file systems include the following:</para><itemizedlist><listitem><para>You must be superuser or assume an equivalent role.</para>
</listitem><listitem><para>A file system must be available for unmounting. You cannot
unmount a file system that is busy. A file system is considered busy if a
user is accessing a directory in the file system, if a program has a file
open in that file system, or if the file system is being shared. You can make
a file system available for unmounting by doing the following:</para><itemizedlist><listitem><para>Changing to a directory in a different file system.</para>
</listitem><listitem><para>Logging out of the system.</para>
</listitem><listitem><para>Using the <command>fuser</command> command to list all processes
that are accessing the file system and to stop them, if necessary. For more
details, see <olink targetptr="fsmount-85827" remap="internal">How to Stop All Processes Accessing
a File System</olink>.</para><para>Notify users if you need to unmount a file
system that they are using. </para>
</listitem><listitem><para>Unsharing the file system. For information about unsharing
a file system, see <olink targetdoc="refman1m" targetptr="unshare-1m" remap="external"><citerefentry><refentrytitle>unshare</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</sect2><sect2 id="fsmount-36"><title>How to Verify a File System is Unmounted</title><para>To verify that you unmounted a file system or a number of file systems,
examine the output from the <command>mount</command> command.</para><screen>$ <userinput>mount | grep</userinput> <replaceable>unmounted-file-system</replaceable>
$</screen>
</sect2><task id="fsmount-85827"><title>How to Stop All Processes Accessing a File
System</title><procedure><step id="fsmount-step-38"><para>Become superuser or assume an
equivalent role.</para>
</step><step id="fsmount-step-39"><para>List all the processes that are accessing
the file system so that you know which processes you are going to stop.</para><screen># <userinput>fuser -c</userinput> [ <userinput>-u</userinput> ] <replaceable>/mount-point</replaceable></screen><variablelist><varlistentry><term><option>c</option></term><listitem><para>Reports on files that are mount points for file systems and
any files within those mounted file systems.</para>
</listitem>
</varlistentry><varlistentry><term><option>u</option></term><listitem><para>Displays the user login name for each process ID.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>/mount-point</replaceable></term><listitem><para>Specifies the name of the file system for which you want to
stop processes.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="fsmount-step-40"><para>Stop all processes that are accessing the
file system.</para><screen># <userinput>fuser -c -k</userinput> <replaceable>/mount-point</replaceable></screen><para>A <filename>SIGKILL</filename> is sent to each process that is using
the file system.</para><note><para>You should not stop a user's processes without first warning the
user.</para>
</note>
</step><step id="fsmount-step-41"><para>Verify that no processes are accessing the
file system.</para><screen># <userinput>fuser -c</userinput> <replaceable>/mount-point</replaceable></screen>
</step>
</procedure><example id="fncrb"><title>Stopping All Processes Accessing a File System</title><para>The following example shows how to stop process <literal>4006c</literal> that
is using the <filename>/export/home</filename> file system.</para><screen># <userinput>fuser -c /export/home</userinput>
/export/home:     4006c
# <userinput>fuser -c -k /export/home</userinput>
/export/home:     4006c
# <userinput>fuser -c /export/home</userinput>
/export/home: </screen>
</example>
</task><task id="fsmount-73813"><title>How to Unmount a File System</title><tasksummary><para>Use the following procedure to unmount a file system, except for the
root (<filename>/</filename>), <filename>/usr</filename>, or <filename>/var</filename> file
systems.</para><note><para>The root (<filename>/</filename>), <filename>/usr</filename>,
and <filename>/var</filename> file systems can be unmounted only during a
shutdown. The system needs these file systems to function.</para>
</note>
</tasksummary><procedure><step id="fsmount-step-44"><para>Ensure that you have met the prerequisites
listed in <olink targetptr="fsmount-51852" remap="internal">Prerequisites for Unmounting File
Systems</olink>.</para>
</step><step id="fsmount-step-45"><para>Unmount the file system.</para><screen># <userinput>umount</userinput> <replaceable>/mount-point</replaceable></screen><para>where <replaceable>/mount-point</replaceable> is the name of the file
system that you want to unmount. This can be one of the following: </para><itemizedlist><listitem><para>The directory name where the file system is mounted</para>
</listitem><listitem><para>The device name path of the file system</para>
</listitem><listitem><para>The resource for an NFS file system</para>
</listitem><listitem><para>The loopback directory for an LOFS file system</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="fncqq"><title>Unmounting a File System</title><para>The following example shows how to unmount a local home file system.</para><screen># <userinput>umount /export/home</userinput></screen><para>The following example shows how to unmount the file system on slice
7.</para><screen># <userinput>umount /dev/dsk/c0t0d0s7</userinput></screen><para>The following example shows how to forcibly unmount the <filename>/export</filename> file
system.</para><screen># <userinput>umount -f /export</userinput>
# </screen><para>The following example shows how to unmount all file systems in the <filename>/etc/vfstab</filename> file, except for the root (<filename>/</filename>), <filename>/proc</filename>, <filename>/var</filename>, and <filename>/usr</filename> file
systems.</para><screen># <userinput>umountall</userinput></screen><para>All file systems are unmounted, except for those file systems that are
busy.</para>
</example>
</task>
</sect1>
</chapter>