Example--Replacing a Failed Slice in a Mirror
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 Chapter 15, Hot Spare Pools (Overview) for more information about using hot spare pools.
# metastat d6 d6: Mirror Submirror 0: d16 State: Okay Submirror 1: d26 State: Needs maintenance ... d26: Submirror of d6 State: Needs maintenance Invoke: metareplace d6 c0t2d0s2 <new device> ... # metareplace d6 c0t2d0s2 c0t2d2s2 d6: device c0t2d0s2 is replaced with c0t2d2s2 |
The metastat command confirms that mirror d6 has a submirror, d26, with a slice in the "Needs maintenance" state. The metareplace command replaces the slice as specified in the "Invoke" line of the metastat output with another available slice on the system. The system confirms that the slice is replaced, and starts resynchronizing the submirror.
How to Replace a Submirror
Make sure that you have root privilege and that you have a current backup of all data.
Read "Overview of Replacing and Enabling Components in RAID 1 and RAID 5 Volumes" and "Background Information for RAID 1 Volumes".
Use one of the following methods to replace a submirror.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, choose the mirror, then choose Action->Properties and click the Components tab. Follow the instructions on screen. For more information, see the online help.
Use the metadetach, metaclear, metatinit, and metattach commands to replace an entire submirror.
Example--Replacing a Submirror in a Mirror
The following example illustrates how to replace a submirror in an active mirror.
Note - The specific configuration of the new volume d22 will depend on the component you are replacing. A concatenation, as shown here, would be fine to replace a concatenation, but would not be an ideal replacement for a stripe as it could impact performance.
# metastat d20 d20: Mirror Submirror 0: d21 State: Okay Submirror 1: d22 State: Needs maintenance ... # metadetach -f d20 d22 d20: submirror d22 is detached # metaclear -f d22 d22: Concat/Stripe is cleared # metainit d22 2 1 c1t0d0s2 1 c1t0d1s2 d22: Concat/Stripe is setup # metattach d20 d22 d20: components are attached |
The metastat command confirms that the two-way mirror d20 has a submirror, d22, in the "Needs maintenance" state. In this case, the entire submirror will be cleared and recreated. The metadetach command detaches the failed submirror from the mirror by using the -f option, which forces the detach to occur. The metaclear command clears the submirror. The metainit command recreates submirror d22, with new slices. The metattach command attaches the rebuilt submirror, and a mirror resynchronization begins automatically.
Note - You temporarily lose the capability for data redundancy while the mirror is a one-way mirror.
Removing RAID 1 Volumes (Unmirroring)
How to Unmirror a File System
Use this procedure to unmirror a file system that can be unmounted while the system is running. To unmirror root (/), /var, /usr, or swap, or any other file system that cannot be unmounted while the system is running. see "How to Unmirror a File System That Cannot Be Unmounted".
Make sure that you have root privilege and that you have a current backup of all data.
Verify that at least one submirror is in the Okay state.
# metastat
Unmount the file system.
# umount /home
Detach the submirror that will continue to be used for the file system
For more information, see the metadetach(1M) man page.
# metadetach d1 d10
Clear the mirror and remaining subcomponents.
For more information, see the metaclear(1M)
# metaclear -r d1
Edit the /etc/vfstab file to use the component detached in Step 5, if necessary.
Remount the file system.
Example--Unmirroring the /opt File System
# metastat d4 d4: Mirror Submirror 0: d2 State: Okay Submirror 1: d3 State: Okay ... # umount /opt # metadetach d4 d2 d4: submirror d2 is detached # metaclear -r d4 d4: Mirror is cleared d3: Concat/Stripe is cleared (Edit the /etc/vfstab file so that the entry for /opt is changed from d4 to the underlying slice or volume) # mount /opt |
In this example, the /opt filesystem is made of a two-way mirror named d4; its submirrors are d2 and d3, made of slices /dev/dsk/c0t0d0s0 and /dev/dsk/c1t0d0s0, respectively. The metastat command verifies that at least one submirror is in the "Okay" state. (A mirror with no submirrors in the "Okay" state must be repaired first.) The file system is unmounted then submirror d2 is detached. The metaclear -r command deletes the mirror and the other submirror, d3.
Next, the entry for /opt in the /etc/vfstab file is changed to reference the underlying slice. For example, if d4 were the mirror and d2 the submirror, the following line:
/dev/md/dsk/d4 /dev/md/rdsk/d4 /var ufs 2 yes - |
should be changed to:
/dev/md/dsk/d2 /dev/md/rdsk/d2 /var ufs 2 yes - |
By using the submirror name, you can continue to have the file system mounted on a volume. Finally, the /opt file system is remounted.
Note - By using d2 instead of d4 in the /etc/vfstab file, you have unmirrored the mirror. Because d2 consists of a single slice, you can mount the file system on the slice name (/dev/dsk/c0t0d0s0) if you do not want the device to support a volume.
How to Unmirror a File System That Cannot Be Unmounted
Use this task to unmirror file systems that cannot be unmounted during normal system operation, including root (/), /usr, /opt, and swap.
Run the metastat command to verify that at least one submirror is in the "Okay" state.
Run the metadetach command on the mirror that contains root (/), /usr, /opt, or swap to make a one-way mirror.
For /usr, /opt, and swap: change the file system entry in the /etc/vfstab file to use a non-Solaris Volume Manager device (slice).
For root (/) only: running the metaroot command.
Reboot the system.
Run the metaclear command to clear the mirror and submirrors.