From owner-doc-jp@jp.freebsd.org  Sun Jul  9 00:59:30 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id AAA72882;
	Sun, 9 Jul 2000 00:59:30 +0900 (JST)
	(envelope-from owner-doc-jp@jp.FreeBSD.org)
Received: from sv01.geocities.co.jp (sv01.geocities.co.jp [210.153.89.155])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id AAA72877
	for <doc-jp@jp.freebsd.org>; Sun, 9 Jul 2000 00:59:29 +0900 (JST)
	(envelope-from hrs@geocities.co.jp)
Received: from mail.geocities.co.jp (mail.geocities.co.jp [210.153.89.137]) by sv01.geocities.co.jp (8.9.3+3.2W/3.7W) with ESMTP id AAA22313 for <doc-jp@jp.freebsd.org>; Sun, 9 Jul 2000 00:59:29 +0900 (JST)
Received: from mail.hrs.jp (sutnmax2-ppp16.ed.noda.sut.ac.jp [133.31.173.86]) by mail.geocities.co.jp (1.3G-GeocitiesJ-3.3) with ESMTP id AAA02199 for <doc-jp@jp.freebsd.org>; Sun, 9 Jul 2000 00:59:26 +0900 (JST)
Message-Id: <200007081559.AAA02199@mail.geocities.co.jp>
Received: from localhost (alph.hrs.jp [192.168.0.10])
	by mail.hrs.jp (8.9.3/3.7W/DomainMaster) with ESMTP id AAA85910
	for <doc-jp@jp.freebsd.org>; Sun, 9 Jul 2000 00:47:20 +0900 (JST)
	(envelope-from hrs@hrs.jp)
To: doc-jp@jp.freebsd.org
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Date: Sun, 09 Jul 2000 00:47:19 +0900
From: Hiroki Sato <hrs@geocities.co.jp>
X-Dispatcher: imput version 990905(IM130)
Lines: 343
Reply-To: doc-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: doc-jp 7509
Subject: [doc-jp 7509] handbook/disks/chapter.sgml 1.21
Errors-To: owner-doc-jp@jp.freebsd.org
Sender: owner-doc-jp@jp.freebsd.org
X-Originator: hrs@geocities.co.jp

