<chapter id="tasks-mirrors-1"><title>RAID-1
(Mirror) Volumes (Tasks)</title><highlights><para>This chapter explains how to perform Solaris Volume Manager tasks that are related
to RAID-1 volumes. For information about related concepts, see <olink targetptr="about-mirrors-2" remap="internal">Chapter&nbsp;10, RAID-1 (Mirror) Volumes (Overview)</olink>.</para>
</highlights><sect1 id="fpjwe"><title>RAID-1
Volumes (Task Map)</title><para>The following task map identifies the procedures that are needed to
manage Solaris Volume Manager RAID-1 volumes. </para><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="110.00*"/><colspec colname="colspec1" colwidth="167.00*"/><colspec colname="colspec2" colwidth="119.00*"/><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 a mirror from unused slices</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metainit</command> command
to create a mirror from unused slices.</para>
</entry><entry><para><olink targetptr="addtasks-12543" remap="internal">How to Create a RAID-1 Volume From
Unused Slices</olink></para>
</entry>
</row><row><entry><para>Create a mirror from an existing file system</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metainit</command> command
to create a mirror from an existing file system.</para>
</entry><entry><para><olink targetptr="addtasks-18898" remap="internal">How to Create a RAID-1 Volume From
a File System</olink></para>
</entry>
</row><row><entry><para>Create a mirror from the root (<filename>/</filename>) file system</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metainit</command> command
to create a mirror from the root (<filename>/</filename>) file system.</para>
</entry><entry><para><olink targetptr="frkdb" remap="internal">How to Create a RAID-1 Volume From the root (/) File System</olink></para><para><olink targetptr="gcsdr" remap="internal">How
to Create a RAID-1 Volume From the root (/) File System</olink></para>
</entry>
</row><row><entry><para>Attach a submirror</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metattach</command> command
to attach a submirror. </para>
</entry><entry><para><olink targetptr="tasks-mirrors-8" remap="internal">How to Attach a Submirror</olink></para>
</entry>
</row><row><entry><para>Detach a submirror</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metadetach</command> command
to detach the submirror. </para>
</entry><entry><para><olink targetptr="tasks-mirrors-10" remap="internal">How to Detach a Submirror</olink></para>
</entry>
</row><row><entry><para>Place a submirror online or take a submirror offline</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metaonline</command> command
to put a submirror online. Use the Solaris Volume Manager GUI or the <command>metaoffline</command> command to take a submirror offline.</para>
</entry><entry><para><olink targetptr="tasks-mirrors-12" remap="internal">How to Place a Submirror Offline
and Online</olink></para>
</entry>
</row><row><entry><para>Enable a slice within a submirror</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metareplace</command> command
to enable a slice in a submirror. </para>
</entry><entry><para><olink targetptr="maintaintasksnew-14061" remap="internal">How to Enable a Slice in a
Submirror</olink></para>
</entry>
</row><row><entry><para>Check mirror status</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metastat</command> command
to check the status of RAID-1 volumes. </para>
</entry><entry><para><olink targetptr="maintaintasksnew-34973" remap="internal">How to View the Status of
Mirrors and Submirrors</olink></para>
</entry>
</row><row><entry><para>Change mirror options</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metaparam</command> command
to change the options for a specific RAID-1 volume. </para>
</entry><entry><para><olink targetptr="tasks-mirrors-15" remap="internal">How to Change RAID-1 Volume Options</olink></para>
</entry>
</row><row><entry><para>Expand a mirror</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metattach</command> command
to expand the capacity of a mirror. </para>
</entry><entry><para><olink targetptr="maintaintasksnew-15601" remap="internal">How to Expand a RAID-1 Volume</olink></para>
</entry>
</row><row><entry><para>Replace a slice within a submirror</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metareplace</command> command
to replace a slice in a submirror. </para>
</entry><entry><para><olink targetptr="maintaintasksnew-11508" remap="internal">How to Replace a Slice in
a Submirror</olink></para>
</entry>
</row><row><entry><para>Replace a submirror</para>
</entry><entry><para>Use the Solaris Volume Manager GUI or the <command>metattach</command> command
to replace a submirror. </para>
</entry><entry><para><olink targetptr="maintaintasksnew-10199" remap="internal">How to Replace a Submirror</olink></para>
</entry>
</row><row><entry><para>Remove a mirror (unmirror)</para>
</entry><entry><para>Use the Solaris Volume Manager GUI, the <command>metadetach</command> command,
or the <command>metaclear</command> command to unmirror a file system.</para>
</entry><entry><para><olink targetptr="tasks-mirrors-3" remap="internal">How to Unmirror a File System</olink></para>
</entry>
</row><row><entry><para>Remove a mirror (unmirror) of a file system that cannot be unmounted</para>
</entry><entry><para>Use the Solaris Volume Manager GUI, the <command>metadetach</command> command,
or the <command>metaclear</command> command to unmirror a file system that
cannot be unmounted. </para>
</entry><entry><para><olink targetptr="tasks-mirrors-5" remap="internal">How to Unmirror a File System That
Cannot Be Unmounted</olink></para>
</entry>
</row><row><entry><para>Use a mirror to perform backups</para>
</entry><entry><para>Use the Solaris Volume Manager GUI, the <command>metaonline</command> command,
or the <command>metaoffline</command> commands to perform backups with mirrors. </para>
</entry><entry><para><olink targetptr="tipsandtricks-36804" remap="internal">How to Perform an Online Backup
of a RAID-1 Volume</olink></para>
</entry>
</row><row><entry><para>Cancel or resume the resynchronization process on a mirror</para>
</entry><entry><para>Use the <command>metasync</command> command to cancel and resume the
resynchronization process on a mirror</para>
</entry><entry><para><olink targetptr="fpklu" remap="internal">How to Cancel a Volume Resynchronization Process</olink></para><para><olink targetptr="fpkkx" remap="internal">How to Resume a Volume Resynchronization Process</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="tasks-mirrors-21"><title>Creating a RAID-1 Volume</title><task id="addtasks-12543"><title>How to Create a RAID-1 Volume From Unused
Slices</title><tasksummary><para>This procedure shows you how to create a two-way mirror. If you want
to create a three-way mirror or a four-way mirror, use the same procedure.</para>
</tasksummary><taskprerequisites><para>Check <olink targetptr="addtasks-20933" remap="internal">Prerequisites for Creating Solaris
Volume Manager Components</olink> and <olink targetptr="eyaso" remap="internal">Creating and
Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-30"><para>Create two stripes or concatenations.
These components become the submirrors.</para><para>See <olink targetptr="tasks-metadevices-21" remap="internal">How to Create a RAID-0 (Stripe) Volume</olink> or <olink targetptr="addtasks-17877" remap="internal">How to Create a RAID-0 (Concatenation) Volume</olink>.</para>
</step><step id="tasks-mirrors-step-31"><para>To create the mirror, use one of the
following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action&rArr;Create
Volume and follow the onscreen instructions. For more information, see the
online help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit</command> command
to create a one-way mirror:</para><screen># <userinput>metainit <replaceable>volume-name</replaceable> -m  <replaceable>submirror-name</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the volume to create</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option></term><listitem><para>Specifies to create a mirror</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror-name</replaceable></term><listitem><para>Specifies the name of the component that will be the first
submirror in the mirror</para>
</listitem>
</varlistentry>
</variablelist><para>See the following examples and the <olink targetdoc="refman1m" targetptr="metainit-1m" remap="external"><citerefentry><refentrytitle>metainit</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page for more information.</para>
</listitem>
</itemizedlist>
</step><step id="tasks-mirrors-step-31a"><para>To add the second submirror, use one
of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the
mirror you want to modify. Choose Action&rArr;Properties, then the Submirrors.
Follow the onscreen instructions to attach the submirror. For more information,
see the online help.</para>
</listitem><listitem><para>Use the following form of the <command>metattach</command> command:</para><screen># <userinput>metattach <replaceable>volume-name</replaceable> <replaceable>submirror-name</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the RAID-1 volume on which to add the
submirror</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror-name</replaceable></term><listitem><para>Specifies the name of the component that will be the second
submirror attached to the mirror</para>
</listitem>
</varlistentry>
</variablelist><para>See the following examples and the <olink targetdoc="refman1m" targetptr="metattach-1m" remap="external"><citerefentry><refentrytitle>metattach</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page for more information.</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjxo"><title>Creating a Two-Way Mirror</title><screen># <userinput>metainit d51 1 1 c0t0d0s2</userinput>
d51: Concat/Stripe is setup
# <userinput>metainit d52 1 1 c1t0d0s2</userinput>
d52: Concat/Stripe is setup
# <userinput>metainit d50 -m d51</userinput>
d50: Mirror is setup
# <userinput>metattach d50 d52</userinput>
d50: Submirror d52 is attached</screen><para>This example shows you how to create the two-way mirror, <filename>d50</filename>.
The <command>metainit</command> command creates two submirrors (<filename>d51</filename> and <filename>d52</filename>), which are RAID-0 volumes. The <command>metainit</command> <option>m</option> command creates the one-way mirror from the <filename>d51</filename> RAID-0
volume. The <command>metattach</command> command attaches <filename>d52</filename>,
creating a two-way mirror and causing a resynchronization. Any data on the
attached submirror is overwritten by the other submirror during the resynchronization. </para>
</example><example id="egjxk"><title>Creating a Two-Way Mirror Without Resynchronization</title><screen># <userinput>metainit d51 1 1 c0t0d0s2</userinput>
d51: Concat/Stripe is setup
# <userinput>metainit d52 1 1 c1t0d0s2</userinput>
d52: Concat/Stripe is setup
# <userinput>metainit d50 -m d51 d52</userinput>
metainit: d50: WARNING: This form of metainit is not recommended.
The submirrors may not have the same data.
Please see ERRORS in metainit(1M) for additional information.
d50: Mirror is setup</screen><para>This example shows the creation a two-way mirror, <filename>d50</filename>.
The <command>metainit</command> command creates two submirrors (<filename>d51</filename> and <filename>d52</filename>), which are RAID-0 volumes. The <command>metainit</command> <option>m</option> command is then run with both submirrors to create the mirror.
When you create a mirror using the <command>metainit</command> command rather
than the <command>metattach</command> command , no resynchronization operations
occur. As a result, data could become corrupted when Solaris Volume Manager assumes
that both sides of the mirror are identical and can be used interchangeably.</para>
</example><taskrelated role="see-also"><para>To prepare a newly created mirror for a file system, see <olink targetdoc="sagdfs" targetptr="fscreate-96442" remap="external">Chapter 18, <citetitle remap="chapter">Creating UFS, TMPFS, and LOFS File Systems (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Devices and File Systems</citetitle></olink>.
Some applications, such as a database, do not use a file system. These applications
instead use the raw device. The application must have its own way of accessing
the raw device.</para>
</taskrelated>
</task><task id="addtasks-18898"><title>How to Create a RAID-1 Volume From a File
System</title><tasksummary><para>Use this procedure to mirror an existing file system. If the file system
can be unmounted, the entire procedure can be completed without a reboot.
For file systems that cannot be unmounted, such as <filename>/usr</filename> and <filename>/swap</filename>, the system must be rebooted to complete the procedure.</para><para>When creating a RAID-1 volume from an existing file system built on
a slice, only the single slice may be included in the primary RAID-0 volume
(submirror). If you are mirroring system-critical file systems, all submirrors
must consist of only a single slice. </para><para>For the procedures associated with mirroring the root (/) file system,
see <olink targetptr="frkdb" remap="internal">How to Create a RAID-1 Volume From the root (/)
File System</olink> and <olink targetptr="gcsdr" remap="internal">How to Create a RAID-1
Volume From the root (/) File System</olink>.</para><para>In the example used in this procedure, the existing slice is <filename>c1t0d0s0</filename>. The second slice, <filename>c1t1d0s0</filename>, is available
for the second half of the mirror. The submirrors are <filename>d1</filename> and <filename>d2</filename>, respectively, and the mirror is <filename>d0</filename>. </para><caution><para>Be sure to create a one-way mirror with the <command>metainit</command> command
then attach the additional submirrors with the <command>metattach</command> command.
When the <command>metattach</command> command is not used, no resynchronization
operations occur. As a result, data could become corrupted when Solaris Volume Manager assumes
that both sides of the mirror are identical and can be used interchangeably. </para>
</caution>
</tasksummary><taskprerequisites><para>Check <olink targetptr="addtasks-20933" remap="internal">Prerequisites for Creating Solaris
Volume Manager Components</olink> and <olink targetptr="eyaso" remap="internal">Creating and
Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-35"><para>Identify the slice that contains the
existing file system to be mirrored This example uses the slice <literal>c1t0d0s0</literal>.</para>
</step><step id="tasks-mirrors-step-132"><para>Create a new RAID-0 volume on the
slice from the previous step by using one of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action&rArr;Create
Volume. Follow the onscreen instructions . For more information, see the online
help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit</command> command:</para><screen># <userinput>metainit -f  <replaceable>volume-name</replaceable> <replaceable>number-of-stripes</replaceable> <replaceable>components-per-stripe</replaceable> <replaceable>component-name</replaceable></userinput></screen><variablelist><varlistentry><term><option>f</option></term><listitem><para>Forces the command to continue. You must use this option when
the slice contains a mounted file system.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the volume to create. For information
on naming volumes, see <olink targetptr="basics-34" remap="internal">Volume Names</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>number-of-stripes</replaceable></term><listitem><para>Specifies the number of stripes to create.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>components-per-stripe</replaceable></term><listitem><para>Specifies the number of components each stripe should have.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>component-names</replaceable></term><listitem><para>Specifies the names of the components that are used. This
example uses the root slice, <filename>c0t0d0s0</filename>.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</itemizedlist>
</step><step id="tasks-mirrors-step-126"><para>Create a second RAID-0 volume (concatenation)
on an unused slice (<literal>c1t1d0s0</literal> in this example) to act as
the second submirror. The second submirror must be the same size as the original
submirror or larger. Use one of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action->Create
Volume and follow the instructions on screen. For more information, see the
online help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit </command> command.</para><screen># <userinput>metainit <replaceable>volume-name</replaceable> <replaceable>number-of-stripes</replaceable> <replaceable>components-per-stripe</replaceable> <replaceable>component-name</replaceable></userinput></screen><note><para>See Step 2 for an explanation of the options.</para>
</note>
</listitem>
</itemizedlist>
</step><step id="tasks-mirrors-step-127"><para>Create a one-way mirror by using one
of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action&rArr;Create
Volume. Follow the onscreen instructions . For more information, see the online
help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit </command> command.</para><screen># <userinput>metainit <replaceable>volume-name</replaceable> -m <replaceable>submirror-name</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the volume to create.</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option></term><listitem><para>Specifies to create a mirror.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror-name</replaceable></term><listitem><para>Specifies the name of the component that will be the first
submirror in the mirror. In this example, it is the RAID-0 volume that contains
the root slice.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</itemizedlist><para>See the <olink targetdoc="refman1m" targetptr="metainit-1m" remap="external"><citerefentry><refentrytitle>metainit</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page for more information.</para><caution><para>When you create a mirror from an existing file system, you
must follow the next two steps precisely to avoid data corruption. </para>
</caution>
</step><step><para>Edit the <filename>/etc/vfstab</filename> file so that the file
system mount instructions refer to the mirror, not to the block device. For
more information about the<filename>/etc/vfstab</filename> file, see <olink targetdoc="sagdfs" targetptr="fsmount-5" remap="external"><citetitle remap="section">Mounting
File Systems</citetitle> in <citetitle remap="book">System Administration
Guide: Devices and File Systems</citetitle></olink>.</para><para>For example,
if the <filename>/etc/vfstab file</filename> contains the following entry
for the file system:</para><screen>/dev/dsk/<replaceable>slice</replaceable> /dev/rdsk/<replaceable>slice</replaceable> /var ufs 2 yes -</screen><para>Change the entry to read as follows:</para><screen>/dev/md/dsk/<replaceable>mirror-name</replaceable> /dev/md/rdsk/<replaceable>mirror-name</replaceable> /var ufs 2 yes -</screen>
</step><step id="tasks-mirrors-step-39"><para>Remount your newly mirrored file system
according to one of the following procedures:</para><itemizedlist><listitem><para>If you are mirroring a file system that can be unmounted,
then unmount and remount the file system.</para><screen># <userinput>umount <replaceable>/filesystem</replaceable></userinput>
# <userinput>mount <replaceable>/filesystem</replaceable></userinput></screen>
</listitem><listitem><para>If you are mirroring a file system that cannot be unmounted,
then reboot your system.</para><screen># <userinput>reboot</userinput></screen>
</listitem>
</itemizedlist>
</step><step id="tasks-mirrors-step-42"><para>Use the following form of the <command>metattach</command> command
to attach the second submirror. </para><screen># <userinput>metattach <replaceable>volume-name</replaceable> <replaceable>submirror-name</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the RAID-1 volume on which to add the
submirror</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror-name</replaceable></term><listitem><para>Specifies the name of the component that will be the second
submirror attached to the mirror</para>
</listitem>
</varlistentry>
</variablelist><para>See the <olink targetdoc="refman1m" targetptr="metattach-1m" remap="external"><citerefentry><refentrytitle>metattach</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page for more information.</para>
</step>
</procedure><example id="egjxl"><title>Creating a Two-Way Mirror From a File System That Can Be Unmounted</title><screen># <userinput>metainit -f d1 1 1 c1t0d0s0</userinput>
d1: Concat/Stripe is setup
# <userinput>metainit d2 1 1 c1t1d0s0</userinput>
d2: Concat/Stripe is setup
# <userinput>metainit d0 -m d1</userinput>
d0: Mirror is setup
# <userinput>umount /master</userinput>
<lineannotation>(Edit the /etc/vfstab file so that the file system references the mirror)</lineannotation>
# <userinput>mount /master</userinput>
# <userinput>metattach d0 d2</userinput>
d0: Submirror d2 is attached</screen><para>In this example, the <option>f</option> option forces the creation
of the first concatenation, <filename>d1</filename>, which contains the mounted
file system <filename>/master</filename> on <filename>/dev/dsk/c1t0d0s0</filename>.
The second concatenation, <filename>d2</filename>, is created from <filename>/dev/dsk/c1t1d0s0</filename>. This slice must be the same size as , or larger than the size
of <filename>d1</filename>.) The <command>metainit</command> command with
the <option>m</option> option creates the one-way mirror, <filename>d0</filename>,
from <filename>d1</filename>. </para><para>Next, the entry for the file system should be changed in the <filename>/etc/vfstab</filename> file to reference the mirror. The following line in the <filename>/etc/vfstab</filename> file initially appears as follows:</para><screen>/dev/dsk/<emphasis role="strong">c1t0d0s0</emphasis> /dev/rdsk/<emphasis role="strong">c1t0d0s0</emphasis> /var ufs 2 yes -</screen><para>The entry is changed to the following: </para><screen>/dev/md/dsk/<emphasis role="strong">d0</emphasis> /dev/md/rdsk/<emphasis role="strong">d0</emphasis> /var ufs 2 yes -</screen><para>Finally, the file system is remounted and submirror <filename>d2</filename> is
attached to the mirror, causing a mirror resynchronization. The system confirms
that the RAID-0 and RAID-1 volumes are set up, and that submirror <filename>d2</filename> is
attached.</para>
</example><example id="egjxp"><title>Creating a Two-way Mirror From a File System That Cannot Be Unmounted</title><screen># <userinput>metainit -f d12 1 1 c0t3d0s6</userinput>
d12: Concat/Stripe is setup
# <userinput>metainit d22 1 1 c1t0d0s6</userinput>
d22: Concat/Stripe is setup
# <userinput>metainit d2 -m d12</userinput>
d2: Mirror is setup
<lineannotation>(Edit the /etc/vfstab file so that /usr references the mirror)</lineannotation>
# <userinput>reboot</userinput>
...
# <userinput>metattach d2 d22</userinput>
d2: Submirror d22 is attached</screen><para>This example creates a two-way mirror using a slice containing the <filename>/usr</filename> file system. The <option>f</option> option forces the creation
of the first concatenation, <filename>d12</filename>, which contains the mounted
file system <filename>/usr</filename> on <filename>/dev/dsk/c0t3d0s6</filename>.
The second concatenation, <filename>d22</filename>, is created from <filename>/dev/dsk/c1t0d0s6</filename>. This slice must be the same size as, or larger than the size
of <filename>d12</filename>. The <command>metainit</command> command with
the <option>m</option> option creates the one-way mirror <filename>d2</filename> using
the concatenation that contains the <filename>/usr</filename> file system.
Next, the <filename>/etc/vfstab</filename> file must be edited to change the
entry for <filename>/usr</filename> to reference the mirror.</para><para>The <filename>/etc/vfstab file</filename> contains the following entry
for the <filename>/usr</filename> file system:</para><screen>/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /usr ufs 1 yes -</screen><para>Change the entry to read as follows:</para><screen>/dev/md/dsk/d2 /dev/md/rdsk/d2 /usr ufs 1 yes -</screen><para>After a reboot, the second submirror <filename>d22</filename> is
attached to the mirror, causing a mirror resynchronization.</para>
</example><example id="egjxq"><title>Creating a Mirror From the <filename>/swap</filename> Space</title><screen># <userinput>metainit -f d11 1 1 c0t0d0s1</userinput>
d11: Concat/Stripe is setup
# <userinput>metainit d21 1 1 c1t0d0s1</userinput>
d21: Concat/Stripe is setup
# <userinput>metainit d1 -m d11</userinput>
d1: Mirror is setup
<lineannotation>(Edit the /etc/vfstab file so that swap references the mirror)</lineannotation>
# <userinput>reboot</userinput>
...
# <userinput>metattach d1 d21</userinput>
d1: Submirror d21 is attached</screen><para>In this example, the <option>f</option> option forces the creation of
the first concatenation, <filename>d11</filename>, which contains the mounted
file system <filename>swap</filename> on <filename>/dev/dsk/c0t0d0s1</filename>.
The second concatenation, <filename>d21</filename>, is created from <filename>/dev/dsk/c1t0d0s1</filename>. This slice must be the same size as, or larger than the size
of <filename>d11</filename>. The <command>metainit</command> command with
the <option>m</option> option creates the one-way mirror <filename>d1</filename> using
the concatenation that contains <filename>swap</filename>. Next, if there
is an entry for <filename>swap</filename> in the <filename>/etc/vfstab</filename> file,
it must be edited to reference the mirror.</para><para>The <filename>/etc/vfstab file</filename> contains the following entry
for the <filename>swap</filename> space:</para><screen>/dev/dsk/c0t0d0s1 - - swap - no -</screen><para>Change the entry to read as follows:</para><screen>/dev/md/dsk/d1 - - swap - no -</screen><para>After a reboot, the second submirror <filename>d21</filename> is attached
to the mirror, causing a mirror resynchronization.</para><para>To save the crash dump when you have mirrored the <filename>swap</filename> space,
use the <command>dumpadm</command> command to configure the dump device as
a volume. For instance, if the swap device is named <filename>/dev/md/dsk/d2</filename>,
use the <command>dumpadm</command> command to set this device as the dump
device.</para>
</example>
</task><task id="frkdb" arch="sparc"><title>How to Create a RAID-1 Volume From the
root (<filename>/</filename>) File System</title><tasksummary><para>The process for mirroring the root (<filename>/</filename>) file system
on a SPARC platform is similar to mirroring any other file system that you
cannot unmount. The procedure differs in that the <command>metaroot</command> command
is run instead of manually editing the <filename>/etc/vfstab</filename> file.
Mirroring the root (<filename>/</filename>) file system also requires recording
the path to the alternate boot device. This device reboots the system if the
submirror fails.</para><para>In the example used in this procedure, the existing slice is <filename>c1t0d0s0</filename>. The second slice, <filename>c1t1d0s0</filename>, is available
for the second half of the mirror. The submirrors are <filename>d1</filename> and <filename>d2</filename>, respectively, and the mirror is <filename>d0</filename>. </para><caution><para>Be sure to create a one-way mirror with the <command>metainit</command> command
then attach the additional submirrors with the <command>metattach</command> command.
When the <command>metattach</command> command is not used, no resynchronization
operations occur. As a result, data could become corrupted when Solaris Volume Manager assumes
that both sides of the mirror are identical and can be used interchangeably. </para>
</caution>
</tasksummary><taskprerequisites><para>Check <olink targetptr="addtasks-20933" remap="internal">Prerequisites for Creating Solaris
Volume Manager Components</olink> and <olink targetptr="eyaso" remap="internal">Creating and
Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step><para>Identify the slice that contains the existing root (<filename>/</filename>)
file system to be mirrored. This example uses the slice <filename>c1t0d0s0</filename>.</para>
</step><step><para>Create a new RAID-0 volume on the slice from the previous step
by using one of the following methods. Only the single slice can be included
in the RAID-0 volume.</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action&rArr;Create
Volume. Follow the onscreen instructions . For more information, see the online
help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit</command> command:</para><screen># <userinput>metainit -f  <replaceable>volume-name</replaceable> <replaceable>number-of-stripes</replaceable> <replaceable>components-per-stripe</replaceable> <replaceable>component-name</replaceable></userinput></screen><variablelist><varlistentry><term><option>f</option></term><listitem><para>Forces the command to continue. You must use this option when
the slice contains a mounted file system.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the volume to create. For information
on naming volumes, see <olink targetptr="basics-34" remap="internal">Volume Names</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>number-of-stripes</replaceable></term><listitem><para>Specifies the number of stripes to create.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>components-per-stripe</replaceable></term><listitem><para>Specifies the number of components each stripe should have.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>component-names</replaceable></term><listitem><para>Specifies the names of the components that are used. This
example uses the root slice, <filename>c0t0d0s0</filename>.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</itemizedlist>
</step><step><para>Create a second RAID-0 volume on an unused slice (<filename>c1t1d0s0</filename> in
this example) to act as the second submirror. The secondary submirror must
be the same size as the original submirror, or larger. Use one of the following
methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action->Create
Volume and follow the instructions on screen. For more information, see the
online help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit </command> command.</para><screen># <userinput>metainit <replaceable>volume-name</replaceable> <replaceable>number-of-stripes</replaceable> <replaceable>components-per-stripe</replaceable> <replaceable>component-name</replaceable></userinput></screen><note><para>See Step 2 for and explanation of the options.</para>
</note>
</listitem>
</itemizedlist>
</step><step><para>Create a one-way mirror by using one of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action&rArr;Create
Volume. Follow the onscreen instructions . For more information, see the online
help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit </command> command.</para><screen># <userinput>metainit <replaceable>volume-name</replaceable> -m <replaceable>submirror-name</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the volume to create.</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option></term><listitem><para>Specifies to create a mirror.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror-name</replaceable></term><listitem><para>Specifies the name of the component that will be the first
submirror in the mirror. In this example, it is the RAID-0 volume that contains
the root slice.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</itemizedlist>
</step><step><para>Remount your newly mirrored file system. Run the <command>metaroot <replaceable>volume-name</replaceable></command> command, replacing <replaceable>volume-name</replaceable> with
the name of the mirror you have created. Then, reboot your system.</para><screen># <userinput>metaroot <replaceable>volume-name</replaceable></userinput>
# <userinput>reboot</userinput></screen><para>For more information, see the <olink targetdoc="refman1m" targetptr="metaroot-1m" remap="external"><citerefentry><refentrytitle>metaroot</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step><para>Use the following form of the <command>metattach</command> command
to attach the second submirror. </para><screen># <userinput>metattach <replaceable>volume-name</replaceable> <replaceable>submirror-name</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the RAID-1 volume on which to add the
submirror</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror-name</replaceable></term><listitem><para>Specifies the name of the component that will be the second
submirror attached to the mirror</para>
</listitem>
</varlistentry>
</variablelist><para>See the <olink targetdoc="refman1m" targetptr="metattach-1m" remap="external"><citerefentry><refentrytitle>metattach</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page for more information.</para>
</step><step><para>Record the alternate boot path.</para><substeps><step><para>Determine the path to the alternate root device. Use the <command>ls <option>l</option></command> command on the slice that is being attached as the second
submirror to the root (<filename>/</filename>) file system mirror.</para><screen># <userinput>ls -l /dev/dsk/c1t1d0s0</userinput>
lrwxrwxrwx 1  root root  55 Mar 5 12:54  /dev/rdsk/c1t1d0s0 -> \ 
../../devices/sbus@1,f8000000/esp@1,200000/sd@3,0:a</screen>
</step><step><para>Record the string that follows the <filename>/devices</filename> directory: <filename>/sbus@1,f8000000/esp@1,200000/sd@3,0:a</filename>.</para><note><para>Because the system might not be available, this information should
also be written down somewhere other than on the system. See <olink targetptr="troubleshoottasks-29" remap="internal">Recovering From Boot Problems</olink> for
details on booting from the alternate boot device.</para>
</note>
</step><step><para>Edit the string to change the major name (<literal>sd</literal>,
in this case) to <literal>disk</literal>, resulting in <literal>/sbus@1,f8000000/esp@1,200000/disk@3,0:a</literal>. If the system uses an IDE bus, the original full path might look
like </para><screen>$ <userinput>ls -l /dev/dsk/c1t1d0s0</userinput> 
lrwxrwxrwx 1 root root 38 Mar 13 15:03 /dev/dsk/c0t0d0s0 -> \
../../devices/pci@1f,0/ide@d/dad@0,0:a</screen><para>After changing the major name <literal>dad</literal> to <literal>disk</literal>,
you would have <literal>/pci@1f,0/ide@d/disk@0,0:a</literal></para>
</step><step><para>Use the <trademark>OpenBoot</trademark> PROM <command>nvalias</command> command
to define a &ldquo;backup root&rdquo; device alias for the secondary root
(<filename>/</filename>) file system mirror. For example:</para><screen>ok  <userinput>nvalias backup_root /sbus@1,f8000000/esp@1,200000/disk@3,0:a</userinput></screen>
</step><step><para>Redefine the <literal>boot-device</literal> alias to reference
both the primary and secondary submirrors, in the order in which you want
them to be used, and store the configuration.</para><screen>ok <userinput>printenv boot-device</userinput>
boot-device =         disk net
ok <userinput>setenv boot-device disk backup_root net</userinput>
boot-device =         disk backup_root net
ok <userinput>nvstore</userinput></screen>
</step>
</substeps><note><para>In the event that the primary submirror fails, the system would
automatically boot to the second submirror. Or, if you boot manually, rather
than using autoboot, you would enter:</para><screen>ok <userinput>boot backup_root</userinput></screen>
</note>
</step>
</procedure><example id="egjxm"><title>SPARC: Creating a Mirror From the root (<filename>/</filename>) File
System</title><screen># <userinput>metainit -f d1 1 1 c0t0d0s0</userinput>
d1: Concat/Stripe is setup
# <userinput>metainit d2 1 1 c0t1d0s0</userinput>
d2: Concat/Stripe is setup
# <userinput>metainit d0 -m d1</userinput>
d0: Mirror is setup
# <userinput>metaroot d0</userinput>
# <userinput>lockfs -fa</userinput>
# <userinput>reboot</userinput>
...
# <userinput>metattach d0 d2</userinput>
d0: Submirror d2 is attached
# <userinput>ls -l /dev/dsk/c0t1d0s0</userinput>
lrwxrwxrwx   1 root     root          88 Feb  8 15:51 /dev/rdsk/c1t3d0s0 ->
../../devices/pci@1f,0/pci@1,1/ide@3/dad@0,0:a
# <userinput>init 0</userinput>
.
.
.
ok <userinput>nvalias backup_root /pci@1f,0/pci@1,1/ide@3/disk@0,0:a</userinput>
ok <userinput>setenv boot-device disk backup_root net</userinput>
ok <userinput>nvstore</userinput></screen><para>In this example, the <option>f</option> option forces the creation of
the first RAID-0 volume, <filename>d1</filename>, which contains the mounted
root (<filename>/</filename>) file system on <filename>/dev/dsk/c0t0d0s0</filename>.
The second concatenation, <filename>d2</filename>, is created from <filename>/dev/dsk/c0t1d0s0</filename>. This slice must be the same size as, or larger than the size
of <filename>d1</filename>. The <command>metainit</command> command with the <option>m</option> option creates the one-way mirror <filename>d0</filename> using
the concatenation that contains root (<filename>/</filename>). </para><para>Next, the <command>metaroot</command> command edits the <filename>/etc/vfstab</filename> and <filename>/etc/system</filename> files so that the system
can be booted with the root (<filename>/</filename>) file system on a volume.
It is a good idea to run the <command>lockfs <option>fa</option></command> command
before rebooting. For more information, see the <olink targetdoc="refman1m" targetptr="lockfs-1m" remap="external"><citerefentry><refentrytitle>lockfs</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para><para>Do not attach the second submirror before the system is rebooted. You
must reboot after running the <command>metaroot</command> command and before
attaching the second submirror.</para><para>After a reboot, the submirror <filename>d2</filename> is attached to
the mirror, causing a mirror resynchronization. The system confirms that the
concatenations and the mirror are set up, and that submirror <filename>d2</filename> is
attached.</para><para>The <command>ls <option>l</option></command> command is run on the root
raw device to determine the path to the alternate root device in case the
system might later need to be booted from it.</para>
</example>
</task><task id="gcsdr" arch="x86"><title>How to Create a RAID-1 Volume From the root (<filename>/</filename>) File System</title><tasksummary><para>The process for mirroring the root (<filename>/</filename>) file system
on an x86 based system is similar to mirroring root on a SPARC system.
However, on x86 based systems, the BIOS and <filename>fdisk</filename> partitioning
add an additional layer of complexity.</para><para>In the example used in the procedures, the existing slice is <filename>c1t0d0s0</filename>. The second slice, <filename>c1t1d0s0</filename>, is available
for the second half of the mirror. The submirrors are <filename>d1</filename> and <filename>d2</filename>, respectively, and the mirror is <filename>d0</filename>.</para>
</tasksummary><taskprerequisites><para>Before implementing any of the procedures, check <olink targetptr="addtasks-20933" remap="internal">Prerequisites for Creating Solaris Volume Manager
Components</olink> and <olink targetptr="eyaso" remap="internal">Creating and Maintaining RAID-1
Volumes</olink>.</para>
</taskprerequisites><procedure><step><para>Verify that the ordering for the BIOS boot device can be configured
to allow the system to boot off of the second disk in the mirror.</para><para>Before
the kernel is started, the system is controlled by the read-only-memory (ROM)
Basic Input/Output System (BIOS), which is the firmware interface on an x86 based
system. The BIOS is analogous to the boot PROM on a SPARC based system.
Some of the BIOS's tasks are as follows:</para><itemizedlist><listitem><para>Perform startup functions.</para>
</listitem><listitem><para>Detect the correct device from which to boot the system.</para>
</listitem><listitem><para>Load the master boot record from that device to allow the
system to self-boot.</para>
</listitem>
</itemizedlist><para>You can usually configure the BIOS to select the order of devices to
probe for the boot record. Additionally, most modern BIOS implementations
allow you to configure your devices so that the failover to the secondary
submirror is automatic. If your system's BIOS does not have this feature and
the primary submirror fails, you need to access the BIOS during system boot
to reconfigure the system to boot from the secondary root slice. Consult the
user's guide for your BIOS for instructions on how to configure settings in
your BIOS</para><para>Before setting up a root mirror, check the BIOS on your
system to verify that you can boot off of more than one disk. Some device
drivers are configured to only see one disk on the system.</para>
</step><step><para>Verify that the <literal>fdisk</literal> partitions are configured
to support root mirroring.</para><para>The existence of a separate x86 boot
partition presents a problem when mirroring the root (<filename>/</filename>)
file system. Because it exists outside of the Solaris <filename>fdisk</filename> partition,
the x86 boot partition cannot be mirrored by Solaris Volume Manager. Additionally,
because only one copy of the x86 boot partition exists, it represents a
single point of failure.</para><para>The GRUB-based installation program of
the Solaris 10 1/06 software and subsequent releases no longer automatically
creates an x86 boot partition. However, if the x86 already exists in the
system, the installation program preserves that partition by default.</para><para>To determine if your system has a separate x86 boot partition, check
the <filename>/etc/vfstab</filename> file. The x86 boot partition exists
if the file contains an entry similar to the following:</para><screen>/dev/dsk/c2t1d0p0:boot  -       /boot   pcfs    -       no      -</screen><para>To use the Solaris Volume Manager to mirror the root (<filename>/</filename>)
file system, the file system must use the single Solaris <literal>fdisk</literal> partition.
Therefore, if the x86 boot partition already exists in the system, delete
this partition with the <command>fdisk</command> command and then reinstall
the Solaris software. When you reinstall, the boot partition is no longer
recreated.</para><note><para>Solaris Volume Manager can only mirror slices within the Solaris <literal>fdisk</literal> partition If you have multiple <filename>fdisk</filename> partitions,
you need to use another approach to protect the data outside of the Solaris <literal>fdisk</literal> partition.</para>
</note>
</step><step><para>Make the secondary submirror bootable with a master boot program.</para><substeps><step><para>Specify the master boot program.</para><screen># <userinput>fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c1t1d0p0</userinput></screen><para>The following screen appears:</para><screen>             Total disk size is 31035 cylinders
             Cylinder size is 1146 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1        Active   Solaris           1  31034    31034    100


SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Enter Selection: </screen>
</step><step><para>Choose number 5 from the menu, and press return.</para>
</step>
</substeps>
</step><step><para>Make the secondary disk bootable.</para><screen># <userinput>/sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0</userinput></screen><para>For more information about <command>installgrub,</command> refer to
the <olink targetdoc="refman1m" targetptr="installgrub-1m" remap="external"><citerefentry><refentrytitle>installgrub</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step><para>Identify the slice that contains the existing root (<filename>/</filename>)
file system to be mirrored.</para><para>This example uses the slice <filename>c1t0d0s0</filename>.</para>
</step><step><para>Create a new RAID-0 volume on the slice from the previous step.</para><para>Only the single slice can be included in the RAID-0 volume. Use one
of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action&rArr;Create
Volume. Follow the onscreen instructions. For more information, see the online
help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit</command> command:</para><screen># <userinput>metainit -f <replaceable>volume-name</replaceable> <replaceable>number-of-stripes</replaceable> <replaceable>components-per-stripe</replaceable> <replaceable>component-name</replaceable></userinput></screen><variablelist><varlistentry><term><option>f</option></term><listitem><para>Forces the command to continue. You must use this option when
the slice contains a mounted file system.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the volume to create. For information
on naming volumes, see <olink targetptr="basics-34" remap="internal">Volume Names</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>number-of-stripes</replaceable></term><listitem><para>Specifies the number of stripes to create.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>components-per-stripe</replaceable></term><listitem><para>Specifies the number of components each stripe should have.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>component-names</replaceable></term><listitem><para>Specifies the names of the components that are used. This
example uses the root slice, <filename>c0t0d0s0</filename>.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</itemizedlist>
</step><step><para>Create a second RAID-0 volume (<literal>c1t1d0s0</literal> in
this example) on an unused slice to act as the second submirror.</para><note><para>The secondary submirror must be the same size as the original
submirror, or larger. Also, the slice you use as the second submirror must
have a slice tag of &ldquo;root&rdquo; and the root slice must be slice 0.</para><para>For information on configuring the slice tag field, see the <olink targetdoc="refman1m" targetptr="format-1m" remap="external"><citerefentry><refentrytitle>format</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</note><para>Use either of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action->Create
Volume and follow the instructions on screen. For more information, see the
online help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit </command> command.</para><screen># <userinput>metainit <replaceable>volume-name</replaceable> <replaceable>number-of-stripes</replaceable> <replaceable>components-per-stripes</replaceable> <replaceable>component-names</replaceable></userinput></screen><note><para>See Step 6 for an explanation of the options.</para>
</note>
</listitem>
</itemizedlist>
</step><step><para>Create a one-way mirror by using one of the following methods:</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action&rArr;Create
Volume. Follow the onscreen instructions. For more information, see the online
help.</para>
</listitem><listitem><para>Use the following form of the <command>metainit</command> command.</para><screen># <userinput>metainit <replaceable>volume-name</replaceable> -m <replaceable>submirror-name</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the volume to create.</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option></term><listitem><para>Specifies to create a mirror.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror-name</replaceable></term><listitem><para>Specifies the name of the component that will be the first
submirror in the mirror. In this example, it is the RAID-0 volume that contains
the root slice.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</itemizedlist>
</step><step><para>Remount your newly mirrored file system, then reboot the system.</para><screen># <userinput>metaroot <replaceable>volume-name</replaceable></userinput>
# <userinput>reboot</userinput></screen><para>For more information, see the <olink targetdoc="refman1m" targetptr="metaroot-1m" remap="external"><citerefentry><refentrytitle>metaroot</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step><para>Attach the second submirror. </para><screen># <userinput>metattach <replaceable>volume-name</replaceable> <replaceable>submirror-name</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the RAID-1 volume on which to add the
submirror.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror-name</replaceable></term><listitem><para>Specifies the name of the component that will be the second
submirror attached to the mirror.</para>
</listitem>
</varlistentry>
</variablelist><para>See the <olink targetdoc="refman1m" targetptr="metattach-1m" remap="external"><citerefentry><refentrytitle>metattach</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page for more information.</para>
</step><step><para>Define the alternative boot path in the <filename>menu.lst</filename> file.</para><para>To enable the system to boot off of the disk that holds the secondary
submirror, configure the system to see the disk as the alternate boot device.
In the current example, <literal>c1t1d0s0</literal>, the alternative path
is on the first slice of the first fdisk partition on the second disk. Thus,
you would edit the <filename>menu.lst</filename> with the following entry:</para><screen>title alternate boot
 root (hd1,0,a)
 kernel /boot/multiboot
 module /boot/x86.miniroot-safe</screen><note><para>To properly edit entries in <filename>menu.lst,</filename> you
