<chapter id="tasks-state-db-replicas-1"><title>State Database (Tasks)</title><highlights><para>This chapter provides information about performing tasks that are associated
with Solaris Volume Manager's state database replicas. For information about the concepts
involved in these tasks, see <olink targetptr="about-state-db-replicas-1" remap="internal">Chapter&nbsp;6, State Database (Overview)</olink>.</para>
</highlights><sect1 id="tasks-state-db-replicas-15"><title>State Database Replicas (Task
Map)</title><para>The following task map identifies the procedures that are needed to
manage Solaris Volume Manager state database replicas. </para><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="110.00*"/><colspec colname="colspec1" colwidth="165.42*"/><colspec colname="colspec2" colwidth="120.58*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Create state database replicas</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metadb -a</command> command
to create state database replicas.</para>
</entry><entry><para><olink targetptr="tasks-state-db-replicas-3" remap="internal">How to Create State Database
Replicas</olink></para>
</entry>
</row><row><entry><para>Check the status of state database replicas</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metadb</command> command
to check the status of existing replicas.</para>
</entry><entry><para><olink targetptr="maintaintasksnew-25437" remap="internal">How to Check the Status of
State Database Replicas</olink></para>
</entry>
</row><row><entry><para>Delete state database replicas</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metadb -d</command> command
to delete state database replicas.</para>
</entry><entry><para><olink targetptr="tasks-state-db-replicas-12" remap="internal">How to Delete State Database
Replicas</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="tasks-state-db-replicas-9"><title>Creating State Database Replicas</title><caution><para>If you upgraded from the Solstice DiskSuite product to Solaris Volume Manager and
you have state database replicas sharing slices with file systems or logical
volumes (as opposed to on separate slices), do not delete existing replicas
and replace them with new default replicas in the same location.</para><para>The default state database replica size in Solaris Volume Manager is 8192 blocks,
while the default size in the Solstice DiskSuite product is 1034 blocks. Use
caution if you delete a default-sized state database replica created in the
Solstice DiskSuite product, and then add a new default-sized replica with Solaris Volume Manager.
You will overwrite the first 7158 blocks of any file system that occupies
the rest of the shared slice, thus destroying the data. </para>
</caution><caution><para>Do not place state database replicas on fabric-attached storage,
SANs, or other storage that is not directly attached to the system. You might
not be able to boot Solaris Volume Manager. Replicas must be on storage devices that
are available at the same point in the boot process as traditional SCSI or
IDE drives. </para>
</caution><task id="tasks-state-db-replicas-3"><title>How to Create State Database Replicas</title><taskprerequisites><para>Check <olink targetptr="addtasks-20933" remap="internal">Prerequisites for Creating Solaris
Volume Manager Components</olink>.</para>
</taskprerequisites><procedure><step id="tasks-state-db-replicas-step-13"><para>Become superuser.</para>
</step><step id="tasks-state-db-replicas-step-14"><para>To create state database
replicas, use one of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the State Database Replicas node.
Choose Action&rArr;Create Replicas and follow the onscreen instructions. For
more information, see the online help.</para>
</listitem><listitem><para>Use the following form of the <command>metadb</command> command.
See the <olink targetdoc="refman1m" targetptr="metadb-1m" remap="external"><citerefentry><refentrytitle>metadb</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><screen># <userinput>metadb  -a -c <replaceable>number</replaceable> -l <replaceable>length-of replica</replaceable> -f <replaceable>ctds-of-slice</replaceable></userinput></screen><variablelist><varlistentry><term><option>a</option></term><listitem><para>Specifies to add or create a state database replica.</para>
</listitem>
</varlistentry><varlistentry><term><option>f</option></term><listitem><para>Specifies to force the operation, even if no replicas exist.
Use the <option>f</option> to force the creation of the initial replicas.</para>
</listitem>
</varlistentry>
</variablelist><variablelist><varlistentry><term><option>c</option> <replaceable>number</replaceable></term><listitem><para>Specifies the number of replicas to add to the specified slice.</para>
</listitem>
</varlistentry><varlistentry><term><option>l</option> <replaceable>length-of-replica</replaceable></term><listitem><para>Specifies the size of the new replicas, in blocks. The default
size is 8192. This size should be appropriate for virtually all configurations,
including those configurations with thousands of logical volumes.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>ctds-of-slice</replaceable></term><listitem><para>Specifies the name of the component that will hold the replica.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</itemizedlist><note><para>The <command>metadb</command> command entered on the command line
without options reports the status of all state database replicas.</para>
</note>
</step>
</procedure><example id="egjwg"><title>Creating the First State Database Replica</title><screen># <userinput>metadb -a -f c0t0d0s7</userinput>
# <userinput>metadb</userinput>
        flags         first blk      block count
...
     a      u         16             8192            /dev/dsk/c0t0d0s7</screen><para>You must use the <option>f</option> option along with the <option>a</option> option to create the first state database replica. The <option>a</option> option adds state database replicas to the system.The <option>f</option> option forces the creation of the first replica (and may be omitted
when you add supplemental replicas to the system). </para>
</example><example id="egjwz"><title>Adding Two State Database Replicas to the Same Slice</title><screen># <userinput>metadb -a -c 2 c1t3d0s1</userinput>
<userinput># metadb</userinput>
        flags         first blk      block count
