'\" te .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH METADB 1M "Mar 26, 2006" .SH NAME metadb \- create and delete replicas of the metadevice state database .SH SYNOPSIS .LP .nf \fB/sbin/metadb\fR \fB-h\fR .fi .LP .nf \fB/sbin/metadb\fR [\fB-s\fR \fIsetname\fR] .fi .LP .nf \fB/sbin/metadb\fR [\fB-s\fR \fIsetname\fR] \fB-a\fR [\fB-f\fR] [\fB-k\fR \fIsystem-file\fR] mddb\fInn\fR .fi .LP .nf \fB/sbin/metadb\fR [\fB-s\fR \fIsetname\fR] \fB-a\fR [\fB-f\fR] [\fB-k\fR \fIsystem-file\fR] [\fB-c\fR \fInumber\fR] [\fB-l\fR \fIlength\fR] \fIslice...\fR .fi .LP .nf \fB/sbin/metadb\fR [\fB-s\fR \fIsetname\fR] \fB-d\fR [\fB-f\fR] [\fB-k\fR \fIsystem-file\fR] mddb\fInn\fR .fi .LP .nf \fB/sbin/metadb\fR [\fB-s\fR \fIsetname\fR] \fB-d\fR [\fB-f\fR] [\fB-k\fR \fIsystem-file\fR] \fIslice...\fR .fi .LP .nf \fB/sbin/metadb\fR [\fB-s\fR \fIsetname\fR] \fB-i\fR .fi .LP .nf \fB/sbin/metadb\fR [\fB-s\fR \fIsetname\fR] \fB-p\fR [\fB-k\fR \fIsystem-file\fR] [\fImddb.cf-file\fR] .fi .SH DESCRIPTION .sp .LP The \fBmetadb\fR command creates and deletes replicas of the metadevice state database. State database replicas can be created on dedicated slices, or on slices that will later become part of a simple metadevice (concatenation or stripe) or RAID5 metadevice. Do not place state database replicas on fabric-attached storage, SANs, or other storage that is not directly attached to the system and available at the same point in the boot process as traditional SCSI or IDE drives. See \fBNOTES\fR. .sp .LP The metadevice state database contains the configuration of all metadevices and hot spare pools in the system. Additionally, the metadevice state database keeps track of the current state of metadevices and hot spare pools, and their components. Solaris Volume Manager automatically updates the metadevice state database when a configuration or state change occurs. A submirror failure is an example of a state change. Creating a new metadevice is an example of a configuration change. .sp .LP The metadevice state database is actually a collection of multiple, replicated database copies. Each copy, referred to as a replica, is subject to strict consistency checking to ensure correctness. .sp .LP Replicated databases have an inherent problem in determining which database has valid and correct data. To solve this problem, Volume Manager uses a \fImajority consensus algorithm\fR. This algorithm requires that a majority of the database replicas be available before any of them are declared valid. This algorithm strongly encourages the presence of at least three initial replicas, which you create. A consensus can then be reached as long as at least two of the three replicas are available. If there is only one replica and the system crashes, it is possible that all metadevice configuration data can be lost. .sp .LP The majority consensus algorithm is conservative in the sense that it will fail if a majority consensus cannot be reached, even if one replica actually does contain the most up-to-date data. This approach guarantees that stale data will not be accidentally used, regardless of the failure scenario. The majority consensus algorithm accounts for the following: the system will stay running with exactly half or more replicas; the system will panic when less than half the replicas are available; the system will not reboot without one more than half the total replicas. .sp .LP When used with no options, the \fBmetadb\fR command gives a short form of the status of the metadevice state database. Use \fBmetadb\fR \fB-i\fR for an explanation of the flags field in the output. .sp .LP The initial state database is created using the \fBmetadb\fR command with both the \fB-a\fR and \fB-f\fR options, followed by the slice where the replica is to reside. The \fB-a\fR option specifies that a replica (in this case, the initial) state database should be created. The \fB-f\fR option forces the creation to occur, even though a state database does not exist. (The \fB-a\fR and \fB-f\fR options should be used together only when no state databases exist.) .sp .LP Additional replicas beyond those initially created can be added to the system. They contain the same information as the existing replicas, and help to prevent the loss of the configuration information. Loss of the configuration makes operation of the metadevices impossible. To create additional replicas, use the \fBmetadb\fR \fB-a\fR command, followed by the name of the new slice(s) where the replicas will reside. All replicas that are located on the same slice must be created at the same time. .sp .LP To delete all replicas that are located on the same slice, the \fBmetadb\fR \fB-d\fR command is used, followed by the slice name. .sp .LP When used with the \fB-i\fR option, \fBmetadb\fR displays the status of the metadevice state databases. The status can change if a hardware failure occurs or when state databases have been added or deleted. .sp .LP To fix a replica in an error state, delete the replica and add it back again. .sp .LP The metadevice state database (\fBmddb\fR) also contains a list of the replica locations for this set (local or shared diskset). .sp .LP The local set \fBmddb\fR can also contain host and drive information for each of the shared disksets of which this node is a member. Other than the diskset host and drive information stored in the local set \fBmddb\fR, the local and shared diskset \fBmddb\fRs are functionality identical. .sp .LP The \fBmddb\fRs are written to during the resync of a mirror or during a component failure or configuration change. A configuration change or failure can also occur on a single replica (removal of a \fBmddb\fR or a failed disk) and this causes the other replicas to be updated with this failure information. .SH OPTIONS .sp .LP Root privileges are required for all of the following options except \fB-h\fR and \fB-i\fR. .sp .LP The following options can be used with the \fBmetadb\fR command. Not all the options are compatible on the same command line. Refer to the \fBSYNOPSIS\fR to see the supported use of the options. .sp .ne 2 .na \fB\fB-a\fR\fR .ad .RS 18n Attach a new database device. The \fB/kernel/drv/md.conf\fR file is automatically updated with the new information and the \fB/etc/lvm/mddb.cf\fR file is updated as well. An alternate way to create replicas is by defining them in the \fB/etc/lvm/md.tab\fR file and specifying the assigned name at the command line in the form, \fBmddb\fInn\fR\fR, where \fInn\fR is a two-digit number given to the replica definitions. Refer to the \fBmd.tab\fR(4) man page for instructions on setting up replicas in that file. .RE .sp .ne 2 .na \fB\fB-c\fR \fInumber\fR\fR .ad .RS 18n Specifies the number of replicas to be placed on each device. The default number of replicas is 1. .RE .sp .ne 2 .na \fB\fB-d\fR\fR .ad .RS 18n Deletes all replicas that are located on the specified \fIslice\fR. The \fB/kernel/drv/md.conf\fR file is automatically updated with the new information and the \fB/etc/lvm/mddb.cf\fR file is updated as well. .RE .sp .ne 2 .na \fB\fB-f\fR\fR .ad .RS 18n The \fB-f\fR option is used to create the initial state database. It is also used to force the deletion of replicas below the minimum of one. (The \fB-a\fR and \fB-f\fR options should be used together only when no state databases exist.) .RE .sp .ne 2 .na \fB\fB-h\fR\fR .ad .RS 18n Displays a usage message. .RE .sp .ne 2 .na \fB\fB-i\fR\fR .ad .RS 18n Inquire about the status of the replicas. The output of the \fB-i\fR option includes characters in front of the device name that represent the status of the state database. Explanations of the characters are displayed following the replica status and are as follows: .sp .ne 2 .na \fB\fBd\fR\fR .ad .RS 5n replica does not have an associated device ID. .RE .sp .ne 2 .na \fB\fBo\fR\fR .ad .RS 5n replica active prior to last \fBmddb\fR configuration change .RE .sp .ne 2 .na \fB\fBu\fR\fR .ad .RS 5n replica is up to date .RE .sp .ne 2 .na \fB\fBl\fR\fR .ad .RS 5n locator for this replica was read successfully .RE .sp .ne 2 .na \fB\fBc\fR\fR .ad .RS 5n replica's location was in \fB/etc/lvm/mddb.cf\fR .RE .sp .ne 2 .na \fB\fBp\fR\fR .ad .RS 5n replica's location was patched in kernel .RE .sp .ne 2 .na \fB\fBm\fR\fR .ad .RS 5n replica is master, this is replica selected as input .RE .sp .ne 2 .na \fB\fBr\fR\fR .ad .RS 5n replica does not have device relocation information .RE .sp .ne 2 .na \fB\fBt\fR\fR .ad .RS 5n tagged data is associated with the replica .RE .sp .ne 2 .na \fB\fBW\fR\fR .ad .RS 5n replica has device write errors .RE .sp .ne 2 .na \fB\fBa\fR\fR .ad .RS 5n replica is active, commits are occurring to this .RE .sp .ne 2 .na \fB\fBM\fR\fR .ad .RS 5n replica had problem with master blocks .RE .sp .ne 2 .na \fB\fBD\fR\fR .ad .RS 5n replica had problem with data blocks .RE .sp .ne 2 .na \fB\fBF\fR\fR .ad .RS 5n replica had format problems .RE .sp .ne 2 .na \fB\fBS\fR\fR .ad .RS 5n replica is too small to hold current database .RE .sp .ne 2 .na \fB\fBR\fR\fR .ad .RS 5n replica had device read errors .RE .sp .ne 2 .na \fB\fBB\fR\fR .ad .RS 5n tagged data associated with the replica is not valid .RE .RE .sp .ne 2 .na \fB\fB-k\fR \fIsystem-file\fR\fR .ad .RS 18n Specifies the name of the kernel file where the replica information should be written. The default \fIsystem-file\fR is \fB/kernel/drv/md.conf\fR. This option is for use with the local diskset only. .RE .sp .ne 2 .na \fB\fB-l\fR \fIlength\fR\fR .ad .RS 18n Specifies the size of each replica. The default \fIlength\fR is 8192 blocks, which should be appropriate for most configurations. "Replica" sizes of less than 128 blocks are not recommended. .RE .sp .ne 2 .na \fB\fB-p\fR\fR .ad .RS 18n Specifies updating the system file (\fB/kernel/drv/md.conf\fR) with entries from the \fB/etc/lvm/mddb.cf\fR file. This option is normally used to update a newly built system before it is booted for the first time. If the system has been built on a system other than the one where it will run, the location of the \fBmddb.cf\fR on the local machine can be passed as an argument. The system file to be updated can be changed using the \fB-k\fR option. This option is for use with the local diskset only. .RE .sp .ne 2 .na \fB\fB-s\fR \fIsetname\fR\fR .ad .RS 18n Specifies the name of the diskset on which the \fBmetadb\fR command will work. Using the \fB-s\fR option will cause the command to perform its administrative function within the specified diskset. Without this option, the command will perform its function on local database replicas. .RE .sp .ne 2 .na \fB\fIslice\fR\fR .ad .RS 18n Specifies the logical name of the physical slice (partition), such as \fB/dev/dsk/c0t0d0s3\fR. .RE .SH EXAMPLES .LP \fBExample 1 \fRCreating Initial State Database Replicas .sp .LP The following example creates the initial state database replicas on a new system. .sp .in +2 .nf # metadb -a -f c0t0d0s7 c0t1d0s3 c1t0d0s7 c1t1d0s3 .fi .in -2 .sp .sp .LP The \fB-a\fR and \fB-f\fR options force the creation of the initial database and replicas. You could then create metadevices with these same slices, making efficient use of the system. .LP \fBExample 2 \fRAdding Two Replicas on Two New Disks .sp .LP This example shows how to add two replicas on two new disks that have been connected to a system currently running Volume Manager. .sp .in +2 .nf # metadb -a c0t2d0s3 c1t1d0s3 .fi .in -2 .sp .LP \fBExample 3 \fRDeleting Two Replicas .sp .LP This example shows how to delete two replicas from the system. Assume that replicas have been set up on \fB/dev/dsk/c0t2d0s3\fR and \fB/dev/dsk/c1t1d0s3\fR. .sp .in +2 .nf # metadb -d c0t2d0s3 c1t1d0s3 .fi .in -2 .sp .sp .LP Although you can delete all replicas, you should never do so while metadevices still exist. Removing all replicas causes existing metadevices to become inoperable. .SH FILES .sp .ne 2 .na \fB\fB/etc/lvm/mddb.cf\fR\fR .ad .RS 23n Contains the location of each copy of the metadevice state database. .RE .sp .ne 2 .na \fB\fB/etc/lvm/md.tab\fR\fR .ad .RS 23n Workspace file for metadevice database configuration. .RE .sp .ne 2 .na \fB\fB/kernel/drv/md.conf\fR\fR .ad .RS 23n Contains database replica information for all metadevices on a system. Also contains Solaris Volume Manager configuration information. .RE .SH EXIT STATUS .sp .LP The following exit values are returned: .sp .ne 2 .na \fB\fB0\fR\fR .ad .RS 6n successful completion .RE .sp .ne 2 .na \fB\fB>0\fR\fR .ad .RS 6n an error occurred .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Stable .TE .SH SEE ALSO .sp .LP \fBmdmonitord\fR(1M), \fBmetaclear\fR(1M), \fBmetadetach\fR(1M), \fBmetahs\fR(1M), \fBmetainit\fR(1M), \fBmetaoffline\fR(1M), \fBmetaonline\fR(1M), \fBmetaparam\fR(1M), \fBmetarecover\fR(1M), \fBmetarename\fR(1M), \fBmetareplace\fR(1M), \fBmetaroot\fR(1M), \fBmetaset\fR(1M), \fBmetassist\fR(1M), \fBmetastat\fR(1M), \fBmetasync\fR(1M), \fBmetattach\fR(1M), \fBmd.tab\fR(4), \fBmd.cf\fR(4), \fBmddb.cf\fR(4), \fBmd.tab\fR(4), \fBattributes\fR(5), \fBmd\fR(7D) .sp .LP \fI\fR .SH NOTES .sp .LP Replicas cannot be stored on fabric-attached storage, SANs, or other storage that is not directly attached to the system. Replicas must be on storage that is available at the same point in the boot process as traditional SCSI or IDE drives. A replica can be stored on a: .RS +4 .TP .ie t \(bu .el o Dedicated local disk partition .RE .RS +4 .TP .ie t \(bu .el o Local partition that will be part of a volume .RE .RS +4 .TP .ie t \(bu .el o Local partition that will be part of a UFS logging device .RE