must be familiar with disk-naming conventions in GRUB. For details, see <olink targetdoc="sysadv1" targetptr="hbx86boot-68676" remap="external">Chapter 11, <citetitle remap="chapter">GRUB Based Booting (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink></para>
</note><para>After you have completed editing the <filename>menu.lst</filename> file,
the system is set to failover to the second disk. If the primary disk fails,
disk numbering changes so that the system boots from the secondary disk.</para><caution><para>On certain cases, the automatic disk-renumbering feature of
the BIOS might affect recovery from an unavailable primary disk. When disk
renumbering forces the system to boot from the secondary disk, the primary
disk's boot archive becomes stale. If the same primary disk becomes available
later and you boot the system, the disk numbering switches again to use the
default primary disk for the system boot. However, at this stage, the primary
disk's boot archive remains stale. Consequently, the system might not boot
at all. Therefore make sure that in such cases, you select the correct entry
from the GRUB menu to boot the system from the valid boot archive. After the
system completes the boot up process, perform the normal <command>metadevice</command> maintenance
which synchronizes both primary and secondary disks and restores the valid
boot archive to the primary disk.</para>
</caution>
</step>
</procedure>
</task><sect2 id="fryix"><title>Understanding Boot Time Warnings When Mirroring the
root (<filename>/</filename>) File System</title><para>After you mirror your root (<filename>/</filename>) file system, error
messages will be displayed in the console and logged in the system log that
is defined in the <filename>/etc/syslog.conf</filename> file. These error
messages do not indicate a problem. These messages are displayed for each
device type that you are not currently using, because an unused module cannot
be force loaded. The error messages are similar to the following:</para><screen>Jul 13 10:17:42 ifr genunix: [ID 370176 kern.warning] WARNING: forceload of 
    misc/md_trans failed
Jul 13 10:17:42 ifr genunix: [ID 370176 kern.warning] WARNING: forceload of 
    misc/md_raid failed
Jul 13 10:17:42 ifr genunix: [ID 370176 kern.warning] WARNING: forceload of 
    misc/md_hotspares failed</screen><para>You can safely disregard these error messages. </para>
</sect2>
</sect1><sect1 id="tasks-mirrors-23"><title>Working With Submirrors</title><task id="tasks-mirrors-8"><title>How to Attach a Submirror</title><tasksummary><note><para>An error message stating &ldquo;<literal>can't attach labeled
submirror to an unlabeled mirror</literal>&rdquo; indicates that you unsuccessfully
attempted to attach a RAID-0 volume to a mirror. A labeled volume (submirror)
is a volume whose first component starts at cylinder 0, while an unlabeled
volume's first component starts at cylinder 1. To prevent the labeled submirror's
label from being corrupted, Solaris Volume Manager does not allow labeled submirrors
to be attached to unlabeled mirrors.</para>
</note>
</tasksummary><taskprerequisites><para>Read <olink targetptr="eyaso" remap="internal">Creating and Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-76"><para>Identify the component (concatenation
or stripe) to be used as a submirror. </para><para>The component must be the
same size as, or larger than the existing submirror in the mirror. If you
have not yet created a volume to be a submirror, see <olink targetptr="tasks-metadevices-20" remap="internal">Creating RAID-0 (Stripe) Volumes</olink> or <olink targetptr="tasks-metadevices-25" remap="internal">Creating RAID-0 (Concatenation) Volumes</olink>.</para>
</step><step id="tasks-mirrors-step-141"><para>Make sure that you have root privilege
and that you have a current backup of all data.</para>
</step><step><para>Verify that the status of the mirror you want to work with is
in an &ldquo;Okay&rdquo; state using the <command>metastat</command> command.</para><screen># <userinput>metastat <replaceable>mirror</replaceable></userinput></screen>
</step><step id="tasks-mirrors-step-78"><para>Use one of the following methods to
attach a submirror. </para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror.
Then, choose Action&rArr;Properties and click the Submirror tab. Follow the
onscreen instructions. For more information, see the online help.</para>
</listitem><listitem><para>Use the <command>metattach <replaceable>mirror</replaceable> <replaceable>submirror</replaceable></command> command.</para><screen># <userinput>metattach <replaceable>mirror</replaceable> <replaceable>submirror</replaceable></userinput></screen>
</listitem>
</itemizedlist><para>See the <olink targetdoc="refman1m" targetptr="metattach-1m" remap="external"><citerefentry><refentrytitle>metattach</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page for more information.</para>
</step><step><para>View the status of the mirror using the <command>metastat</command> command.</para><screen># <userinput>metastat <replaceable>mirror</replaceable></userinput></screen>
</step>
</procedure><example id="egjxs"><title>Attaching a Submirror</title><screen># <userinput>metastat d30</userinput>
d30: mirror
    Submirror 0: d60
      State: Okay   
