Information on mounting and unmounting filesystems.

Add a disk type to the vnconfig disklabel.
This commit is contained in:
Neil Blakey-Milner 2000-03-25 20:05:40 +00:00
parent 7bbaccde07
commit 2c7bde250c
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=6865
2 changed files with 444 additions and 2 deletions

View file

@ -91,6 +91,227 @@
</tgroup>
</table>
<sect2>
<title>Slices and partitions</title>
<para>Physical disks usually contain
<firstterm>slices</firstterm>, unless they are
<quote>dangerously dedicated</quote>. Slice numbers follow
the device name, prefixed with an <literal>s</literal>:
<quote>da0<emphasis>s1</emphasis></quote>.</para>
<para>Slices, <quote>dangerously dedicated</quote> physical
drives, and other drives contain
<firstterm>partitions</firstterm>, which represented as
letters from <literal>a</literal> to <literal>h</literal>.
<literal>b</literal> is reserved for swap partitions, and
<literal>c</literal> is an unused partition the size of the
entire slice or drive. This is explained in <xref
linkend="disks-adding" />.</para>
</sect2>
</sect1>
<sect1 id="disks-mounting">
<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>
<para>There are various reasons to house certain of these
directories on separate filesystems. <filename>/var</filename>
contains log, spool, and various types of temporary files, and
as such, may get filled up. Filling up the root filesystem
isn't a good idea, so splitting <filename>/var</filename> from
<filename>/</filename> is often a good idea.</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 fstab file</title>
<para>During the <link linkend="boot">boot process</link>,
filesystems listed in <filename>/etc/fstab</filename> are
automatically mounted (unless they are listed with
<option>noauto</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>
<para><literal>device</literal> is a device name (which should
exist), as explained in the <link linkend="disks-naming">Disk
naming conventions</link> above.</para>
<para><literal>mount-point</literal> is a directory (which
should exist), on which to mount the filesystem.</para>
<para><literal>fstype</literal> is the filesystem type to pass
to &man.mount.8;. The default FreeBSD filesystem is
<literal>ufs</literal>.</para>
<para><literal>options</literal> is 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 in the &man.mount.8; manual page.</para>
<para><literal>dumpfreq</literal> is the number of days the
filesystem should be dumped, and <literal>passno</literal> is
the pass number during which the filesystem is mounted during
the boot sequence.</para>
</sect2>
<sect2 id="disks-mount">
<title>The mount command</title>
<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 filesystems in
<filename>/etc/fstab</filename>, as modified by
<option>-t</option>, if given.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d</option></term>
<listitem>
<para>Do everything but actually mount the
filesystem.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-f</option></term>
<listitem>
<para>Force the mounting the filesystem.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-r</option></term>
<listitem>
<para>Mount the filesystem read-only.</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> 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. Useful security option.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>noexec</term>
<listitem>
<para>Do not allow execution of binaries on this
filesystem. Useful security option.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>nosuid</term>
<listitem>
<para>Do not interpret setuid or setgid flags on the
filesystem. Useful security option.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="disks-umount">
<title>The umount command</title>
<para>The umount 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, doesn't attempt to unmount the
root filesystem.</para>
</sect2>
</sect1>
<sect1 id="disks-adding">
@ -267,7 +488,7 @@
5120+0 records in
5120+0 records out
&prompt.root; <userinput>vnconfig -s labels -c vn<replaceable>0</replaceable> <replaceable>newimage</replaceable></userinput>
&prompt.root; <userinput>disklabel -r -w vn<replaceable>0</replaceable></userinput>
&prompt.root; <userinput>disklabel -r -w vn<replaceable>0</replaceable> auto</userinput>
&prompt.root; <userinput>newfs vn<replaceable>0</replaceable>c</userinput>
Warning: 2048 sector(s) in last cylinder unallocated
/dev/rvn0c: 10240 sectors in 3 cylinders of 1 tracks, 4096 sectors

View file

@ -91,6 +91,227 @@
</tgroup>
</table>
<sect2>
<title>Slices and partitions</title>
<para>Physical disks usually contain
<firstterm>slices</firstterm>, unless they are
<quote>dangerously dedicated</quote>. Slice numbers follow
the device name, prefixed with an <literal>s</literal>:
<quote>da0<emphasis>s1</emphasis></quote>.</para>
<para>Slices, <quote>dangerously dedicated</quote> physical
drives, and other drives contain
<firstterm>partitions</firstterm>, which represented as
letters from <literal>a</literal> to <literal>h</literal>.
<literal>b</literal> is reserved for swap partitions, and
<literal>c</literal> is an unused partition the size of the
entire slice or drive. This is explained in <xref
linkend="disks-adding" />.</para>
</sect2>
</sect1>
<sect1 id="disks-mounting">
<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>
<para>There are various reasons to house certain of these
directories on separate filesystems. <filename>/var</filename>
contains log, spool, and various types of temporary files, and
as such, may get filled up. Filling up the root filesystem
isn't a good idea, so splitting <filename>/var</filename> from
<filename>/</filename> is often a good idea.</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 fstab file</title>
<para>During the <link linkend="boot">boot process</link>,
filesystems listed in <filename>/etc/fstab</filename> are
automatically mounted (unless they are listed with
<option>noauto</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>
<para><literal>device</literal> is a device name (which should
exist), as explained in the <link linkend="disks-naming">Disk
naming conventions</link> above.</para>
<para><literal>mount-point</literal> is a directory (which
should exist), on which to mount the filesystem.</para>
<para><literal>fstype</literal> is the filesystem type to pass
to &man.mount.8;. The default FreeBSD filesystem is
<literal>ufs</literal>.</para>
<para><literal>options</literal> is 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 in the &man.mount.8; manual page.</para>
<para><literal>dumpfreq</literal> is the number of days the
filesystem should be dumped, and <literal>passno</literal> is
the pass number during which the filesystem is mounted during
the boot sequence.</para>
</sect2>
<sect2 id="disks-mount">
<title>The mount command</title>
<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 filesystems in
<filename>/etc/fstab</filename>, as modified by
<option>-t</option>, if given.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d</option></term>
<listitem>
<para>Do everything but actually mount the
filesystem.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-f</option></term>
<listitem>
<para>Force the mounting the filesystem.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-r</option></term>
<listitem>
<para>Mount the filesystem read-only.</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> 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. Useful security option.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>noexec</term>
<listitem>
<para>Do not allow execution of binaries on this
filesystem. Useful security option.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>nosuid</term>
<listitem>
<para>Do not interpret setuid or setgid flags on the
filesystem. Useful security option.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="disks-umount">
<title>The umount command</title>
<para>The umount 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, doesn't attempt to unmount the
root filesystem.</para>
</sect2>
</sect1>
<sect1 id="disks-adding">
@ -267,7 +488,7 @@
5120+0 records in
5120+0 records out
&prompt.root; <userinput>vnconfig -s labels -c vn<replaceable>0</replaceable> <replaceable>newimage</replaceable></userinput>
&prompt.root; <userinput>disklabel -r -w vn<replaceable>0</replaceable></userinput>
&prompt.root; <userinput>disklabel -r -w vn<replaceable>0</replaceable> auto</userinput>
&prompt.root; <userinput>newfs vn<replaceable>0</replaceable>c</userinput>
Warning: 2048 sector(s) in last cylinder unallocated
/dev/rvn0c: 10240 sectors in 3 cylinders of 1 tracks, 4096 sectors