From d7a17bf2f2e9d965b9122f46ad106e5a688ce694 Mon Sep 17 00:00:00 2001
From: Chern Lee <chern@FreeBSD.org>
Date: Wed, 12 Sep 2001 23:55:00 +0000
Subject: [PATCH] Moved Disk Naming and BIOS Drive Numbering sections from
 Storage chapter into Install chapter as "Installation Destination"

Suggested by: murray and nik
---
 .../books/handbook/install/chapter.sgml       | 236 +++++++++++++++++-
 1 file changed, 235 insertions(+), 1 deletion(-)

diff --git a/en_US.ISO8859-1/books/handbook/install/chapter.sgml b/en_US.ISO8859-1/books/handbook/install/chapter.sgml
index 0e7b098693..58eb4f0503 100644
--- a/en_US.ISO8859-1/books/handbook/install/chapter.sgml
+++ b/en_US.ISO8859-1/books/handbook/install/chapter.sgml
@@ -1,7 +1,7 @@
 <!--
      The FreeBSD Documentation Project
 
-     $FreeBSD: doc/en_US.ISO8859-1/books/handbook/install/chapter.sgml,v 1.113 2001/09/11 01:11:01 murray Exp $
+     $FreeBSD: doc/en_US.ISO8859-1/books/handbook/install/chapter.sgml,v 1.114 2001/09/11 18:48:03 chern Exp $
 -->
 
 <chapter id="install">
@@ -1212,6 +1212,240 @@ Mounting root from ufs:/dev/md0c
     </sect2>
   </sect1>
 