...
# <userinput>metattach d30 d70</userinput>
d30: submirror d70 is attached
# <userinput>metastat d30</userinput>
d30: mirror
    Submirror 0: d60
      State: Okay        
    Submirror 1: d70
      State: Resyncing
    Resync in progress: 41 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 2006130 blocks
...</screen><para>This example shows the attaching of a submirror, <filename>d70</filename>,
to a one-way mirror, <filename>d30</filename>. You create a two-way mirror
when your attach the submirror to the mirror. The mirror <filename>d30</filename> initially
consists of submirror <filename>d60</filename>. The submirror <filename>d70</filename> is
a RAID-0 volume. You verify that the status of the mirror is &ldquo;Okay&rdquo;
with the <command>metastat</command> command, then attach the submirror. When
the <command>metattach</command> command is run, the new submirror is resynchronized
with the existing mirror. When you attach an additional submirror to the mirror,
the system displays a message. To verify that the mirror is resynchronizing,
use the <command>metastat</command> command.  </para>
</example>
</task><task id="tasks-mirrors-10"><title>How to Detach a Submirror</title><taskprerequisites><para>Read <olink targetptr="eyaso" remap="internal">Creating and Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-142"><para>Make sure that you have root privilege.
Make sure that you have a current backup of all data.</para>
</step><step><para>Verify that the status of the mirror you want to work with is
in an &ldquo;Okay&rdquo; state using the <command>metastat</command> command.</para>
</step><step id="tasks-mirrors-step-82"><para>Use one of the following methods to
detach a submirror. </para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror.
Then, choose Action&rArr;Properties and click the Submirror tab. Follow the
onscreen instructions. For more information, see the online help.</para>
</listitem><listitem><para>Use the <command>metadetach</command> command to detach a
submirror from a mirror. </para><screen># <userinput>metadetach <replaceable>mirror</replaceable> <replaceable>submirror</replaceable></userinput></screen><para>See the <olink targetdoc="refman1m" targetptr="metadetach-1m" remap="external"><citerefentry><refentrytitle>metadetach</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page for more information.</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjxr"><title>Detaching a Submirror</title><screen># <userinput>metastat</userinput>
d5: mirror
    Submirror 0: d50
