diff --git a/en_US.ISO8859-1/books/handbook/geom/chapter.sgml b/en_US.ISO8859-1/books/handbook/geom/chapter.sgml index 387091b90a..9e20373dc3 100644 --- a/en_US.ISO8859-1/books/handbook/geom/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/geom/chapter.sgml @@ -1,419 +1,419 @@ Tom Rhodes Written by GEOM: Modular Disk Transformation Framework Synopsis GEOM GEOM Disk Framework GEOM - This chapter covers the use of disks under the new GEOM + This chapter covers the use of disks under the GEOM framework in &os;. This includes the major RAID 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 RAID configurations. Only GEOM supported RAID classifications will be discussed. After reading this chapter, you will know: What type of RAID support is available through GEOM. How to use the base base utilities to configure, maintain and manipulate the various RAID levels. How to mirror, stripe, encrypt, and remotely connect disk devices through GEOM. How to troubleshoot disks attached to the GEOM framework. Before reading this chapter, you should: Understand how &os; treats disk devices (). Know how to configure and install a new &os; kernel (). GEOM Introduction GEOM permits access and control to classes — Master Boot Records, BSD labels, etc — through the use of providers, or the special files in /dev. Supporting various software RAID configurations, GEOM will transparently provide access to the operating system and operating system utilities. Tom Rhodes Written by Murray Stokely RAID0 - Striping GEOM Stripping 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. The GEOM disk subsystem provides software support for RAID0, also known as disk striping. In a RAID0 system, data are split up in blocks that get written across all the drives in the array. Instead of having to wait on the system to write 256k to one disk, a RAID0 system can simultaneously write 64k to each of four different disks, offering superior I/O performance. This performance can be enhanced further by using multiple disk controllers. Each disk in a RAID0 stripe must be of the same size, since I/O requests are interleaved to read or write to multiple disks in parallel. Disk Striping Illustration Creating a stripe of unformatted ATA disks Load the geom_stripe module: &prompt.root; kldload geom_stripe.ko Ensure that a suitable mount point exists. If this volume will become a root partition, then temporarily use another mount point such as /mnt. &prompt.root; mkdir /mnt Determine the device names for the disks which will be striped, and create the new stripe device. For example, the following command could be used to stripe two unused, unpartitioned ATA disks: /dev/ad2 and /dev/ad3. &prompt.root; gstripe label -v st0 /dev/ad2 /dev/ad3 If this volume will be used as a root device for booting the system, then the following command must be issued before the file system is created: &prompt.root; fdisk -vBI /dev/stripe/st0 A partition table must be created on the new volume with the following command: &prompt.root; bsdlabel -wB /dev/stripe/st0 This process should have created two other devices in the /dev/stripe directory in addition to the st0 device. Those include st0a and st0c. A file system must now be created on the st0a device using the following newfs command: &prompt.root; newfs -U /dev/stripe/st0a 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 mounted: The following command can be used to manually mount a newly created disk stripe: &prompt.root; mount /dev/stripe/st0a /mnt To mount this striped filesystem automatically during the boot process, place the volume information in /etc/fstab file: &prompt.root; echo "/dev/stripe/st0a /mnt ufs rw 2 2" \ >> /etc/fstab The geom module must also be automatically loaded during system initialization, by adding a line to /boot/loader.conf: &prompt.root; echo 'geom_stripe_load="YES"' >> /boot/loader.conf RAID1 - Mirroring GEOM Disk Mirroring 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 is that 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. To begin, ensure the system has two disk drives of equal size, this exercise assumes they are direct access (&man.da.4;) SCSI disks. Begin by installing &os; on the first disk with only two partitions. One should be a swap partition, double the RAM size and all remaining space devoted to the root (/ 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. Reboot and wait for the system to fully initialize. Once this process has completed, log in as the root user. Create the /dev/mirror/gm device and link it with /dev/da1: &prompt.root; gmirror label -vnb round-robin gm0 /dev/da1 This command should have created the gm0, gm0s1, gm0s1a, and gm0s1c device nodes under the /dev/mirror directory. Initialize GEOM, this will load the /boot/kernel/geom_mirror.ko kernel module: &prompt.root; geom load Install generic fdisk label and boot code to newly created gm0 device: &prompt.root; fdisk -vBI /dev/mirror/gm0 Now install generic bsdlabel information: &prompt.root; bsdlabel -wB /dev/mirror/gm0s1 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. Use the &man.newfs.8; utility to create a default file system on the gm0s1a device node: &prompt.root; newfs -U /dev/mirror/gm0s1a 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 /mnt mount point: &prompt.root mount /dev/mirror/gm0s1a /mnt 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 guaranteed. &prompt.root; dump -L -0 -f- / |(cd /mnt && restore -r -v -f-) This must be done for each file system. Simply place the appropriate file system in correct location when running the aforementioned command. Now edit the replicated /mnt/etc/fstab file and remove or comment out the swap file. Change the other file system information to use the new disk. See the following example: # Device Mountpoint FStype Options Dump Pass# #/dev/da0s2b none swap sw 0 0 /dev/mirror/gm0sa1 / ufs rw 1 1 Now create a boot.conf file on both the current and new root partitions. This file will help the system BIOS boot the correct drive: &prompt.root; echo "1:da(1,a)/boot/loader" > /boot.config &prompt.root; echo "1:da(1,a)/boot/loader" > /mnt/boot.config 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. Now add the following line to /boot/loader.conf: &prompt.root; echo 'geom_mirror_load="YES"' >> /boot/loader.conf This will instruct &man.loader.8; utility to load the geom_mirror.ko during system initialization. Reboot the system: &prompt.root; shutdown -r now If all has gone well, the system should have booted from the gm0s1a device and a login prompt should be waiting. If something went wrong, see review the forthcoming troubleshooting section. Now add the da0 disk to gm0 device: &prompt.root; gmirror configure -a gm0 &prompt.root; gmirror insert gm0 /dev/da0 The 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 data in place of gm0. Troubleshooting System refuses to boot If the system boots up to a prompt similar to: ffs_mountroot: can't find rootvp Root mount failed: 6 mountroot> 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: OK? load geom_mirror.ko OK? boot If this works then for whatever reason the module was not being loaded properly. Place: options GEOM_MIRROR In the kernel configuration file, rebuild and reinstall. That should remedy this issue.