$B:4F#!wEl5~M}2JBg3X$G$9!#(B

 [doc-jp 7475] $B$NNkLZ$5$s$N:9J,$+$i!":G?7HG$^$G$N:9J,$G$9!#(B 
 $B$A$g$$D9$$$N$G$9$,86J8$rN.$7$F$*$-$^$9$N$G!"(B
 $B$I$J$?$+K]Lu:n6H$r$*4j$$$7$^$9!#(B

 o SGML $B%?%0(B(<....> $B$NItJ,(B)$B0J30$rK]Lu$7$F$/$@$5$$!#(B
   $B$^$?!"(B<screen> <programlisting> $B$G3g$i$l$?ItJ,$rLu$9I,MW$O$"$j$^$;$s!#(B
 o $B@.2LJ*$O(B doc-jp@jp.FreeBSD.org $B$K$*4j$$$7$^$9!#(B
   $BFI$a$k$h$&$K$J$C$F$$$l$P!"7A<0$O$I$N$h$&$J$b$N$G$b9=$$$^$;$s$7!"(B
   $B0lIt$NK]Lu$G$b9=$$$^$;$s!#(B
 o $B$o$+$i$J$$$3$H$,$"$l$P1sN8$J$/<ALd$7$F$/$@$5$$!#(B

--
| $B:4F#(B $B9-@8!wEl5~M}2JBg3X(B <hrs@geocities.co.jp>
|
|                                     j7397067@ed.noda.sut.ac.jp(UNIV)
|                                sato@sekine00.ee.noda.sut.ac.jp(UNIV)
|                                     hrs@FreeBSD.org(FreeBSD Project)

----($B$3$3$+$i(B)

  <sect1 id="disks-bios-numbering">
    <title>BIOS $B$N%I%i%$%VHV9f(B</title>

    <para>Before you install and configure FreeBSD on your system, there is an
      important subject that you should be aware of if, especially if you have
      multiple hard drives.</para>    

    <para>In a PC running DOS or any of the BIOS-dependent operating systems
      (WINxxx), the BIOS is able to abstract the normal disk drive order, and
      the operating system goes along with the change.  This allows the user
      to boot from a disk drive other than the so-called <quote>primary
	master</quote>.  This is especially convenient for some users who have
      found that the simplest and cheapest way to keep a system backup is to
      buy an identical second hard drive, and perform routine copies of the
      first drive to the second drive using Ghost or XCOPY.  Then, if the
      first drive fails, or is attacked by a virus, or is scribbled upon by an
      operating system defect, he can easily recover by instructing the BIOS
      to logically swap the drives. It's like switching the cables on the
      drives, but without having to open the case.</para>

    <para>More expensive systems with SCSI controllers often include BIOS
      extensions which allow the SCSI drives to be re-ordered in a similar
      fashion for up to seven drives.</para>

    <para>A user who is accustomed to taking advantage of these features may
      become surprised when the results with FreeBSD are not as expected.
      FreeBSD does not use the BIOS, and does not know the <quote>logical BIOS
	drive mapping</quote>.  This can lead to very perplexing situations,
      especially when drives are physically identical in geometry, and have
      also been made as data clones of one another.</para>

    <para>When using FreeBSD, always restore the BIOS to natural drive
      numbering before installing FreeBSD, and then leave it that way.  If you
      need to switch drives around, then do so, but do it the hard way, and
      open the case and move the jumpers and cables.</para>

    <sidebar>
      <title>An illustration from the files of Bill and Fred's Exceptional
	Adventures:</title>
      
      <para>Bill breaks-down an older Wintel box to make another FreeBSD box
	for Fred. Bill installs a single SCSI drive as SCSI unit zero, and
	installs FreeBSD on it.</para>

      <para>Fred begins using the system, but after several days notices that
	the older SCSI drive is reporting numerous soft errors, and reports
	this fact to Bill.</para>

      <para>After several more days, Bill decides it's time to address the
	situation, so he grabs an identical SCSI drive from the disk drive
	"archive" in the back room.  An initial surface scan indicates that
	this drive is functioning well, so Bill installs this drive as SCSI
	unit four, and makes an image copy from drive zero to drive four.  Now
	that the new drive is installed and functioning nicely, Bill decides
	that it's a good idea to start using it, so he uses features in the
	SCSI BIOS to re-order the disk drives so that the system boots from
	SCSI unit four.  FreeBSD boots and runs just fine.</para>

      <para>Fred continues his work for several days, and soon Bill and Fred
	decide that it's time for a new adventure -- time to upgrade to a
	newer version of FreeBSD.  Bill removes SCSI unit zero because it was
	a bit flaky, and replaces it with another identical disk drive from
	the "archive."  Bill then installs the new version of FreeBSD onto the
	new SCSI unit zero using Fred's magic internet FTP floppies.  The
	installation goes well.</para>

      <para>Fred uses the new version of FreeBSD for a few days, and certifies
	that it is good enough for use in the engineering department...it's
	time to copy all of his work from the old version.  So Fred mounts
	SCSI unit four (the latest copy of the older FreeBSD version).  Fred
	is dismayed to find that none of his precious work is present on SCSI
	unit four.</para>

      <para>Where did the data go?</para>

      <para>When Bill made an image copy of the original SCSI unit zero onto
	SCSI unit four, unit four became the "new clone,"  When Bill
	re-ordered the SCSI BIOS so that he could boot from SCSI unit four, he
	was only fooling himself. FreeBSD was still running on SCSI unit zero.
	Making this kind of BIOS change will cause some or all of the Boot and
	Loader code to be fetched from the selected BIOS drive, but when the
	FreeBSD kernel drivers take-over, the BIOS drive numbering will be
	ignored, and FreeBSD will transition back to normal drive numbering.
	In the illustration at hand, the system continued to operate on the
	original SCSI unit zero, and all of Fred's data was there, not on SCSI
	unit four.  The fact that the system appeared to be running on SCSI
	unit four was simply an artifact of human expectations.</para>

      <para>We are delighted to mention that no data bytes were killed or
	harmed in any way by our discovery of this phenomenon.  The older SCSI
	unit zero was retrieved from the bone pile, and all of Fred's work was
	returned to him, (and now Bill knows that he can count as high as
	zero).</para>

      <para>Although SCSI drives were used in this illustration, the concepts
	apply equally to IDE drives.</para>
    </sidebar>
  </sect1>
 
    <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>$B%U%!%$%k%7%9%F%`$N%^%&%s%H$H%^%&%s%H2r=|(B</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>fstab $B%U%!%$%k(B</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>mount $B%3%^%s%I(B</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>$B%^%&%s%H%*%W%7%g%s(B</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>umount $B%3%^%s%I(B</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>