...
# <userinput>metadetach d5 d50</userinput>
d5: submirror d50 is detached</screen><para>In this example, mirror <filename>d5</filename> has a submirror, <filename>d50</filename>. You detach the submirror with the <command>metadetach</command> command.
The underlying slices from <filename>d50</filename> can be reused elsewhere.
After the submirror is detached from the mirror, the system displays a confirmation
message.</para>
</example>
</task><task id="tasks-mirrors-12"><title>How to Place a Submirror Offline and Online</title><tasksummary><para>The <command>metaonline</command> command can only be used when a submirror
was taken offline by the <command>metaoffline</command> command. After the <command>metaonline</command> command runs, Solaris Volume Manager automatically begins resynchronizing
the submirror with the mirror. </para><note><para>The <command>metaoffline</command> command's capabilities are
similar to the capabilities offered by the <command>metadetach</command> command.
However, the <command>metaoffline</command> command does not sever the logical
association between the submirror and the mirror.</para>
</note>
</tasksummary><taskprerequisites><para>Read <olink targetptr="eyaso" remap="internal">Creating and Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-143"><para>Make sure that you have root privilege
and that you have a current backup of all data.</para>
</step><step id="tasks-mirrors-step-85"><para>Use one of the following methods to
place a submirror online or offline.</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror.
Then, choose Action&rArr;Properties and click the Submirror tab. Follow the
onscreen instructions . For more information, see the online help.</para>
</listitem><listitem><para>Use the <command>metaoffline</command> command to a submirror
offline.</para><screen># <userinput>metaoffline <replaceable>mirror</replaceable> <replaceable>submirror</replaceable></userinput></screen><para>See the <olink targetdoc="refman1m" targetptr="metaoffline-1m" remap="external"><citerefentry><refentrytitle>metaoffline</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page for more information.</para>
</listitem><listitem><para>Use the <command>metaonline</command> command to place a submirror
online. </para><screen># <userinput>metaonline <replaceable>mirror</replaceable> <replaceable>submirror</replaceable></userinput></screen><para>See the <olink targetdoc="refman1m" targetptr="metaonline-1m" remap="external"><citerefentry><refentrytitle>metaonline</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page for more information.</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjye"><title>Placing a Submirror Offline</title><screen># <userinput>metaoffline d10 d11</userinput>
d10: submirror d11 is offlined</screen><para>In this example, submirror <filename>d11</filename> is taken offline
from mirror <filename>d10</filename>. Reads continue to be made from the other
submirror. The mirror is out of sync as soon as the first write is made. This
inconsistency is corrected when the offlined submirror is brought back online. </para>
</example><example id="egjyx"><title>Placing a Submirror Online</title><screen># <userinput>metaonline d10 d11</userinput>d10: submirror d11 is onlined</screen><para>In this example, submirror <filename>d11</filename> is brought back
online in mirror <filename>d10</filename>.</para>
</example>
</task><task id="maintaintasksnew-14061"><title>How to Enable a Slice in a Submirror</title><taskprerequisites><para>Read <olink targetptr="replace-enable-1" remap="internal">Overview of Replacing and Enabling
Components in RAID-1 and RAID-5 Volumes</olink> and <olink targetptr="eyaso" remap="internal">Creating
and Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-144"><para>Make sure that you have root privilege
and that you have a current backup of all data.</para>
</step><step id="tasks-mirrors-step-89"><para>Use one of the following methods to
enable a slice in a submirror.</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror.
Then, choose Action&rArr;Properties and click the Submirror tab. Follow the
onscreen instructions. For more information, see the online help.</para>
</listitem><listitem><para>Use the <command>metareplace</command> command to enable a
failed slice in a submirror. </para><screen># <userinput>metareplace -e <replaceable>mirror</replaceable> <replaceable>failed-slice</replaceable></userinput> </screen><para>The <command>metareplace</command> command automatically starts
a resynchronization to  synchronize the repaired or replaced slice with the
rest of the mirror. </para><para>See the <olink targetdoc="refman1m" targetptr="metareplace-1m" remap="external"><citerefentry><refentrytitle>metareplace</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page for more information.</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjyv"><title>Enabling a Slice in a Submirror</title><screen># <userinput>metareplace -e d11 c1t4d0s7</userinput>
d11: device c1t4d0s7 is enabled</screen><para>In this example, the mirror <filename>d11</filename> has a submirror
that contains slice, <filename>c1t4d0s7</filename>, which had a soft error.
The <command>metareplace</command> command with the <option>e</option> option
enables the failed slice. </para><para>If a physical disk is defective, you can replace it with another
available disk (and its slices) on the system as documented in <olink targetptr="maintaintasksnew-11508" remap="internal">How to Replace a Slice in a Submirror</olink>.
Alternatively, you can repair or replace the disk, format it, and then run
the <command>metareplace</command> command with the <option>e</option> option
as shown in this example. </para>
</example>
</task>
</sect1><sect1 id="tasks-mirrors-24"><title>Maintaining RAID-1 Volumes</title><task id="maintaintasksnew-34973"><title>How to View the Status of Mirrors
and Submirrors</title><taskprerequisites><para>For an overview of the status information associated with RAID-1 volumes
and submirrors, see <olink targetptr="eyhxl" remap="internal">Understanding Submirror Status
to Determine Maintenance Actions</olink>.</para>
</taskprerequisites><procedure remap="single-step"><step id="tasks-mirrors-step-91"><para>Use one of the following methods to
the check mirror or submirror status. </para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror.
Then, choose Action&rArr;Properties. Follow the onscreen instructions. For
more information, see the online help.</para>
</listitem><listitem><para>Run the <command>metastat</command> command on the mirror
to view the status of each submirror.</para><screen># <userinput>metastat <replaceable>mirror</replaceable></userinput></screen><para>See <olink targetptr="tasks-mirrors-15" remap="internal">How to Change RAID-1 Volume
Options</olink> to change a mirror's pass number, read option, or write option.</para><para>See <olink targetdoc="refman1m" targetptr="metastat-1m" remap="external"><citerefentry><refentrytitle>metastat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> for
more information about checking device status.</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjyu"><title>Checking Status of RAID-1 Volumes</title><para>Here is sample output from the <command>metastat</command> command.
Use <command>metastat</command> command without a mirror name to display all
the status of all mirrors.</para><screen># <userinput>metastat</userinput>d70: Mirror
    Submirror 0: d71
      State: Okay         
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 12593637 blocks

d71: Submirror of d70
    State: Okay         
    Size: 12593637 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Reloc  Hot Spare
        c1t3d0s3                   0     No    Okay         Yes    
    Stripe 1:
        Device              Start Block  Dbase State        Reloc  Hot Spare
        c1t3d0s4                   0     No    Okay         Yes    
    Stripe 2:
        Device              Start Block  Dbase State        Reloc  Hot Spare
        c1t3d0s5                   0     No    Okay         Yes    
d0: Mirror
    Submirror 0: d1
      State: Okay        
    Submirror 1: d2
      State: Okay        
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 5600 blocks
 
d1: Submirror of d0
    State: Okay        
    Size: 5600 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c0t2d0s7                   0     No    Okay        
 
...</screen><para>Use the <command>metastat</command> command with a mirror name argument
to display output for a specific mirror.</para><screen><userinput>metastat d70</userinput>
d70: Mirror
    Submirror 0: d71
      State: Okay         
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 12593637 blocks

d71: Submirror of d70
    State: Okay         
    Size: 12593637 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Reloc  Hot Spare
        c1t3d0s3                   0     No    Okay         Yes    
    Stripe 1:
        Device              Start Block  Dbase State        Reloc  Hot Spare
        c1t3d0s4                   0     No    Okay         Yes    
    Stripe 2:
        Device              Start Block  Dbase State        Reloc  Hot Spare
        c1t3d0s5                   0     No    Okay         Yes    </screen><para>For each submirror in the mirror, the <command>metastat</command> command
shows the status, an &ldquo;invoke&rdquo; line if there is an error, the assigned
hot spare pool (if any), the size in blocks, and information about each slice
in the submirror.</para>
</example>
</task><task id="tasks-mirrors-15"><title>How to Change RAID-1 Volume Options</title><taskprerequisites><para>Check <olink targetptr="about-metadevices-13" remap="internal">About RAID-1 Volume Options</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-145"><para>Make sure that you have root privilege
and that you have a current backup of all data.</para>
</step><step id="tasks-mirrors-step-95"><para>Use one of the following methods to
change the RAID-1 options. </para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror.
Then, choose Action&rArr;Properties. Follow the onscreen instructions. For
more information, see the online help.</para>
</listitem><listitem><para>Use the <command>metaparam</command> command to display and
change a mirror's options.</para><screen># <userinput>metaparam [<replaceable>mirror options</replaceable>] <replaceable>mirror</replaceable></userinput></screen><para>See <olink targetptr="about-metadevices-13" remap="internal">About RAID-1 Volume Options</olink> for
a description of mirror options. Also, see the <olink targetdoc="refman1m" targetptr="metaparam-1m" remap="external"><citerefentry><refentrytitle>metaparam</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjyj"><title>Changing a RAID-1 Volume's Read Policy</title><screen># <userinput>metaparam -r geometric d30</userinput>
# <userinput>metaparam d30</userinput>
d30: mirror current parameters are:
    Pass: 1
    Read option: geometric (-g)
    Write option: parallel (default)</screen><para>In this example, the <option>r</option> option changes a mirror's
read policy to <literal>geometric</literal>. </para>
</example><example id="egjyy"><title>Changing a RAID-1 Volume's Write Policy</title><screen># <userinput>metaparam -w serial d40</userinput>
# <userinput>metaparam d40</userinput>
d40: mirror current parameters are:
    Pass: 1
    Read option: roundrobin (default)
    Write option: serial (-S)</screen><para>In this example, the <option>w</option> option changes a mirror's write
