diff --git a/en_US.ISO8859-1/books/handbook/geom/chapter.sgml b/en_US.ISO8859-1/books/handbook/geom/chapter.sgml index f10043c341..f24f095194 100644 --- a/en_US.ISO8859-1/books/handbook/geom/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/geom/chapter.sgml @@ -1,376 +1,376 @@ 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 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. 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 supporting all variants of disks, SCSI, SATA, and ATA. The GEOM disk subsystem provides software support for RAID1, also known as disk striping. 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 / partition and the system will boot from it. Both will be described herein. To stripe several ATA disks, of the same size of course, load the geom_stripe module: &prompt.root; kldload geom_stripe.ko The module should now be loaded and visible from the output of kldstat. Now to combine the disks. Ensure that a mount point exists, if this volume will become a root partition then temporarily use /mnt. Otherwise, for the purpose of our examples, this volume will reside at the /home mount point. This process may be complicated if users already exist on the system. If so, assume the volume will reside on /data. Begin by selecting the disks which will be striped. Our scenario has two unused, unpartitioned ATA disks: /dev/ad2 and /dev/ad3. The module has been loaded and our disks selected, we will now create the stripe device: &prompt.root; gstripe label -v st0 /dev/ad2 /dev/ad3 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: &prompt.root; fdisk -vBI /dev/stripe/st0 Create a partition table on the new volume: &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. Next a file system must be created on the device using newfs: &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 hung from its mount point: &prompt.root; mount /dev/stripe/st0a /home Place the volume information in /etc/fstab file: &prompt.root; echo "/dev/stripe/st0a /home ufs rw 2 2" \ >> /etc/fstab And load the module during system initialization: &prompt.root; echo 'geom_stripe_load="YES"' >> /boot/loader.conf From here on, all users will have their data stored on the striped volume comprised of the disks concatenated in the beginning. 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 isthat information on one disk or partition is + 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 exorcise 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 guarenteed. + 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.