...
     a        u         16              8192            /dev/dsk/c1t3d0s1
     a        u         8208            8192            /dev/dsk/c1t3d0s1</screen><para>The <option>a</option> option adds state database replicas to the system.
The <option>c 2</option> option places two replicas on the specified slice.
The <command>metadb</command> command checks that the replicas are active,
as indicated by the <literal>a</literal> flag in the <command>metadb</command> command
output.</para>
</example><example id="egjwb"><title>Adding State Database Replicas of a Specific Size</title><para>If you are replacing existing state database replicas, you might need
to specify a replica size. Particularly if you have existing state database
replicas (on a system upgraded from the Solstice DiskSuite product, perhaps)
that share a slice with a file system, you must replace existing replicas
with other replicas of the same size or add new replicas in a different location.</para><screen># <userinput>metadb -a -c 3 -l 1034 c0t0d0s7</userinput>
<userinput># metadb</userinput>
        flags         first blk      block count
...
     a      u         16             1034            /dev/dsk/c0t0d0s7
     a      u         1050           1034            /dev/dsk/c0t0d0s7
     a      u         2084           1034            /dev/dsk/c0t0d0s7</screen><para>The <option>a</option> option adds state database replicas to the system.
The <option>l</option> option specifies the length in blocks of the replica
to add.</para>
</example>
</task>
</sect1><sect1 id="tasks-state-db-replicas-8"><title>Maintaining State Database Replicas</title><task id="maintaintasksnew-25437"><title>How to Check the Status of State
Database Replicas</title><procedure><step><para>Become superuser.</para>
</step><step id="tasks-state-db-replicas-step-17"><para>To check the status of state
database replicas, use one of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the State Database Replicas node to
view all existing state database replicas. For more information, see the online
help.</para>
</listitem><listitem><para>Use the <command>metadb</command> command to view the status
of state database replicas. Add the <option>i</option> option to display an
explanation of the status flags, as shown in the following example. See the <olink targetdoc="refman1m" targetptr="metadb-1m" remap="external"><citerefentry><refentrytitle>metadb</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjvv"><title>Checking the Status of All State Database Replicas</title><screen width="100"># <userinput>metadb -i</userinput>
        flags           first blk       block count
     a m  p  luo        16              8192            /dev/dsk/c0t0d0s7
     a    p  luo        8208            8192            /dev/dsk/c0t0d0s7
     a    p  luo        16400           8192            /dev/dsk/c0t0d0s7
     a    p  luo        16              8192            /dev/dsk/c1t3d0s1
      W   p  l          16              8192            /dev/dsk/c2t3d0s1
     a    p  luo        16              8192            /dev/dsk/c1t1d0s3
     a    p  luo        8208            8192            /dev/dsk/c1t1d0s3
     a    p  luo        16400           8192            /dev/dsk/c1t1d0s3
 r - replica does not have device relocation information
 o - replica active prior to last mddb configuration change
 u - replica is up to date
 l - locator for this replica was read successfully
 c - replica's location was in /etc/lvm/mddb.cf
 p - replica's location was patched in kernel
 m - replica is master, this is replica selected as input
 W - replica has device write errors
 a - replica is active, commits are occurring to this replica
 M - replica had problem with master blocks
 D - replica had problem with data blocks
 F - replica had format problems
 S - replica is too small to hold current data base
 R - replica had device read errors</screen><para>A legend of all the flags follows the status. The characters in
front of the device name represent the status. Uppercase letters indicate
a problem status. Lowercase letters indicate an &ldquo;Okay&rdquo; status. </para>
</example>
</task><task id="tasks-state-db-replicas-12"><title>How to Delete State Database
Replicas</title><tasksummary><para>You might need to delete state database replicas to maintain your Solaris Volume Manager configuration.
For example, if you will be replacing disk drives, you want to delete the
state database replicas before you remove the drives. Otherwise Solaris Volume Manager will
report them as having errors.</para>
</tasksummary><procedure><step><para>Become superuser.</para>
</step><step id="tasks-state-db-replicas-step-21"><para>To remove state database
replicas, use one of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the State Database Replicas node to
view all existing state database replicas. Select replicas to delete, then
choose Edit&rArr;Delete to remove them. For more information, see the online
help.</para>
</listitem><listitem><para>Use the following form of the <command>metadb</command> command:</para><screen># <userinput>metadb -d -f <replaceable>ctds-of-slice</replaceable></userinput></screen><variablelist><varlistentry><term><option>d</option></term><listitem><para>Specifies to delete a state database replica.</para>
</listitem>
</varlistentry><varlistentry><term><option>f</option></term><listitem><para>Specifies to force the operation, even if no replicas exist.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>ctds-of-slice</replaceable></term><listitem><para>Specifies the name of the component that contains the replica.</para>
</listitem>
</varlistentry>
</variablelist><para>Note that you need to specify each
slice from which you want to remove the state database replica. See the <olink targetdoc="refman1m" targetptr="metadb-1m" remap="external"><citerefentry><refentrytitle>metadb</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page
for more information. </para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjvx"><title>Deleting State Database Replicas</title><screen width="70"># <userinput>metadb -d -f c0t0d0s7</userinput></screen><para>This example shows the last replica being deleted from a slice. </para><para>You must add the <option>f</option> option to force the deletion of
the last replica on the system.</para>
</example>
</task>
</sect1>
</chapter>