policy to <literal>serial</literal>.</para>
</example><example id="egjyr"><title>Changing a RAID-1 Volume's Pass Number</title><screen># <userinput>metaparam -p 5 d50</userinput>
# <userinput>metaparam d50</userinput>
d50: mirror current parameters are:
    Pass: 5
    Read option: roundrobin (default)
    Write option: parallel (default)</screen><para>In this example, the <option>p</option> option changes a mirror's
pass number to <literal>5</literal>. </para>
</example>
</task><task id="maintaintasksnew-15601"><title>How to Expand a RAID-1 Volume</title><taskprerequisites><para>Read <olink targetptr="eyaso" remap="internal">Creating and Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-146"><para>Make sure that you have root privilege
and that you have a current backup of all data.</para>
</step><step id="tasks-mirrors-step-98"><para>Use one of the following methods to
expand a mirror. </para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror.
Then, choose Action->Properties and click the Submirror tab. Follow the onscreen
instructions. For more information, see the online help.</para>
</listitem><listitem><para>Use the <command>metattach</command> command to attach additional
slices to each submirror.</para><screen># <userinput>metattach <replaceable>submirror</replaceable> <replaceable>slice</replaceable></userinput></screen><para>Each submirror in a mirror must be expanded. See the <olink targetdoc="refman1m" targetptr="metattach-1m" remap="external"><citerefentry><refentrytitle>metattach</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page
for more information.</para>
</listitem>
</itemizedlist>
</step><step><para>Use the <command>metattach</command> command to cause the mirror
to recompute its size based on the size of the submirror.</para><screen># <userinput>metattach <replaceable>mirror</replaceable></userinput></screen>
</step>
</procedure><example id="egjxw"><title>Expanding a Two-Way Mirror That Contains a Mounted File System</title><screen># <userinput>metastat</userinput>
d8: Mirror
    Submirror 0: d9
      State: Okay        
    Submirror 1: d10
      State: Okay        
...
# <userinput>metattach</userinput> <userinput>d9 c0t2d0s5</userinput>
d9: component is attached
# <userinput>metattach</userinput> <userinput>d10 c0t3d0s5</userinput>
d10: component is attached
# <userinput>metattach d8</userinput></screen><para>This example shows how to expand a mirrored, mounted file system
by concatenating two disk drives to the mirror's two submirrors. The mirror
is named <filename>d8</filename> and contains two submirrors named <filename>d9</filename> and <filename>d10</filename>.  </para>
</example><taskrelated role="see-also"><para>For a UFS, run the <olink targetdoc="refman1m" targetptr="growfs-1m" remap="external"><citerefentry><refentrytitle>growfs</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> command
on the mirror volume. See <olink targetptr="tasks-metadevices-7" remap="internal">How to Expand
a File System</olink>.</para><para>An application, such as a database, that uses the raw volume must have
its own way of expanding the added storage.</para>
</taskrelated>
</task><task id="fpklu"><title>How to Cancel a Volume Resynchronization
Process</title><procedure>&rolepastep;<step><para>Use the <command>metastat</command> command to view the status
of the RAID-1 volume and associated submirrors.</para><screen># <userinput>metastat <replaceable>mirror-name</replaceable></userinput></screen><para>or</para><screen><userinput>metastat -a</userinput></screen>
</step><step><para>Use the <command>metasync <option>c</option> <replaceable>volume</replaceable></command> command
to cancel the resynchronization process.</para>
</step>
</procedure><example id="fpkln"><title>Canceling a Volume Resynchronization Process</title><para>The following example illustrates how to cancel the resynchronization
process on a volume that is part of the disk set <filename>blue</filename>.
Notice that the submirrors are in the &ldquo;Resync cancelled&rdquo; state
after running the <command>metasync</command> command.</para><screen># <userinput>metastat -a</userinput>


blue/d10: Mirror
    Submirror 0: blue/d1
      State: Resyncing
    Submirror 1: blue/d2
      State: Okay
    Resync in progress: 0 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 10485760 blocks (5.0 GB)

