Move section on mounting and unmounting filesystems from
Storage chapter to Basics. Suggested by: nik and murray
This commit is contained in:
parent
d7a17bf2f2
commit
6cfc9d250f
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=10674
1 changed files with 255 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
<!--
|
||||
The FreeBSD Documentation Project
|
||||
|
||||
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/basics/chapter.sgml,v 1.44 2001/08/30 22:44:35 logo Exp $
|
||||
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/basics/chapter.sgml,v 1.45 2001/09/08 00:12:38 murray Exp $
|
||||
-->
|
||||
|
||||
<chapter id="basics">
|
||||
|
@ -449,6 +449,260 @@
|
|||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="mount-unmount">
|
||||
<title>Mounting and Unmounting Filesystems</title>
|
||||
|
||||
<para>The filesystem is best visualized as a tree,
|
||||
rooted, as it were, at <filename>/</filename>.
|
||||
<filename>/dev</filename>, <filename>/usr</filename>, and the
|
||||
other directories in the root directory are branches, which may
|
||||
have their own branches, such as
|
||||
<filename>/usr/local</filename>, and so on.</para>
|
||||
|
||||
<indexterm><primary>root filesystem</primary></indexterm>
|
||||
<para>There are various reasons to house some of these
|
||||
directories on separate filesystems. <filename>/var</filename>
|
||||
contains the directories <filename>log/</filename>,
|
||||
<filename>spool/</filename>,
|
||||
and various types of temporary files, and
|
||||
as such, may get filled up. Filling up the root filesystem
|
||||
is not a good idea, so splitting <filename>/var</filename> from
|
||||
<filename>/</filename> is often favorable.</para>
|
||||
|
||||
<para>Another common reason to contain certain directory trees on
|
||||
other filesystems is if they are to be housed on separate
|
||||
physical disks, or are separate virtual disks, such as <link
|
||||
linkend="nfs">Network File System</link> mounts, or CDROM
|
||||
drives.</para>
|
||||
|
||||
<sect2 id="disks-fstab">
|
||||
<title>The <filename>fstab</filename> File</title>
|
||||
<indexterm>
|
||||
<primary>filesystems</primary>
|
||||
<secondary>mounted with fstab</secondary>
|
||||
</indexterm>
|
||||
|
||||
<para>During the <link linkend="boot">boot process</link>,
|
||||
filesystems listed in <filename>/etc/fstab</filename> are
|
||||
automatically mounted (unless they are listed with the
|
||||
<option>noauto</option> option).</para>
|
||||
|
||||
<para>The <filename>/etc/fstab</filename> file contains a list
|
||||
of lines of the following format:</para>
|
||||
|
||||
<programlisting><replaceable>device</replaceable> <replaceable>/mount-point</replaceable> <replaceable>fstype</replaceable> <replaceable>options</replaceable> <replaceable>dumpfreq</replaceable> <replaceable>passno</replaceable></programlisting>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>device</literal></term>
|
||||
<listitem>
|
||||
<para>A device name (which should exist), as explained in
|
||||
<link linkend="disks-naming">Disk naming
|
||||
conventions</link> above.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>mount-point</literal></term>
|
||||
|
||||
<listitem><para>A directory (which should exist), on which
|
||||
to mount the filesystem.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>fstype</literal></term>
|
||||
|
||||
<listitem><para>The filesystem type to pass to
|
||||
&man.mount.8;. The default FreeBSD filesystem is
|
||||
<literal>ufs</literal>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>options</literal></term>
|
||||
|
||||
<listitem><para>Either <option>rw</option> for read-write
|
||||
filesystems, or <option>ro</option> for read-only
|
||||
filesystems, followed by any other options that may be
|
||||
needed. A common option is <option>noauto</option> for
|
||||
filesystems not normally mounted during the boot sequence.
|
||||
Other options are listed in the &man.mount.8; manual page.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>dumpfreq</literal></term>
|
||||
|
||||
<listitem><para>The number of days the filesystem should be
|
||||
dumped, and <literal>passno</literal> is the pass number
|
||||
during which the filesystem is checked during the boot
|
||||
sequence.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="disks-mount">
|
||||
<title>The mount Command</title>
|
||||
<indexterm>
|
||||
<primary>filesystems</primary>
|
||||
<secondary>mounting</secondary>
|
||||
</indexterm>
|
||||
|
||||
<para>The &man.mount.8; command is what is ultimately used to
|
||||
mount filesystems.</para>
|
||||
|
||||
<para>In its most basic form, you use:</para>
|
||||
|
||||
<informalexample>
|
||||
<screen>&prompt.root; <userinput>mount <replaceable>device</replaceable> <replaceable>mountpoint</replaceable></userinput></screen>
|
||||
</informalexample>
|
||||
|
||||
<para>There are plenty of options, as mentioned in the
|
||||
&man.mount.8; manual page, but the most common are:</para>
|
||||
|
||||
<variablelist>
|
||||
<title>Mount Options</title>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-a</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Mount all the filesystems listed in
|
||||
<filename>/etc/fstab</filename>. Exceptions are those
|
||||
marked as <quote>noauto</quote>, excluded by the
|
||||
<option>-t</option> flag, or those that are already
|
||||
mounted.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-d</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Do everything except for the actual system call.
|
||||
This option is useful in conjunction with the
|
||||
<option>-v</option> flag to determine what the
|
||||
<command>mount</command> is actually trying to do.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-f</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Force the mount of an unclean filesystem
|
||||
(dangerous), or forces the revocation of write access
|
||||
when downgrading a filesystem's mount status from
|
||||
read-write to read-only.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-r</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Mount the filesystem read-only. This is identical
|
||||
to using the <option>rdonly</option> argument to the
|
||||
<option>-o</option> option.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-t</option>
|
||||
<replaceable>fstype</replaceable></term>
|
||||
|
||||
<listitem>
|
||||
<para>Mount the given filesystem as the given filesystem
|
||||
type, or mount only filesystems of the given type, if
|
||||
given the <option>-a</option> option.</para>
|
||||
|
||||
<para><quote>ufs</quote> is the default filesystem
|
||||
type.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-u</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Update mount options on the filesystem.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-v</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Be verbose.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-w</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Mount the filesystem read-write.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>The <option>-o</option> option takes a comma-separated list of
|
||||
the options, including the following:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>nodev</term>
|
||||
|
||||
<listitem>
|
||||
<para>Do not interpret special devices on the
|
||||
filesystem. This is a useful security option.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>noexec</term>
|
||||
|
||||
<listitem>
|
||||
<para>Do not allow execution of binaries on this
|
||||
filesystem. This is also a useful security option.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>nosuid</term>
|
||||
|
||||
<listitem>
|
||||
<para>Do not interpret setuid or setgid flags on the
|
||||
filesystem. This is also a useful security option.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="disks-umount">
|
||||
<title>The <command>umount</command> Command</title>
|
||||
<indexterm>
|
||||
<primary>filesystems</primary>
|
||||
<secondary>unmounting</secondary>
|
||||
</indexterm>
|
||||
|
||||
<para>The &man.umount.8; command takes, as a parameter, one of a
|
||||
mountpoint, a device name, or the <option>-a</option> or
|
||||
<option>-A</option> option.</para>
|
||||
|
||||
<para>All forms take <option>-f</option> to force unmounting,
|
||||
and <option>-v</option> for verbosity.</para>
|
||||
|
||||
<para><option>-a</option> and <option>-A</option> are used to
|
||||
unmount all mounted filesystems, possibly modified by the
|
||||
filesystem types listed after <option>-t</option>.
|
||||
<option>-A</option>, however, does not attempt to unmount the
|
||||
root filesystem.</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="basics-processes">
|
||||
<title>Processes</title>
|
||||
|
||||
|
|
Loading…
Reference in a new issue