From owner-svn-doc-head@FreeBSD.ORG Fri Nov 2 04:19:20 2012 Return-Path: Delivered-To: svn-doc-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA59F985; Fri, 2 Nov 2012 04:19:20 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BECFF8FC08; Fri, 2 Nov 2012 04:19:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id qA24JKEe041636; Fri, 2 Nov 2012 04:19:20 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id qA24JKPR041634; Fri, 2 Nov 2012 04:19:20 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201211020419.qA24JKPR041634@svn.freebsd.org> From: Warren Block Date: Fri, 2 Nov 2012 04:19:20 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r39909 - head/en_US.ISO8859-1/books/handbook/geom X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the doc tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2012 04:19:21 -0000 Author: wblock Date: Fri Nov 2 04:19:20 2012 New Revision: 39909 URL: http://svn.freebsd.org/changeset/doc/39909 Log: Rework the gmirror section to create mirrors properly. The second half of this new section was written by Hiroki Sato. Modified: head/en_US.ISO8859-1/books/handbook/geom/chapter.xml Modified: head/en_US.ISO8859-1/books/handbook/geom/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/handbook/geom/chapter.xml Fri Nov 2 04:13:41 2012 (r39908) +++ head/en_US.ISO8859-1/books/handbook/geom/chapter.xml Fri Nov 2 04:19:20 2012 (r39909) @@ -234,210 +234,598 @@ Done. Disk Mirroring + + RAID1 + - 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, these exercises assume they are direct access (&man.da.4;) - SCSI disks. + RAID1, or + mirroring, is the technique of writing + the same data to more than one disk drive. Mirrors are usually + used to guard against data loss due to drive failure. Each + drive in a mirror contains an identical copy of the data. When + an individual drive fails, the mirror continues to work, + providing data from the drives that are still functioning. The + computer keeps running, and the administrator has time to + replace the failed drive without user interruption. + + Two common situations are illustrated in these examples. + The first is creating a mirror out of two new drives and using + it as a replacement for an existing single drive. The second + example creates a mirror on a single new drive, copies the old + drive's data to it, then inserts the old drive into the + mirror. While this procedure is slightly more complicated, it + only requires one new drive. + + Traditionally, the two drives in a mirror are identical in + model and capacity, but &man.gmirror.8; does not require that. + Mirrors created with dissimilar drives will have a capacity + equal to that of the smallest drive in the mirror. Extra space + on larger drives will be unused. Drives inserted into the + mirror later must have at least as much capacity as the smallest + drive already in the mirror. + + + The mirroring procedures shown here are non-destructive, + but as with any major disk operation, make a full backup + first. + + + + Metadata Issues + + Many disk systems store metadata at the end of each disk. + Old metadata should be erased before reusing the disk for a + mirror. Most problems are caused by two particular types of + leftover metadata: GPT partition tables, and old + &man.gmirror.8; metadata from a previous mirror. + + GPT metadata can be erased with &man.gpart.8;. This + example erases both primary and backup GPT partition tables + from disk ada8: + + &prompt.root; gpart destroy -F ada8 + + &man.gmirror.8; can remove a disk from an active mirror + and erase the metadata in one step. Here, the example disk + ada8 is removed from the active + mirror gm4: + + &prompt.root; gmirror remove gm4 ada8 + + If the mirror is not running but old mirror metadata is + still on the disk, use gmirror clear to + remove it: + + &prompt.root; gmirror clear ada8 + + &man.gmirror.8; stores one block of metadata at the end of + the disk. Because GPT partition schemes also store metadata + at the end of the disk, mirroring full GPT disks with + &man.gmirror.8; is not recommended. MBR partitioning is used + here because it only stores a partition table at the start of + the disk and does not conflict with &man.gmirror.8;. + - Mirroring Primary Disks - - Assuming &os; has been installed on the first, - da0 disk device, &man.gmirror.8; - should be told to store its primary data there. - - Before building the mirror, enable additional debugging - information and opening access to the device by setting the - kern.geom.debugflags &man.sysctl.8; option - to the following value: - - &prompt.root; sysctl kern.geom.debugflags=17 - - Now create the mirror. Begin the process by storing - meta-data information on the primary disk device, - effectively creating the - /dev/mirror/gm device - using the following command: - - - Creating a mirror out of the boot drive may result in - data loss if any data has been stored on the last sector of - the disk. This risk is reduced if creating the mirror is - done promptly after a fresh install of &os;. The following - procedure is also incompatible with the default installation - settings of &os; 9.X which - use the new GPT partition scheme. GEOM - will overwrite GPT metadata, causing data - loss and possibly an unbootable system. - + Creating a Mirror with Two New Disks - &prompt.root; gmirror label -vb round-robin gm0 /dev/da0 + In this example, &os; has already been installed on a + single disk, ada0. Two new disks, + ada1 and + ada2, have been connected to the + system. A new mirror will be created on these two disks and + used to replace the old single disk. + + &man.gmirror.8; requires a kernel module, + geom_mirror.ko, either built into the + kernel or loaded at boot- or run-time. Manually load the + kernel module now: - The system should respond with: - - Metadata value stored on /dev/da0. -Done. + &prompt.root; gmirror load - Initialize GEOM, this will load the - /boot/kernel/geom_mirror.ko kernel - module: + Create the mirror with the two new drives. - &prompt.root; gmirror load + &prompt.root; gmirror label -v gm0 /dev/ada1 /dev/ada2 - - When this command completes successfully, it creates the - gm0 device node under the - /dev/mirror - directory. - + gm0 is a user-chosen device name + assigned to the new mirror. After the mirror has been + started, this device name will appear in the + /dev/mirror/ directory. + + MBR and bsdlabel partition tables can now be created on + the mirror with &man.gpart.8;. Here we show a traditional + split-filesystem layout, with partitions for + /, swap, /var, + /tmp, and /usr. A + single / filesystem and a swap partition + will also work. + + Partitions on the mirror do not have to be the same size + as those on the existing disk, but they must be large enough + to hold all the data already present on + ada0. + + &prompt.root; gpart create -s MBR mirror/gm0 +&prompt.root; gpart add -t -a 4kfreebsd mirror/gm0 +&prompt.root; gpart show mirror/gm0 +=> 63 156301423 mirror/gm0 MBR (74G) + 63 63 - free - (31k) + 126 156301299 1 freebsd (74G) + 156301425 61 - free - (30k) + + &prompt.root; gpart create -s BSD mirror/gm0s1 +&prompt.root; gpart add -t freebsd-ufs -a 4k -s 2g mirror/gm0s1 +&prompt.root; gpart add -t freebsd-swap -a 4k -s 4g mirror/gm0s1 +&prompt.root; gpart add -t freebsd-ufs -a 4k -s 2g mirror/gm0s1 +&prompt.root; gpart add -t freebsd-ufs -a 4k -s 1g mirror/gm0s1 +&prompt.root; gpart add -t freebsd-ufs -a 4k mirror/gm0s1 +&prompt.root; gpart show mirror/gm0s1 +=> 0 156301299 mirror/gm0s1 BSD (74G) + 0 2 - free - (1.0k) + 2 4194304 1 freebsd-ufs (2.0G) + 4194306 8388608 2 freebsd-swap (4.0G) + 12582914 4194304 4 freebsd-ufs (2.0G) + 16777218 2097152 5 freebsd-ufs (1.0G) + 18874370 137426928 6 freebsd-ufs (65G) + 156301298 1 - free - (512B) + + Make the mirror bootable by installing bootcode in the MBR + and bsdlabel and setting the active slice: + + &prompt.root; gpart bootcode -b /boot/mbr mirror/gm0 +&prompt.root; gpart set -a active -i 1 mirror/gm0 +&prompt.root; gpart bootcode -b /boot/boot mirror/gm0s1 + + Format the filesystems on the new mirror, enabling + soft-updates. + + &prompt.root; newfs -U /dev/mirror/gm0s1a +&prompt.root; newfs -U /dev/mirror/gm0s1d +&prompt.root; newfs -U /dev/mirror/gm0s1e +&prompt.root; newfs -U /dev/mirror/gm0s1f + + Filesystems from the original disk + (ada0) can now be copied onto the + mirror with &man.dump.8; and &man.restore.8;. + + &prompt.root; mount /dev/mirror/gm0s1a /mnt +&prompt.root; dump -C16 -b64 -0aL -f - / | (cd /mnt && restore -rf -) +&prompt.root; mount /dev/mirror/gm0s1d /mnt/var +&prompt.root; mount /dev/mirror/gm0s1e /mnt/tmp +&prompt.root; mount /dev/mirror/gm0s1f /mnt/usr +&prompt.root; dump -C16 -b64 -0aL -f - /var | (cd /mnt/var && restore -rf -) +&prompt.root; dump -C16 -b64 -0aL -f - /tmp | (cd /mnt/tmp && restore -rf -) +&prompt.root; dump -C16 -b64 -0aL -f - /usr | (cd /mnt/usr && restore -rf -) + + /mnt/etc/fstab must be edited to + point to the new mirror filesystems: + + # Device Mountpoint FStype Options Dump Pass# +/dev/mirror/gm0s1a / ufs rw 1 1 +/dev/mirror/gm0s1b none swap sw 0 0 +/dev/mirror/gm0s1d /var ufs rw 2 2 +/dev/mirror/gm0s1e /tmp ufs rw 2 2 +/dev/mirror/gm0s1f /usr ufs rw 2 2 + + If the &man.gmirror.8; kernel module has not been built + into the kernel, /mnt/boot/loader.conf is + edited to load the module at boot: + + geom_mirror_load="YES" + + Reboot the system to test the new mirror and verify that + all data has been copied. The BIOS will see the mirror as two + individual drives rather than a mirror. Because the drives + are identical, it does not matter which is selected to + boot. + + See the + Troubleshooting + section if there are problems booting. Powering down and + disconnecting the original ada0 disk + will allow it to be kept as an offline backup. - Enable loading of the geom_mirror.ko - kernel module during system initialization: + In use, the mirror will behave just like the original + single drive. + - &prompt.root; echo 'geom_mirror_load="YES"' >> /boot/loader.conf + + Creating a Mirror with an Existing Drive - Edit the /etc/fstab file, replacing - references to the old da0 with the - new device nodes of the gm0 mirror - device. + In this example, &os; has already been installed on a + single disk, ada0. A new disk, + ada1, has been connected to the + system. A one-disk mirror will be created on the new disk, + the existing system copied onto it, and then old disk will be + inserted into the mirror. This slightly complex procedure is + required because &man.gmirror.8; needs to put a 512-byte block + of metadata at the end of each disk, and the existing + ada0 has usually had all of its space + already allocated. - - If &man.vi.1; is your preferred editor, the following is - an easy way to accomplish this task: + Load the &man.gmirror.8; kernel module. - &prompt.root; vi /etc/fstab + &prompt.root; gmirror load - In &man.vi.1; back up the current contents of - fstab by typing - :w /etc/fstab.bak. Then - replace all old da0 references - with gm0 by typing - :%s/da/mirror\/gm/g. - + Check the media size of the original disk with + &man.diskinfo.8;. - The resulting fstab file should look - similar to the following. It does not matter if the disk - drives are SCSI or ATA, - the RAID device will be - gm regardless. - - # Device Mountpoint FStype Options Dump Pass# -/dev/mirror/gm0s1b none swap sw 0 0 -/dev/mirror/gm0s1a / ufs rw 1 1 -/dev/mirror/gm0s1d /usr ufs rw 0 0 -/dev/mirror/gm0s1f /home ufs rw 2 2 -#/dev/mirror/gm0s2d /store ufs rw 2 2 -/dev/mirror/gm0s1e /var ufs rw 2 2 -/dev/acd0 /cdrom cd9660 ro,noauto 0 0 - - Reboot the system: - - &prompt.root; shutdown -r now - - During system initialization, the - gm0 should be used in place of the - da0 device. Once fully initialized, - this may be checked by visually inspecting the output from - the mount command: - - &prompt.root; mount -Filesystem 1K-blocks Used Avail Capacity Mounted on -/dev/mirror/gm0s1a 1012974 224604 707334 24% / -devfs 1 1 0 100% /dev -/dev/mirror/gm0s1f 45970182 28596 42263972 0% /home -/dev/mirror/gm0s1d 6090094 1348356 4254532 24% /usr -/dev/mirror/gm0s1e 3045006 2241420 559986 80% /var -devfs 1 1 0 100% /var/named/dev - - The output looks good, as expected. Finally, to begin - synchronization, insert the da1 disk - into the mirror using the following command: - - &prompt.root; gmirror insert gm0 /dev/da1 - - As the mirror is built the status may be checked using - the following command: - - &prompt.root; gmirror status - - Once the mirror has been built and all current data - has been synchronized, the output from the above command - should look like: - - Name Status Components -mirror/gm0 COMPLETE da0 - da1 - - If there are any issues, or the mirror is still - completing the build process, the example will show - DEGRADED in place of - COMPLETE. + &prompt.root; diskinfo -v ada0 | head -n3 +/dev/ada0 + 512 # sectorsize + 1000204821504 # mediasize in bytes (931G) + + Create a mirror on the new disk. To make certain that the + mirror capacity is not any larger than the original drive, + &man.gnop.8; is used to create a fake drive of the exact same + size. This drive does not store any data, but is used only to + limit the size of the mirror. When &man.gmirror.8; creates + the mirror, it will restrict the capacity to the size of + gzero.nop even if the new drive + (ada1) has more space. Note that the + 1000204821504 in the second line + should be equal to ada0's media size + as shown by &man.diskinfo.8; above. + + &prompt.root; geom zero load +&prompt.root; gnop create -s 1000204821504 gzero +&prompt.root; gmirror label -v gm0 gzero.nop ada1 +&prompt.root; gmirror forget gm0 + + gzero.nop does not store any + data, so the mirror does not see it as connected. The mirror + is told to forget unconnected components, + removing references to gzero.nop. + The result is a mirror device containing only a single disk, + ada1. + + After creating gm0, view the + partition table on ada0. + + This output is from a 1 TB drive. If there is some + unallocated space at the end of the drive, the contents may be + copied directly from ada0 to the new + mirror. + + However, if the output shows that all of the space on the + disk is allocated like the following listing, there is no + space available for the 512-byte &man.gmirror.8; metadata at + the end of the disk. + + &prompt.root; gpart show ada0 +=> 63 1953525105 ada0 MBR (931G) + 63 1953525105 1 freebsd [active] (931G) + + In this case, the partition table must be edited to reduce + the capacity by one sector on + mirror/gm0. The procedure will + be explained later. + + In either case, partition tables on the primary disk + should be copied first. It can be done by using &man.gpart.8; + backup and restore + subcommands. + + &prompt.root; gpart backup ada0 > table.ada0 +&prompt.root; gpart backup ada0s1 > table.ada0s1 + + These commands create two files, + table.ada0 and + table.ada0s1. This example is from a + 1 TB drive: + + &prompt.root; cat table.ada0 +MBR 4 +1 freebsd 63 1953525105 [active] + + &prompt.root; cat table.ada0s1 +BSD 8 +1 freebsd-ufs 0 4194304 +2 freebsd-swap 4194304 33554432 +4 freebsd-ufs 37748736 50331648 +5 freebsd-ufs 88080384 41943040 +6 freebsd-ufs 130023424 838860800 +7 freebsd-ufs 968884224 984640881 + + If the whole disk was used in the output of &man.gpart.8; + show, the capacity in these partition + tables must be reduced by one sector. Edit the two files, + reducing the size of both the slice and last partition by one. + These are the last numbers in each listing. + + &prompt.root; cat table.ada0 +MBR 4 +1 freebsd 63 1953525104 [active] + + &prompt.root; cat table.ada0s1 +BSD 8 +1 freebsd-ufs 0 4194304 +2 freebsd-swap 4194304 33554432 +4 freebsd-ufs 37748736 50331648 +5 freebsd-ufs 88080384 41943040 +6 freebsd-ufs 130023424 838860800 +7 freebsd-ufs 968884224 984640880 + + If at least one sector was unallocated at the end of the + disk, these two files can be used without modification. + + Now restore the partition table into + mirror/gm0. + + &prompt.root; gpart restore mirror/gm0 < table.ada0 +&prompt.root; gpart restore mirror/gm0s1 < table.ada0s1 + + Check the partition table with the &man.gpart.8; + show. This example has + gm0s1a for /, + gm0s1d for /var, + gm0s1e for /usr, + gm0s1f for + /data1, and + gm0s1g for + /data2. + + &prompt.root; gpart show mirror/gm0 +=> 63 1953525104 mirror/gm0 MBR (931G) + 63 1953525042 1 freebsd [active] (931G) + 1953525105 62 - free - (31k) + +&prompt.root; gpart show mirror/gm0s1 +=> 0 1953525042 mirror/gm0s1 BSD (931G) + 0 2097152 1 freebsd-ufs (1.0G) + 2097152 16777216 2 freebsd-swap (8.0G) + 18874368 41943040 4 freebsd-ufs (20G) + 60817408 20971520 5 freebsd-ufs (10G) + 81788928 629145600 6 freebsd-ufs (300G) + 710934528 1242590514 7 freebsd-ufs (592G) + 1953525042 63 - free - (31k) + + Both the slice and the last partition should have some + free space at the end of each disk. + + Create filesystems on these new partitions. The + number of partitions will vary, matching the partitions on the + original disk, ada0. + + &prompt.root; newfs -U /dev/mirror/gm0s1a +&prompt.root; newfs -U /dev/mirror/gm0s1d +&prompt.root; newfs -U /dev/mirror/gm0s1e +&prompt.root; newfs -U /dev/mirror/gm0s1f +&prompt.root; newfs -U /dev/mirror/gm0s1g + + Make the mirror bootable by installing bootcode in the MBR + and bsdlabel and setting the active slice: + + &prompt.root; gpart bootcode -b /boot/mbr mirror/gm0 +&prompt.root; gpart set -a active -i 1 mirror/gm0 +&prompt.root; gpart bootcode -b /boot/boot mirror/gm0s1 + + Adjust /etc/fstab to use the + new partitions on the mirror. Back up this file first by + copying it to /etc/fstab.orig. + + &prompt.root; cp /etc/fstab /etc/fstab.orig + + Edit /etc/fstab, replacing + /dev/ada0 with + mirror/gm0. + + # Device Mountpoint FStype Options Dump Pass# +/dev/mirror/gm0s1a / ufs rw 1 1 +/dev/mirror/gm0s1b none swap sw 0 0 +/dev/mirror/gm0s1d /var ufs rw 2 2 +/dev/mirror/gm0s1e /usr ufs rw 2 2 +/dev/mirror/gm0s1f /data1 ufs rw 2 2 +/dev/mirror/gm0s1g /data2 ufs rw 2 2 + + If the &man.gmirror.8; kernel module has not been built + into the kernel, edit /boot/loader.conf + to load it: + + geom_mirror_load="YES" + + Filesystems from the original disk can now be copied onto + the mirror with &man.dump.8; and &man.restore.8;. Note that + it may take some time to create a snapshot for each filesystem + dumped with dump -L. + + &prompt.root; mount /dev/mirror/gm0s1a /mnt +&prompt.root; dump -C16 -b64 -0aL -f - / | (cd /mnt && restore -rf -) +&prompt.root; mount /dev/mirror/gm0s1d /mnt/var +&prompt.root; mount /dev/mirror/gm0s1e /mnt/usr +&prompt.root; mount /dev/mirror/gm0s1f /mnt/data1 +&prompt.root; mount /dev/mirror/gm0s1g /mnt/data2 +&prompt.root; dump -C16 -b64 -0aL -f - /usr | (cd /mnt/usr && restore -rf -) +&prompt.root; dump -C16 -b64 -0aL -f - /var | (cd /mnt/var && restore -rf -) +&prompt.root; dump -C16 -b64 -0aL -f - /data1 | (cd /mnt/data1 && restore -rf -) +&prompt.root; dump -C16 -b64 -0aL -f - /data2 | (cd /mnt/data2 && restore -rf -) + + Restart the system, booting from + ada1. If everything is working, the + system will boot from mirror/gm0, + which now contains the same data as + ada0 had previously. See the + Troubleshooting + section if there are problems booting. + + At this point, the mirror still consists of only the + single ada1 disk. + + After booting from mirror/gm0 + successfully, the final step is inserting + ada0 into the mirror. + + + When ada0 is inserted into the + mirror, its former contents will be overwritten by data on + the mirror. Make certain that + mirror/gm0 has the same contents as + ada0 before adding + ada0 to the mirror. If there is + something wrong with the contents copied by &man.dump.8; and + &man.restore.8;, revert /etc/fstab to + mount the filesystems on ada0, + reboot, and try the whole procedure again. + + + &prompt.root; gmirror insert gm0 ada0 +GEOM_MIRROR: Device gm0: rebuilding provider ada0 + + Synchronization between the two disks will start + immediately. &man.gmirror.8; status + shows the progress. + + &prompt.root; gmirror status + Name Status Components +mirror/gm0 DEGRADED ada1 (ACTIVE) + ada0 (SYNCHRONIZING, 64%) + + After a while, synchronization will finish. + + GEOM_MIRROR: Device gm0: rebuilding provider ada0 finished. +&prompt.root; gmirror status + Name Status Components +mirror/gm0 COMPLETE ada1 (ACTIVE) + ada0 (ACTIVE) + + mirror/gm0 now consists of + the two disks ada0 and + ada1, and the contents are + automatically synchronized with each other. In use, + mirror/gm0 will behave just like the + original single drive. - + Troubleshooting - System Refuses to Boot + Problems with Booting - If the system boots up to a prompt similar to: + + BIOS Settings - 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 -OK? boot - - If this works then for whatever reason the module was - not being loaded properly. Check whether the relevant entry - in /boot/loader.conf is correct. If - the problem persists, place: - - options GEOM_MIRROR - - in the kernel configuration file, rebuild and reinstall. - That should remedy this issue. + BIOS settings may have to be changed to boot from one + of the new mirrored drives. Either mirror drive can be + used for booting. As components of a mirror, they contain + identical data. + + + + Boot Problems + + If the boot stopped with this message, something is + wrong with the mirror device: + + Mounting from ufs:/dev/mirror/gm0s1a failed with error 19. + +Loader variables: + vfs.root.mountfrom=ufs:/dev/mirror/gm0s1a + vfs.root.mountfrom.options=rw + +Manual root filesystem specification: + <fstype>:<device> [options] + Mount <device> using filesystem <fstype> + and with the specified (optional) option list. + + eg. ufs:/dev/da0s1a + zfs:tank + cd9660:/dev/acd0 ro + (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /) + + ? List valid disk boot devices + . Yield 1 second (for background tasks) + <empty line> Abort manual input + +mountroot> + + Forgetting to load the + geom_mirror module in + /boot/loader.conf can cause this + problem. To fix it, boot from a &os;-9 or later CD or USB + stick and choose Shell at the first + prompt. Then load the mirror module and mount the mirror + device: + + &prompt.root; gmirror load +&prompt.root; mount /dev/mirror/gm0s1a /mnt + + Edit /mnt/boot/loader.conf, + adding a line to load the mirror module: + + geom_mirror_load="YES" + + Save the file and reboot. + + Other problems that cause error 19 + require more effort to fix. Enter + ufs:/dev/ada0s1a at the prompt. + Although the system should boot from + ada0, another prompt to select a + shell appears because /etc/fstab is + incorrect. Press the Enter key at the prompt. Undo the + modifications so far by reverting + /etc/fstab, mounting filesystems from + the original disk (ada0) instead + of the mirror. Reboot the system and try the procedure + again. + + Enter full pathname of shell or RETURN for /bin/sh: +&prompt.root; cp /etc/fstab.orig /etc/fstab +&prompt.root; reboot + Recovering from Disk Failure - The wonderful part about disk mirroring is that when a - disk fails, it may be replaced, presumably, without losing + The wonderful part about disk mirroring is that an + individual disk can fail without causing the mirror to lose any data. - Considering the previous RAID1 - configuration, assume that da1 - has failed and now needs to be replaced. To replace it, - determine which disk has failed and power down the system. - At this point, the disk may be swapped with a new one and - the system brought back up. After the system has restarted, - the following commands may be used to replace the disk: + ada0 is one of two drives making + up the mirror in the previous example. If + ada0 fails, the mirror will continue + to work, providing data from the remaining working drive, + ada1. + + To replace the failed drive, the computer is shut down and + the failed drive is physically replaced with a new drive of + equal or greater capacity. Manufacturers use somewhat + arbitrary values when rating drives in gigabytes, and the + only way to really be sure is to compare the total count of + sectors shown by diskinfo -v. A drive with + larger capacity than the mirror will work, although the extra + space on the new drive will not be used. + + After the computer is powered back up, the mirror will be + running in a degraded mode with only one drive. + The mirror is told to forget drives that are not currently + connected: &prompt.root; gmirror forget gm0 - &prompt.root; gmirror insert gm0 /dev/da1 - - Use the gmirror - command to monitor the progress of the rebuild. It is that - simple. + Any old metadata should be cleared from the replacement + disk. Then the disk, ada4 + for this example, is inserted into the mirror: + + &prompt.root; gmirror insert gm0 /dev/ada4 + + Resynchronization begins when the new drive is inserted + into the mirror. This process of copying mirror data to a new + drive can take a while. Performance of the mirror will be + greatly reduced during the copy, so inserting new drives is + best done when there is low demand on the computer. + + Progress can be monitored with gmirror + status, which shows drives that are being + synchronized and the percentage of completion. During + resynchronization, the status will be + DEGRADED, changing to + COMPLETE when the process is + finished. @@ -489,7 +877,7 @@ OK? boot fault tolerance of 1 drive, while providing a capacity of 1 - 1/n times the total capacity of all drives in the array, where n is the number of hard drives in the array. Such a configuration is - mostly suitable for storing data of larger sizes, e.g. + mostly suitable for storing data of larger sizes, e.g., multimedia files. At least 3 physical hard drives are required to build a