aboutsummaryrefslogtreecommitdiff
path: root/en_US.ISO8859-1/books/handbook/geom
diff options
context:
space:
mode:
authorTom Rhodes <trhodes@FreeBSD.org>2005-08-06 03:22:18 +0000
committerTom Rhodes <trhodes@FreeBSD.org>2005-08-06 03:22:18 +0000
commit9e1457cbcbc267eebf315e80840a257f4be2adaf (patch)
treeb5ffe6be71571ef532c31f5483e8e7aa00cc083f /en_US.ISO8859-1/books/handbook/geom
parent982ab48b5c680e33a32bc167af6847d853250905 (diff)
downloaddoc-9e1457cbcbc267eebf315e80840a257f4be2adaf.tar.gz
doc-9e1457cbcbc267eebf315e80840a257f4be2adaf.zip
Bring in two new chapters:
Audit - not hooked up to the build, but provided for when the audit framework becomes available in the base system. GEOM - Incomplete, only covers striping and mirroring since that is all I have tested. Incomplete is better than nothing in my opinion. This one is hooked up to the build.
Notes
Notes: svn path=/head/; revision=25313
Diffstat (limited to 'en_US.ISO8859-1/books/handbook/geom')
-rw-r--r--en_US.ISO8859-1/books/handbook/geom/Makefile15
-rw-r--r--en_US.ISO8859-1/books/handbook/geom/chapter.sgml376
2 files changed, 391 insertions, 0 deletions
diff --git a/en_US.ISO8859-1/books/handbook/geom/Makefile b/en_US.ISO8859-1/books/handbook/geom/Makefile
new file mode 100644
index 0000000000..59e5759cdc
--- /dev/null
+++ b/en_US.ISO8859-1/books/handbook/geom/Makefile
@@ -0,0 +1,15 @@
+#
+# Build the Handbook with just the content from this chapter.
+#
+# $FreeBSD$
+#
+
+CHAPTERS= geom/chapter.sgml
+
+VPATH= ..
+
+MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
+
+DOC_PREFIX?= ${.CURDIR}/../../../..
+
+.include "../Makefile"
diff --git a/en_US.ISO8859-1/books/handbook/geom/chapter.sgml b/en_US.ISO8859-1/books/handbook/geom/chapter.sgml
new file mode 100644
index 0000000000..202a2ff7e9
--- /dev/null
+++ b/en_US.ISO8859-1/books/handbook/geom/chapter.sgml
@@ -0,0 +1,376 @@
+<!--
+ The FreeBSD Documentation Project
+ $FreeBSD$
+
+-->
+
+<chapter id="GEOM">
+ <chapterinfo>
+ <authorgroup>
+ <author>
+ <firstname>Tom</firstname>
+ <surname>Rhodes</surname>
+ <contrib>Written by </contrib>
+ </author>
+ </authorgroup>
+ </chapterinfo>
+
+ <title>GEOM: Modular Disk Transformation Framework</title>
+
+ <sect1 id="GEOM-synopsis">
+ <title>Synopsis</title>
+
+ <indexterm>
+ <primary>GEOM</primary>
+ </indexterm>
+ <indexterm>
+ <primary>GEOM Disk Framework</primary>
+ <see>GEOM</see>
+ </indexterm>
+
+ <para>This chapter covers the use of disks under the new GEOM
+ framework in &os;. This includes the major
+ <acronym>RAID</acronym> control utilities which use the
+ framework for configuration. This chapter will not go
+ into in depth discussion on how GEOM handles or controls
+ I/O, the underlying subsystem, or code. This information
+ is provided through the &man.geom.4; manual page and its various
+ SEE ALSO references. This chapter is also not a definitive guide
+ to <acronym>RAID</acronym> configurations. Only GEOM
+ supported <acronym>RAID</acronym> classifications will be
+ discussed.</para>
+
+ <para>After reading this chapter, you will know:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>What type of <acronym>RAID</acronym> support is available
+ through GEOM.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to use the base base utilities to configure, maintain
+ and manipulate the various <acronym>RAID</acronym>
+ levels.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to mirror, stripe, encrypt, and remotely connect disk
+ devices through GEOM.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to troubleshoot disks attached to the GEOM
+ framework.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Before reading this chapter, you should:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Understand how &os; treats disk devices
+ (<xref linkend="disks">).</para>
+ <listitem>
+ <para>Know how to configure and install a new &os; kernel
+ (<xref linkend="kernelconfig">).</para>
+ </listitem>
+ </itemizedlist>
+ </sect1>
+
+ <sect1 id="GEOM-intro">
+ <title>GEOM Introduction</title>
+
+ <para>GEOM permits access and control to classes &mdash; Master Boot
+ Records, <acronym>BSD</acronym> labels, etc &mdash; through the
+ use of providers, or the special files in
+ <filename role="directory">/dev</filename>. Supporting various
+ software <acronym>RAID</acronym> configurations, GEOM will
+ transparently provide access to the operating system and
+ operating system utilities.</para>
+ </sect1>
+
+ <sect1 id="GEOM-striping">
+ <title>RAID0 - Striping</title>
+
+ <indexterm>
+ <primary>GEOM</primary>
+ </indexterm>
+ <indexterm>
+ <primary>Stripping</primary>
+ </indexterm>
+
+ <para>Striping is a method used to combine several disk drives into
+ a single volume. In many cases, this is done through the use of
+ hardware controllers supporting all variants of disks,
+ <acronym>SCSI</acronym>, <acronym>SATA</acronym>,
+ and <acronym>ATA</acronym>. The GEOM disk subsystem provides
+ software support for <acronym>RAID</acronym>1, also known as
+ disk striping.</para>
+
+ <para>Some cases have this volume, comprised of several disks, as a
+ separate file system for backups, data storage for users;
+ however, in other cases still, this volume may hold the root, or
+ <filename role="directory">/</filename> partition and the system
+ will boot from it. Both will be described herein.</para>
+
+ <para>To stripe several <acronym>ATA</acronym> disks, of the same
+ size of course, load the <filename>geom_stripe</filename>
+ module:</para>
+
+ <screen>&prompt.root; <userinput>kldload geom_stripe.ko</userinput></screen>
+
+ <para>The module should now be loaded and visible from the output of
+ <command>kldstat</command>. Now to combine the disks. Ensure
+ that a mount point exists, if this volume will become a root
+ partition then temporarily use
+ <filename role="directory">/mnt</filename>. Otherwise, for the
+ purpose of our examples, this volume will reside at the
+ <filename role="directory">/home</filename> mount point. This
+ process may be complicated if users already exist on the system.
+ If so, assume the volume will reside on
+ <filename role="directory">/data</filename>.</para>
+
+ <para>Begin by selecting the disks which will be striped. Our
+ scenario has two unused, unpartitioned <acronym>ATA</acronym>
+ disks: <filename>/dev/ad2</filename> and
+ <filename>/dev/ad3</filename>. The module has been loaded and
+ our disks selected, we will now create the stripe device:</para>
+
+ <screen>&prompt.root; <userinput>gstripe label -v st0 /dev/ad2 /dev/ad3</userinput></screen>
+
+ <para>A message should be returned explaining that meta data has
+ been stored on the devices. The file system must now be created
+ on the device. If this volume is to be used for system
+ initialization, the following command must be issued before the
+ file system is created:</para>
+
+ <screen>&prompt.root; <userinput>fdisk -vBI /dev/stripe/st0</userinput></screen>
+
+ <para>Create a partition table on the new volume:</para>
+
+ <screen>&prompt.root; <userinput>bsdlabel -wB /dev/stripe/st0</userinput></screen>
+
+ <para>This process should have created two other devices in the
+ <filename role="directory">/dev/stripe</filename> directory in
+ addition to the <filename>st0</filename> device. Those include
+ <filename>st0a</filename> and <filename>st0c</filename>. Next a
+ file system must be created on the device using
+ <command>newfs</command>:</para>
+
+ <screen>&prompt.root; <userinput>newfs -U /dev/stripe/st0a</userinput></screen>
+
+ <para>Many numbers will glide across the screen, and after a few
+ seconds, the process will be complete. The volume has been
+ created and is ready to be hung from its <command>mount</command>
+ point:</para>
+
+ <screen>&prompt.root; <userinput>mount /dev/stripe/st0a /home</userinput></screen>
+
+ <para>Place the volume information in
+ <filename>/etc/fstab</filename> file:</para>
+
+ <screen>&prompt.root; <userinput>echo "/dev/stripe/st0a /home ufs rw 2 2" \</userinput>
+ <userinput>&gt;&gt; /etc/fstab</userinput></screen>
+
+ <para>And load the module during system initialization:</para>
+
+ <screen>&prompt.root; <userinput>echo 'geom_stripe_load="YES" &gt;&gt; /boot/loader.conf</userinput></screen>
+
+ <para>From here on, all users will have their data stored on the
+ striped volume comprised of the disks concatenated in the
+ beginning.</para>
+ </sect1>
+
+ <sect1 id="GEOM-mirror">
+ <title>RAID1 - Mirroring</title>
+
+ <indexterm>
+ <primary>GEOM</primary>
+ </indexterm>
+ <indexterm>
+ <primary>Disk Mirroring</primary>
+ </indexterm>
+
+ <para>Mirroring is a technology used by many corporations and home
+ users to back up data without interruption. When a mirror exists,
+ it simply means that diskB replicates diskA. Or, perhaps diskC+D
+ replicates diskA+B. Regardless of the disk configuration, the
+ important aspect isthat information on one disk or partition is
+ being replicated. Later, that information could be more easily
+ restored, backed up without causing service or access
+ interruption, and even be physically stored in a data
+ safe.</para>
+
+ <para>To begin, ensure the system has two disk drives of equal size,
+ this exorcise assumes they are direct access (&man.da.4;)
+ <acronym>SCSI</acronym> disks.</para>
+
+ <para>Begin by installing &os; on the first disk with only two
+ partitions. One should be a swap partition, double the
+ <acronym>RAM</acronym> size and all remaining space devoted to
+ the root (<filename role="directory">/</filename> file system.
+ It is possible to have separate partitions for other mount points;
+ however, this will increase the difficulty level ten fold due to
+ manual alteration of the &man.bsdlabel.8; and &man.fdisk.8;
+ settings.</para>
+
+ <para>Reboot and wait for the system to fully initialize. Once this
+ process has completed, log in as the <username>root</username>
+ user.</para>
+
+ <para>Create the <filename>/dev/mirror/gm</filename> device and link
+ it with <filename>/dev/da1</filename>:</para>
+
+ <screen>&prompt.root; <userinput>gmirror label -vnb round-robin gm0 /dev/da1</userinput></screen>
+
+ <note>
+ <para>This command should have created the
+ <filename>gm0</filename>, <filename>gm0s1</filename>,
+ <filename>gm0s1a</filename>, and <filename>gm0s1c</filename>
+ device nodes under the
+ <filename role="directory">/dev/mirror</filename>
+ directory.</para>
+ </note>
+
+ <para>Initialize GEOM, this will load the
+ <filename>/boot/kernel/geom_mirror.ko</filename> kernel
+ module:</para>
+
+ <screen>&prompt.root; <userinput>geom load</userinput></screen>
+
+ <para>Install generic <command>fdisk</command> label and boot code
+ to newly created <filename>gm0</filename> device:</para>
+
+ <screen>&prompt.root; <userinput>fdisk -vBI /dev/mirror/gm0</userinput></screen>
+
+ <para>Now install generic <command>bsdlabel</command>
+ information:</para>
+
+ <screen>&prompt.root; <userinput>bsdlabel -wB /dev/mirror/gm0s1</userinput></screen>
+
+ <note>
+ <para>If multiple slices and partitions exist, the flags for the
+ previous two commands will require alteration. They must match
+ the slice and partition size of the other disk.</para>
+ </note>
+
+ <para>Use the &man.newfs.8; utility to create a default file
+ system on the <filename>gm0s1a</filename> device node:</para>
+
+ <screen>&prompt.root; <userinput>newfs -U /dev/mirror/gm0s1a</userinput></screen>
+
+ <para>This should have caused for the system to spit out some
+ information and a bunch of numbers. This is good, examine the
+ screen for any error messages and mount the device to the
+ <filename role="directory">/mnt</filename> mount point:</para>
+
+ <screen>&prompt.root <userinput>mount /dev/mirror/gm0s1a /mnt</userinput></screen>
+
+ <para>Now move all data from the boot disk over to this new file
+ system. This example uses the &man.dump.8; and &man.restore.8;
+ commands; however, &man.dd.1; would also work with this scenario.
+ We skip using &man.tar.1; because it will not copy over the boot
+ code. Thus, failure would be guarenteed.</para>
+
+ <screen>&prompt.root; <userinput>dump -L -0 -f- / |(cd /mnt && restore -r -v -f-)</userinput></screen>
+
+ <para>This must be done for each file system. Simply place the
+ appropriate file system in correct location when running the
+ aforementioned command.</para>
+
+ <para>Now edit the replicated <filename>/mnt/etc/fstab</filename>
+ file and remove or comment out the swap file. Change the other
+ file system information to use the new disk. See the following
+ example:</para>
+
+ <programlisting># Device Mountpoint FStype Options Dump Pass#
+#/dev/da0s2b none swap sw 0 0
+/dev/mirror/gm0sa1 / ufs rw 1 1</programlisting>
+
+ <para>Now create a <filename>boot.conf</filename> file on both the
+ current and new root partitions. This file will
+ <quote>help</quote> the system <acronym>BIOS</acronym>
+ boot the correct drive:</para>
+
+ <screen>&prompt.root; <userinput>echo "1:da(1,a)/boot/loader" &gt; /boot.config</userinput></screen>
+
+ <screen>&prompt.root; <userinput>echo "1:da(1,a)/boot/loader" &gt; /mnt/boot.config</userinput></screen>
+
+ <note>
+ <para>We have placed it on both root partitions to ensure proper
+ boot up. If for some reason the system cannot read from the
+ new root partition, a failsafe is available.</para>
+ </note>
+
+ <para>Now add the following line to
+ <filename>/boot/loader.conf:</filename></para>
+
+ <screen>&prompt.root; <userinput>echo 'geom_mirror_load="YES"' &gt;&gt; /boot/loader.conf</userinput></screen>
+
+ <para>This will instruct &man.loader.8; utility to load the
+ <filename>geom_mirror.ko</filename> during system
+ initialization.</para>
+
+ <para>Reboot the system:</para>
+
+ <screen>&prompt.root; <userinput>shutdown -r now</userinput></screen>
+
+ <para>If all has gone well, the system should have booted from the
+ <filename>gm0s1a</filename> device and a <command>login</command>
+ prompt should be waiting. If something went wrong, see review
+ the forthcoming troubleshooting section. Now add the
+ <filename>da0</filename> disk to <filename>gm0</filename>
+ device:</para>
+
+ <screen>&prompt.root; <userinput>gmirror configure -a gm0</userinput>
+ <userinput>gmirror insert gm0 /dev/da0</userinput></screen>
+
+ <para>The <option>-a</option> flag tells &man.gmirror.8; to use
+ automatic synchronization, i.e.: mirror the disk writes
+ automatically. The manual page explains how to rebuild and
+ replace disks, although it uses <filename>data</filename>
+ in place of <filename>gm0</filename>.</para>
+
+ <sect2>
+ <title>Troubleshooting</title>
+
+ <sect3>
+ <title>System refuses to boot</title>
+
+ <para>If the system boots up to a prompt similar to:</para>
+
+ <programlisting>ffs_mountroot: can't find rootvp
+Root mount failed: 6
+mountroot></programlisting>
+
+ <para>Reboot the machine using the power or reset button. At
+ the boot menu, select option six (6). This will drop the
+ system to a &man.loader.8; prompt. Load the kernel module
+ manually:</para>
+
+ <screen>OK? <userinput>load geom_mirror.ko</userinput>
+ OK? <userinput>boot</userinput></screen>
+
+ <para>If this works then for whatever reason the module was not
+ being loaded properly. Place:</para>
+
+ <programlisting>options GEOM_MIRROR</programlisting>
+
+ <para>In the kernel configuration file, rebuild and reinstall.
+ That should remedy this issue.</para>
+ </sect3>
+ </sect2>
+ </sect1>
+</chapter>
+
+<!--
+ Local Variables:
+ mode: sgml
+ sgml-declaration: "../chapter.decl"
+ sgml-indent-data: t
+ sgml-omittag: nil
+ sgml-always-quote-attributes: t
+ sgml-parent-document: ("../book.sgml" "part" "chapter")
+ End:
+-->