blue/d1: Submirror of blue/d10
    State: Resyncing
    Size: 10485760 blocks (5.0 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc
 Hot Spare
        /dev/dsk/c3t50020F230000FA57d0s0          0     No            Okay   Yes




blue/d2: Submirror of blue/d10
    State: Okay
    Size: 10485760 blocks (5.0 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc
 Hot Spare
        /dev/dsk/c3t50020F230000FA57d0s1          0     No            Okay   Yes



Device Relocation Information:
Device                           Reloc  Device ID
/dev/dsk/c3t50020F230000FA57d0   Yes    id1,ssd@n60020f200000fa574033661f000c641
4

# <userinput>metasync -s blue -c d10</userinput>
Mar  1 12:46:18 SunSystem1 md_mirror: WARNING: md: blue/d10: Resync cancelled

# <userinput>metastat -a</userinput>


blue/d10: Mirror
    Submirror 0: blue/d1
      State: Resync cancelled
    Submirror 1: blue/d2
      State: Okay
    Resync cancelled: 3 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 10485760 blocks (5.0 GB)

blue/d1: Submirror of blue/d10
    State: Resync cancelled
    Invoke: metasync blue/d10
    Size: 10485760 blocks (5.0 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc
 Hot Spare
        /dev/dsk/c3t50020F230000FA57d0s0          0     No            Okay   Yes


blue/d2: Submirror of blue/d10
    State: Okay
    Size: 10485760 blocks (5.0 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc
 Hot Spare
        /dev/dsk/c3t50020F230000FA57d0s1          0     No            Okay   Yes



Device Relocation Information:
Device                           Reloc  Device ID
/dev/dsk/c3t50020F230000FA57d0   Yes    id1,ssd@n60020f200000fa574033661f000c641
4</screen>
</example>
</task><task id="fpkkx"><title>How to Resume a Volume Resynchronization Process</title><procedure>&rolepastep;<step><para>Use the <command>metastat</command> command to view the status
of the RAID-1 volume and associated submirrors.</para><screen># <userinput>metastat <replaceable>mirror-name</replaceable></userinput></screen><para>or</para><screen><userinput>metastat -a</userinput></screen>
</step><step><para>Use the <command>metasync <replaceable>volume</replaceable></command> command
to resume the resynchronization process.</para><screen># <userinput>metasync <replaceable>volume</replaceable></userinput></screen>
</step>
</procedure><example id="fpklo"><title>Resuming a Volume Resynchronization Process</title><para>The following example illustrates how to resume the resynchronization
process on a volume that is part of the disk set <filename>blue</filename>.
Notice that the submirrors are in the &ldquo;Resync cancelled&rdquo; state
before running the <command>metasync</command> command. Once the <command>metasync</command> command is issued, the resynchronization process resumes.</para><screen># <userinput>metastat -a</userinput>

blue/d10: Mirror
    Submirror 0: blue/d1
      State: Resync cancelled
    Submirror 1: blue/d2
      State: Okay
    Resync cancelled: 3 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 10485760 blocks (5.0 GB)

blue/d1: Submirror of blue/d10
    State: Resync cancelled
    Invoke: metasync blue/d10
    Size: 10485760 blocks (5.0 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc
 Hot Spare
        /dev/dsk/c3t50020F230000FA57d0s0          0     No            Okay   Yes


blue/d2: Submirror of blue/d10
    State: Okay
    Size: 10485760 blocks (5.0 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc
 Hot Spare
        /dev/dsk/c3t50020F230000FA57d0s1          0     No            Okay   Yes



Device Relocation Information:
Device                           Reloc  Device ID
/dev/dsk/c3t50020F230000FA57d0   Yes    id1,ssd@n60020f200000fa574033661f000c641
4

# <userinput>metasync -s blue d10</userinput>
# <userinput>metastat -a</userinput>


blue/d10: Mirror
    Submirror 0: blue/d1
      State: Resyncing
    Submirror 1: blue/d2
      State: Okay
    Resync in progress: 3 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 10485760 blocks (5.0 GB)

blue/d1: Submirror of blue/d10
    State: Resyncing
    Size: 10485760 blocks (5.0 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc
 Hot Spare
        /dev/dsk/c3t50020F230000FA57d0s0          0     No            Okay   Yes


blue/d2: Submirror of blue/d10
    State: Okay
    Size: 10485760 blocks (5.0 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc
 Hot Spare
        /dev/dsk/c3t50020F230000FA57d0s1          0     No            Okay   Yes



Device Relocation Information:
Device                           Reloc  Device ID
/dev/dsk/c3t50020F230000FA57d0   Yes    id1,ssd@n60020f200000fa574033661f000c641
4</screen>
</example>
</task>
</sect1><sect1 id="tasks-mirrors-25"><title>Responding to RAID-1 Volume Component
Failures</title><task id="maintaintasksnew-11508"><title>How to Replace a Slice in a Submirror</title><taskprerequisites><para>Read <olink targetptr="replace-enable-1" remap="internal">Overview of Replacing and Enabling
Components in RAID-1 and RAID-5 Volumes</olink> and <olink targetptr="eyaso" remap="internal">Creating
and Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-147"><para>Make sure that you have root privilege
and that you have a current backup of all data.</para>
</step><step><para>Use the <command>metastat</command> command to view the status
of the RAID-1 volume and associated submirrors.</para><screen># <userinput>metastat <replaceable>mirror-name</replaceable></userinput></screen>
</step><step id="tasks-mirrors-step-101"><para>Use one of the following methods to
replace a slice in a submirror. </para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror.
Then, choose Action&rArr;Properties and click the Submirror tab. Follow the
onscreen instructions. For more information, see the online help.</para>
</listitem><listitem><para>Use the following form of the <command>metareplace</command> command
to replace a slice in a submirror:</para><screen># <userinput>metareplace <replaceable>mirror-name</replaceable> <replaceable>component-name</replaceable></userinput></screen><itemizedlist><listitem><para><replaceable>mirror-name</replaceable> is the name of the
volume to create.</para>
</listitem><listitem><para><replaceable>component-name</replaceable> specifies the name
of the component to replace.</para>
</listitem>
</itemizedlist><variablelist><varlistentry><term><replaceable>mirror-name</replaceable></term><listitem><para>Specifies the name of the volume to create</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>component-name</replaceable></term><listitem><para>Specifies the name of the component to replace</para>
</listitem>
</varlistentry>
</variablelist><para>See the following examples and the <olink targetdoc="refman1m" targetptr="metainit-1m" remap="external"><citerefentry><refentrytitle>metainit</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page for more information.</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjxv"><title>Replacing a Failed Slice in a Mirror</title><para>The following example illustrates how to replace a failed slice when
the system is not configured to use hot spare pools for the automatic replacement
of failed disks. See <olink targetptr="about-hotspares-40444" remap="internal">Chapter&nbsp;16,
Hot Spare Pools (Overview)</olink> for more information about using hot spare
pools. </para><screen># <userinput>metastat d6</userinput>
d6: Mirror
    Submirror 0: d16
      State: Okay        
    Submirror 1: d26
      State: Needs maintenance
...
d26: Submirror of d6
    State: Needs maintenance
    Invoke: metareplace d6 c0t2d0s2 &lt;new device>
...
# <userinput>metareplace d6 c0t2d0s2 c0t2d2s2</userinput>
d6: device c0t2d0s2 is replaced with c0t2d2s2</screen><para>The <command>metastat</command> command confirms that mirror <filename>d6</filename> has a submirror, <filename>d26</filename>, with a slice in the &ldquo;Needs
maintenance&rdquo; state. The <command>metareplace</command> command replaces
the slice as specified in the &ldquo;Invoke&rdquo; line of the <command>metastat</command> output
with another available slice on the system. The system confirms that the slice
is replaced, and starts resynchronizing the submirror.  </para>
</example>
</task><task id="maintaintasksnew-10199"><title>How to Replace a Submirror</title><taskprerequisites><para>Read <olink targetptr="replace-enable-1" remap="internal">Overview of Replacing and Enabling
Components in RAID-1 and RAID-5 Volumes</olink> and <olink targetptr="eyaso" remap="internal">Creating
and Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-148"><para>Make sure that you have root privilege
and that you have a current backup of all data.</para>
</step><step><para>Use the <command>metastat</command> command to view the status
of the RAID-1 volume and associated submirrors.</para><screen># <userinput>metastat <replaceable>mirror-name</replaceable></userinput></screen>
</step><step id="tasks-mirrors-step-104"><para>Use one of the following methods to
replace a submirror.</para><itemizedlist><listitem><para>From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror.
Then, choose Action&rArr;Properties and click the Submirror tab. Follow the
onscreen instructions. For more information, see the online help.</para>
</listitem><listitem><para>Use the <command>metadetach</command>, <command>metaclear</command>, <command>metatinit</command>, and <command>metattach</command> commands to replace
an entire submirror.</para><orderedlist><listitem><para>Use the <command>metadetach</command> command to the failed
submirror from the mirror.</para><screen># <userinput>metadetach -f <replaceable>mirror-name</replaceable> <replaceable>submirror</replaceable></userinput></screen><variablelist><varlistentry><term><option>f</option></term><listitem><para>Forces the detach to occur</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>mirror-name</replaceable></term><listitem><para>Specifies the name of the mirror</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror</replaceable></term><listitem><para>Specifies the submirror to detach</para>
</listitem>
</varlistentry>
</variablelist>
</listitem><listitem><para>Use the <command>metaclear</command> command to delete the
submirror.</para><screen># <userinput>metaclear -f <replaceable>submirror</replaceable></userinput></screen><variablelist><varlistentry><term><option>f</option></term><listitem><para>Forces the deletion of the submirror to occur</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror</replaceable></term><listitem><para>Specifies the submirror to delete</para>
</listitem>
</varlistentry>
</variablelist>
</listitem><listitem><para>Use the <command>metainit</command> command to create a new
submirror.</para><screen># <userinput>metainit <replaceable>volume-name</replaceable> <replaceable>number-of-stripes</replaceable> <replaceable>components-per-stripe</replaceable> <replaceable>component-name</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>volume-name</replaceable></term><listitem><para>Specifies the name of the volume to create. For information
on naming volumes, see <olink targetptr="basics-34" remap="internal">Volume Names</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>number-of-stripes</replaceable></term><listitem><para>Specifies the number of stripes to create.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>components-per-stripe</replaceable></term><listitem><para>Specifies the number of components each stripe should have.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>component-names</replaceable></term><listitem><para>Specifies the names of the components that are used. This
example uses the root slice, <filename>c0t0d0s0</filename>.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem><listitem><para>Use the <command>metattach</command> command to attach the
new submirror.</para><screen># <userinput>metattach <replaceable>mirror</replaceable> <replaceable>submirror</replaceable></userinput></screen>
</listitem>
</orderedlist>
</listitem>
</itemizedlist>
</step>
</procedure><example id="egjyd"><title>Replacing a Submirror in a Mirror</title><para>The following example illustrates how to replace a submirror in an active
mirror. </para><screen># <userinput>metastat d20</userinput>
d20: Mirror
    Submirror 0: d21
      State: Okay        
    Submirror 1: d22
      State: Needs maintenance
...
# <userinput>metadetach -f d20 d22</userinput>
d20: submirror d22 is detached
# <userinput>metaclear -f d22</userinput>
d22: Concat/Stripe is cleared
# <userinput>metainit d22 2 1 c1t0d0s2 1 c1t0d1s2</userinput>
d22: Concat/Stripe is setup
# <userinput>metattach d20 d22</userinput>
d20: components are attached</screen><para>In this example, the <command>metastat</command> command confirms
that the two-way mirror, <filename>d20</filename>, has a submirror, <filename>d22</filename>, in the &ldquo;Needs maintenance&rdquo; state. In this case, the
entire submirror needs to be cleared and recreated. The <command>metadetach</command> command
detaches the failed submirror from the mirror by using the <option>f</option> option,
which forces the detachment to occur. The <command>metaclear</command> command
clears the submirror. The <command>metainit</command> command recreates submirror, <filename>d22</filename>, with new slices. Finally, the <command>metattach</command> command
attaches the rebuilt submirror. A mirror resynchronization begins automatically.</para><para>The specific configuration of the new volume, <literal>d22</literal>,
depends on the component you are replacing. A concatenation, as shown here,
can sufficiently replace a concatenation. However, a concatenation would not
be an ideal replacement for a stripe because it could impact performance.</para><para>You temporarily lose the capability for data redundancy while
the mirror is a one-way mirror. </para>
</example>
</task>
</sect1><sect1 id="tasks-mirrors-26"><title>Removing RAID-1 Volumes (Unmirroring)</title><task id="tasks-mirrors-3"><title>How to Unmirror a File System</title><tasksummary><para>Use this procedure to unmirror a file system that can be unmounted while
the system is running. To unmirror root (<filename>/</filename>), <filename>/var</filename>, <filename>/usr</filename>, or <filename>swap</filename>, or any other file system that
cannot be unmounted while the system is running, see <olink targetptr="tasks-mirrors-5" remap="internal">How to Unmirror a File System That Cannot Be Unmounted</olink>.</para>
</tasksummary><taskprerequisites><para>Read <olink targetptr="eyaso" remap="internal">Creating and Maintaining RAID-1 Volumes</olink>.</para>
</taskprerequisites><procedure><step id="tasks-mirrors-step-149"><para>Make sure that you have root privilege
and that you have a current backup of all data.</para>
</step><step id="tasks-mirrors-step-107"><para>Verify that at least one submirror
is in the Okay state.</para><screen># <userinput>metastat <replaceable>mirror</replaceable></userinput></screen>
</step><step id="tasks-mirrors-step-108"><para>Unmount the file system.</para><screen># <userinput>umount <replaceable>/file-system</replaceable></userinput></screen>
</step><step id="tasks-mirrors-step-109"><para>Detach the submirror that will continue to be used for the file
system.</para><screen># <userinput>metadetach <replaceable>mirror</replaceable> <replaceable>submirror</replaceable></userinput></screen><para>For more information, see the <olink targetdoc="refman1m" targetptr="metadetach-1m" remap="external"><citerefentry><refentrytitle>metadetach</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step id="tasks-mirrors-step-110"><para>Clear the mirror and remaining subcomponents.</para><screen># <userinput>metaclear -r <replaceable>mirror</replaceable></userinput></screen><para>For more information, see the <olink targetdoc="refman1m" targetptr="metaclear-1m" remap="external"><citerefentry><refentrytitle>metaclear</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step id="tasks-mirrors-step-111"><para>Edit the <filename>/etc/vfstab</filename> file
to use the component detached in <olink targetptr="tasks-mirrors-step-109" remap="internal">Step&nbsp;4</olink>, if necessary.</para>
</step><step id="tasks-mirrors-step-112"><para>Remount the file system.</para><screen># <userinput>mount <replaceable>/file-system</replaceable></userinput></screen>
</step>
</procedure><example id="eypfd"><title>Unmirroring the <filename>/opt</filename> File System</title><screen># <userinput>metastat d4</userinput>
d4: Mirror
    Submirror 0: d2
      State: Okay        
    Submirror 1: d3
      State: Okay        
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 2100735 blocks (1.0 GB)

d2: Submirror of d4
    State: Okay         
    Size: 2100735 blocks (1.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c0t0d0s0          0     No            Okay   Yes 


d3: Submirror of d4
    State: Okay         
    Size: 2100735 blocks (1.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t0d0s0          0     No            Okay   Yes 

...
# <userinput>umount /opt</userinput>
# <userinput>metadetach d4 d2</userinput>
d4: submirror d2 is detached
# <userinput>metaclear -r d4</userinput>
d4: Mirror is cleared
d3: Concat/Stripe is cleared
<lineannotation>(Edit the /etc/vfstab file so that the entry for /opt is changed from d4 to the underlying slice or volume)</lineannotation>
# <userinput>mount /opt</userinput></screen><para>In this example, the <filename>/opt</filename> file system is composed
of a two-way mirror, <filename>d4</filename>. The submirrors of the mirror
are <filename>d2</filename> and <filename>d3</filename>. The submirrors are
composed of slices <filename>/dev/dsk/c0t0d0s0</filename> and <filename>/dev/dsk/c1t0d0s0</filename>. The <command>metastat</command> command verifies that at least
one submirror is in the &ldquo;Okay&rdquo; state. (A mirror with no submirrors
in the &ldquo;Okay&rdquo; state must be repaired first.) The file system is
unmounted. Then, submirror <filename>d2</filename> is detached. The <command>metaclear <option>r</option></command> command deletes the mirror and the other submirror, <filename>d3</filename>.</para><para>Next, the entry for <filename>/opt</filename> in the <filename>/etc/vfstab</filename> file
is changed to reference the underlying slice.</para><para>In this example the <filename>/etc/vfstab file</filename> contains the
following entry for the <filename>/opt</filename> file system:</para><screen>/dev/md/dsk/d4  /dev/md/rdsk/d4  /opt ufs  2  yes -</screen><para>Change the entry to read as follows:</para><screen>/dev/md/dsk/d2  /dev/md/rdsk/d2  /opt ufs  2  yes -</screen><para>By using the submirror name, you can continue to have the file system
mounted on a volume. Finally, the <filename>/opt</filename> file system is
remounted.</para><para>By using <filename>d2</filename> instead of <filename>d4</filename> in
the <filename>/etc/vfstab</filename> file, you have unmirrored the mirror.
Because <filename>d2</filename> consists of a single slice, you can mount
the file system on the slice name (<filename>/dev/dsk/c0t0d0s0</filename>)
if you do not want the device to support a volume. </para>
</example>
</task><task id="tasks-mirrors-5"><title>How to Unmirror a File System That Cannot
Be Unmounted</title><tasksummary><para>Use this task to unmirror file systems, including root (<filename>/</filename>), <filename>/usr</filename>, <filename>/opt</filename>, and <filename>swap</filename>,
that cannot be unmounted during normal system operation.</para>
</tasksummary><procedure><step><para>Make sure that you have root privilege and that you have a current
backup of all data.</para>
</step><step id="tasks-mirrors-step-114"><para>Verify that at least one submirror
is in the Okay state.</para><screen># <userinput>metastat <replaceable>mirror</replaceable></userinput></screen>
</step><step id="tasks-mirrors-step-115"><para>Detach the submirror that will continue
to be used for the file system.</para><screen># <userinput>metadetach <replaceable>mirror</replaceable> <replaceable>submirror</replaceable></userinput></screen><para>For more information, see the <olink targetdoc="refman1m" targetptr="metadetach-1m" remap="external"><citerefentry><refentrytitle>metadetach</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step><para>Use one of the following commands, depending the file system you
want to unmirror:</para><itemizedlist><listitem><para>For the <filename>/usr</filename>, <filename>/opt</filename>,
or <filename>swap</filename> file systems, change the file system entry in
the <filename>/etc/vfstab</filename> file to use a non-Solaris Volume Manager device
(slice).</para>
</listitem><listitem><para>For the root (<filename>/</filename>) file system <emphasis>only</emphasis>:
run the <command>metaroot</command> command.</para><screen># <userinput>metaroot <replaceable>rootslice</replaceable></userinput></screen><para>For more information, see the <olink targetdoc="refman1m" targetptr="metaroot-1m" remap="external"><citerefentry><refentrytitle>metaroot</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</listitem>
</itemizedlist>
</step><step id="tasks-mirrors-step-118"><para>Reboot the system.</para><screen># <userinput>reboot</userinput></screen>
</step><step id="tasks-mirrors-step-119"><para>Clear the remaining mirror and submirrors.</para><screen># <userinput>metaclear -r <replaceable>mirror</replaceable></userinput></screen><para>For more information, see the <olink targetdoc="refman1m" targetptr="metaclear-1m" remap="external"><citerefentry><refentrytitle>metaclear</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step>
</procedure><example id="egjyl"><title>Unmirroring the root (<filename>/</filename>) File System</title><screen># <userinput>metastat d0</userinput>
d0: Mirror
    Submirror 0: d10
      State: Okay        
    Submirror 1: d20
      State: Okay        
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 2100735 blocks (1.0 GB)

d10: Submirror of d0
    State: Okay         
    Size: 2100735 blocks (1.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c0t3d0s0          0     No            Okay   Yes 


d20: Submirror of d0
    State: Okay         
    Size: 2100735 blocks (1.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t3d0s0          0     No            Okay   Yes 


# <userinput>metadetach d0 d20</userinput>
d0: submirror d20 is detached
# <userinput>metaroot /dev/dsk/c0t3d0s0</userinput>
# <userinput>reboot</userinput>
...
# <userinput>metaclear -r d0</userinput>
d0: Mirror is cleared
d10: Concat/Stripe is cleared
# <userinput>metaclear d20</userinput>
d20: Concat/Stripe is cleared</screen><para>In this example, the root (<filename>/</filename>) file system is a
two-way mirror, <filename>d0</filename>. The submirrors of the mirror are <filename>d10</filename> and <filename>d20</filename>. The submirrors are composed of
slices <filename>/dev/dsk/c0t3d0s0</filename> and <filename>/dev/dsk/c1t3d0s0</filename>.
The <command>metastat</command> command verifies that at least one submirror
is in the &ldquo;Okay&rdquo; state. (A mirror with no submirrors in the &ldquo;Okay&rdquo;
state must be repaired first.) Submirror <filename>d20</filename> is detached
to make <filename>d0</filename> a one-way mirror.</para><para>The<firstterm> rootslice</firstterm> is the slice containing the root
(<filename>/</filename>) file system. The <command>metaroot</command> command
is run, using the <replaceable>rootslice</replaceable> from which the system
is going to boot. This command edits the <filename>/etc/system</filename> and <filename>/etc/vfstab</filename> files. The command removes information that specifies
mirroring of the root (<filename>/</filename>) file system.</para><para>After rebooting the system, the <command>metaclear <option>r</option></command> command
deletes the mirror and the other submirror, <filename>d10</filename>. The
last <command>metaclear</command> command clears submirror <filename>d20</filename>.</para>
</example><example id="egjyt"><title>Unmirroring the <filename>swap</filename> File System</title><screen># <userinput>metastat d1</userinput>
d1: Mirror
    Submirror 0: d11
      State: Okay        
    Submirror 1: d21
      State: Okay        
...
# <userinput>metadetach d1 d21</userinput>
d1: submirror d21 is detached
<lineannotation>(Edit the /etc/vfstab file to change the entry for swap from  metadevice to slice name)</lineannotation>
# <userinput>reboot</userinput>
...
# <userinput>metaclear -r d1</userinput>
d1: Mirror is cleared
d11: Concat/Stripe is cleared
# <userinput>metaclear d21</userinput>
d21: Concat/stripe is cleared</screen><para>In this example, the <filename>swap</filename> file system is
made of a two-way mirror, <filename>d1</filename>. The submirrors of the mirror
are <filename>d11</filename> and <filename>d21</filename>. The submirrors
are composed of slices <filename>/dev/dsk/c0t3d0s1</filename> and <filename>/dev/dsk/c1t3d0s1</filename>. The <command>metastat</command> command verifies that at least
one submirror is in the &ldquo;Okay&rdquo; state. (A mirror with no submirrors
in the &ldquo;Okay&rdquo; state must be repaired first.) Submirror <filename>d21</filename> is
detached to make <filename>d1</filename> a one-way mirror. Next, the <filename>/etc/vfstab</filename> file is edited to change the entry for <filename>swap</filename> to
reference the slice that is in submirror <filename>d21</filename>.</para><para>In this example, the <filename>/etc/vfstab file</filename> contains
the following entry for the <filename>swap</filename> file system:</para><screen>/dev/md/dsk/d4  /dev/md/rdsk/d4  /opt ufs  2  yes -</screen><screen>/dev/md/dsk/d1 - - swap - no -</screen><para>Change the entry to read as follows:</para><screen>/dev/dsk/c0t3d0s1 - - swap - no -</screen><para>After rebooting the system, the <command>metaclear <option>r</option></command> command
deletes the mirror and the other submirror, <filename>d11</filename>. The
final <command>metaclear</command> command clears submirror <filename>d21</filename>. </para>
</example>
</task>
</sect1><sect1 id="tasks-mirrors-27"><title>Backing Up Data on a RAID-1 Volume</title><para>Solaris Volume Manager is not meant to be a &ldquo;backup product.&rdquo; Solaris Volume Manager does
provide a means for backing up mirrored data without causing any of the following
to occur:</para><itemizedlist><listitem><para>Unmounting the mirror</para>
</listitem><listitem><para>Taking the entire mirror offline</para>
</listitem><listitem><para>Halting the system</para>
</listitem><listitem><para>Denying users access to data</para>
</listitem>
</itemizedlist><para>Solaris Volume Manager backs up mirrored data by first taking one of the submirrors
offline. During the backup, mirroring is temporarily unavailable. As soon
as the backup is complete, the submirror is then placed back online and resynchronized.</para><note><para>The UFS Snapshots feature provides an alternative way to backup
a system without taking the file system offline. You can perform the backup
without detaching the submirror and incurring the performance penalty of resynchronizing
the mirror later. Before performing a backup using the UFS Snapshots feature,
make sure you have enough space available on your UFS file system. For more
information, see <olink targetdoc="sagdfs" targetptr="bkupsnapshot-2" remap="external">Chapter
26, <citetitle remap="chapter">Using UFS Snapshots (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Devices and File Systems</citetitle></olink>.</para>
</note><task id="tipsandtricks-36804"><title>How to Perform an Online Backup of a
RAID-1 Volume</title><tasksummary><para>You can use this procedure on any file system except the root (<filename>/</filename>)
file system. Be aware that this type of backup creates a &ldquo;snapshot&rdquo;
of an active file system. Depending on how the file system is being used when
it is write-locked, some files on the backup might not correspond to the actual
files on disk.</para><para>The following limitations apply to this procedure:</para><itemizedlist><listitem><para>If you use this procedure on a two-way mirror, be aware that
data redundancy is lost while one submirror is offline for backup. A multi-way
mirror does not have this problem. </para>
</listitem><listitem><para>There is some overhead on the system when the reattached submirror
is resynchronized after the backup is complete.</para>
</listitem>
</itemizedlist><para>The high-level steps in this procedure are as follows:</para><itemizedlist><listitem><para>Write-locking the file system (UFS only). Do not lock root
(/).</para>
</listitem><listitem><para>Flushing all data from cache to disk.</para>
</listitem><listitem><para>Using the <command>metadetach</command> command to take one
submirror off of the mirror</para>
</listitem><listitem><para>Unlocking the file system</para>
</listitem><listitem><para>Using the <command>fsck</command> command to check the file
system on the detached submirror</para>
</listitem><listitem><para>Backing up the data on the detached submirror</para>
</listitem><listitem><para>Using the <command>metattach</command> command to place the
detached submirror back in the mirror</para>
</listitem>
</itemizedlist><note><para>If you use these procedures regularly, put them into a script
for ease of use.</para>
</note><tip><para>The safer approach to this process is to attach a third or fourth
submirror to the mirror, allow it to resynchronize, and use it for the backup.
This technique ensures that data redundancy is maintained at all times. </para>
</tip>
</tasksummary><procedure><step id="tipsandtricks-step-87"><para>Verify that the mirror is in the &ldquo;Okay&rdquo;
state.</para><para>A mirror that is in the &ldquo;Maintenance&rdquo; state
should be repaired first.</para><screen># <userinput>metastat <replaceable>mirror</replaceable></userinput></screen>
</step><step id="tipsandtricks-40497"><para>Flush data and UFS logging data from
cache to disk and write-lock the file system.</para><screen># <userinput>/usr/sbin/lockfs -w <replaceable>mount-point</replaceable></userinput> </screen><para>Only a UFS volume needs to be write-locked. If the volume is set
up as a raw device for database management software or some other application,
running the <filename>lockfs</filename> command is not necessary. You might,
however, want to run the appropriate vendor-supplied utility to flush any
buffers and lock access.</para><caution><para>Do not write-lock the root (<filename>/</filename>) file system.
Write-locking the root (<filename>/</filename>) file system causes the system
to hang. If you are backing up your root (<filename>/</filename>) file system,
skip this step.</para>
</caution>
</step><step id="tipsandtricks-step-89"><para>Detach one submirror from the mirror.</para><screen># <userinput>metadetach <replaceable>mirror submirror</replaceable></userinput> </screen><variablelist><varlistentry><term><replaceable>mirror</replaceable></term><listitem><para>Is the volume name of the mirror.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>submirror</replaceable></term><listitem><para>Is the volume name of the submirror (volume) being detached.</para>
</listitem>
</varlistentry>
</variablelist><para>Reads continue to be made from the other submirror. The mirror is out
of sync as soon as the first write is made. This inconsistency is corrected
when the detached submirror is reattached in <olink targetptr="tipsandtricks-38249" remap="internal">Step&nbsp;7</olink>.</para>
</step><step id="tipsandtricks-step-90"><para>Unlock the file system and allow writes
to continue.</para><screen># <userinput>/usr/sbin/lockfs -u <replaceable>mount-point</replaceable></userinput> </screen><para>You might need to perform necessary unlocking procedures based on vendor-dependent
utilities used in <olink targetptr="tipsandtricks-40497" remap="internal">Step&nbsp;2</olink>.</para>
</step><step id="tasks-mirrors-step-152"><para>Use the <command>fsck</command> command
to check the file system on the detached submirror. This step ensures a clean
backup occurs.</para><screen># <userinput>fsck /dev/md/rdsk/<replaceable>name</replaceable></userinput></screen>
</step><step id="tipsandtricks-step-91"><para>Perform a backup of the offlined submirror. </para><para>Use the <command>ufsdump</command> command or your usual backup
utility. For information on performing the backup using the <command>ufsdump</command> command,
see <olink targetptr="exlvv" remap="internal">Performing Mounted Filesystem Backups Using the
ufsdump Command</olink>.</para><note><para>To ensure a proper backup, use the <emphasis>raw</emphasis> volume
name, such as <filename>/dev/md/rdsk/d4</filename>. Using the raw volume name
access to storage that is greater than 2 Gbytes.</para>
</note>
</step><step id="tipsandtricks-38249"><para>Attach the submirror.</para><screen># <userinput>metattach</userinput> <replaceable>mirror submirror</replaceable></screen><para>Solaris Volume Manager automatically begins resynchronizing the submirror with
the mirror.</para>
</step>
</procedure><example id="egjyi"><title>Performing an Online Backup of a RAID-1 Volume</title><para>This example uses a mirror, <filename>d1</filename>. The mirror consists
of submirrors <filename>d2</filename>, <filename>d3</filename> and <filename>d4</filename>.
The submirror <filename>d3</filename> is detached and backed up while submirrors <filename>d2</filename> and <filename>d4</filename> stay online. The file system on
the mirror is <filename>/home1</filename>.</para><screen># <userinput>metastat d1</userinput>
d1: Mirror
    Submirror 0: d2
      State: Okay        
    Submirror 1: d3
      State: Okay        
    Submirror 1: d4
      State: Okay        
...

# <userinput>/usr/sbin/lockfs -w /home1</userinput>
# <userinput>metadetach d1 d3</userinput>
# <userinput>/usr/sbin/lockfs -u /home1</userinput>
# <userinput>/usr/sbin/fsck /dev/md/rdsk/d3</userinput>
<replaceable>(Perform backup using /dev/md/rdsk/d3)</replaceable>
# <userinput>metattach d1 d3</userinput></screen>
</example>
</task>
</sect1>
</chapter>