+  <sect1 id="install-drive">
+    <title>Installation Destination</title>
+
+    <sect2 id="disks-naming">
+      <title>Disk Naming</title>
+
+      <indexterm><primary>IDE</primary></indexterm>
+      <indexterm><primary>SCSI</primary></indexterm>
+      <indexterm><primary>RAID</primary></indexterm>
+      <indexterm><primary>flash memory</primary></indexterm>
+      <para>Physical drives come in two main flavors,
+	<acronym>IDE</acronym>, or <acronym>SCSI</acronym>; but there
+	are also drives backed by RAID controllers, flash memory, and so
+	forth.  Since these behave quite differently, they have their
+	own drivers and devices.</para>
+
+      <table id="disk-naming-physical-table">
+	<title>Physical Disk Naming Conventions</title>
+
+	<tgroup cols="2">
+	  <thead>
+	    <row>
+	      <entry>Drive type</entry>
+	      <entry>Drive device name</entry>
+	    </row>
+	  </thead>
+	  <tbody>
+	    <row>
+	      <entry>IDE hard drives</entry>
+	      <entry><literal>ad</literal> in 4.0-RELEASE,
+		<literal>wd</literal> before 4.0-RELEASE.</entry>
+	    </row>
+	    <row>
+	      <entry>IDE CDROM drives</entry>
+	      <entry><literal>acd</literal> from 4.0-RELEASE,
+	      <literal>wcd</literal> before 4.0-RELEASE.</entry>
+	    </row>
+	    <row>
+	      <entry>SCSI hard drives and USB Mass storage devices</entry>
+	      <entry><literal>da</literal> from 3.0-RELEASE,
+		<literal>sd</literal> before 3.0-RELEASE.</entry>
+	    </row>
+	    <row>
+	      <entry>SCSI CDROM drives</entry>
+	      <entry><literal>cd</literal></entry>
+	    </row>
+	    <row>
+	      <entry>Assorted non-standard CDROM drives</entry>
+	      <entry><literal>mcd</literal> for Mitsumi CD-ROM,
+		<literal>scd</literal> for Sony CD-ROM,
+		<literal>matcd</literal> for Matsushita/Panasonic CD-ROM
+	      </entry>
+	    </row>
+	    <row>
+	      <entry>Floppy drives</entry>
+	      <entry><literal>fd</literal></entry>
+	    </row>
+	    <row>
+	      <entry>SCSI tape drives</entry>
+	      <entry><literal>sa</literal> from 3.0-RELEASE,
+		<literal>st</literal> before 3.0-RELEASE.</entry>
+	    </row>
+	    <row>
+	      <entry>IDE tape drives</entry>
+	      <entry><literal>ast</literal> from 4.0-RELEASE,
+		<literal>wst</literal> before 4.0-RELEASE.</entry>
+	    </row>
+	    <row>
+	      <entry>Flash drives</entry>
+	      <entry><literal>fla</literal> for DiskOnChip Flash device
+		from 3.3-RELEASE.</entry>
+	    </row>
+	    <row>
+	      <entry>RAID drives</entry>
+	      <entry><literal>myxd</literal> for Mylex, and
+		<literal>amrd</literal> for AMI MegaRAID,
+		<literal>idad</literal> for Compaq Smart RAID.
+		from 4.0-RELEASE.  <literal>id</literal> between
+		3.2-RELEASE and 4.0-RELEASE.</entry>
+	    </row>
+	  </tbody>
+	</tgroup>
+      </table>
+
+      <para>All the drives attached through a specific driver are
+	numbered starting at 0. So the first IDE drive would be
+	<quote>ad<emphasis>0</emphasis></quote>. You seldom need to use
+	these devices.</para>
+
+      <sect3 id="slicesandpartitions">
+	<title>Slices and Partitions</title>
+	<indexterm><primary>slices</primary></indexterm>
+	<indexterm><primary>partitions</primary></indexterm>
+	<indexterm><primary>dangerously dedicated</primary></indexterm>
+	<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>,
+	  starting at 1. So <quote>da0<emphasis>s1</emphasis></quote>
+	  is the first slice on the first SCSI drive. There can only be
+	  four physical slices on a disk, but you can have logical
+	  slices inside physical slices of the appropriate type. These
+	  extended slices are numbered starting at 5, so
+	  <quote>ad0<emphasis>s5</emphasis></quote> is the first
+	  extended slice on a disk. These devices are used by file
+	  systems that expect to occupy a slice.</para> 
+	
+	<para>Slices, <quote>dangerously dedicated</quote> physical
+	  drives, and other drives contain
+	  <firstterm>partitions</firstterm>, which are represented as
+	  letters from <literal>a</literal> to <literal>h</literal>.
+	  This letter is appended to the device name, so
+	  <quote>da0<emphasis>a</emphasis></quote> is the a partition on
+	  the first da drive, which is <quote>dangerously dedicated</quote>.
+	  <quote>ad1s3<emphasis>e</emphasis></quote> is the fifth partition
+	  in the third slice of the second IDE disk drive.</para>
+	
+	<para>The boot code expects partition <literal>a</literal> to be
+	  the root partition. Partition <literal>b</literal> is normally
+	  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>
+      </sect3>
+    </sect2>
+
+    <sect2 id="install-drive-bios-numbering">
+      <title>BIOS Drive Numbering</title>
+
+      <para>Before you install and configure FreeBSD on your system, there is an
+	important subject that you should be aware of, especially if you have
+	multiple hard drives.</para>
+
+      <indexterm><primary>DOS</primary></indexterm>
+      <indexterm><primary>Microsoft Windows</primary></indexterm>
+      <para>In a PC running a BIOS-dependent operating system such as
+	MS-DOS or Microsoft Windows, 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 
+	<application>Ghost</application> or <application>XCOPY</application>
+	.  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 is like switching the cables on the
+	drives, but without having to open the case.</para>
+
+      <indexterm><primary>SCSI</primary></indexterm>
+      <indexterm><primary>BIOS</primary></indexterm>
+      <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 is time to address the
+	  situation, so he grabs an identical SCSI drive from the disk drive
+	  <quote>archive</quote> 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 is 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 is 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 <quote>archive.</quote>  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 is
+	  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 <quote>new clone,</quote>
+	  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>
+    </sect2>
+  </sect1>
+
   <sect1 id="install-steps">
     <title>Allocating Disk Space</title>