Solaris Volume Manager Administration Guide

Chapter 11 RAID-1 (Mirror) Volumes (Tasks)

This chapter explains how to perform Solaris Volume Manager tasks that are related to RAID-1 volumes. For information about related concepts, see Chapter 10, RAID-1 (Mirror) Volumes (Overview).

RAID-1 Volumes (Task Map)

The following task map identifies the procedures that are needed to manage Solaris Volume Manager RAID-1 volumes.

Task 

Description 

For Instructions 

Create a mirror from unused slices 

Use the Solaris Volume Manager GUI or the metainit command to create a mirror from unused slices.

How to Create a RAID-1 Volume From Unused Slices

Create a mirror from an existing file system 

Use the Solaris Volume Manager GUI or the metainit command to create a mirror from an existing file system.

How to Create a RAID-1 Volume From a File System

Create a mirror from the root (/) file system

Use the Solaris Volume Manager GUI or the metainit command to create a mirror from the root (/) file system.

SPARC: How to Create a RAID-1 Volume From the root (/) File System

x86: How to Create a RAID-1 Volume From the root (/) File System by Using DCA

Attach a submirror 

Use the Solaris Volume Manager GUI or the metattach command to attach a submirror.

How to Attach a Submirror

Detach a submirror 

Use the Solaris Volume Manager GUI or the metadetach command to detach the submirror.

How to Detach a Submirror

Place a submirror online or take a submirror offline 

Use the Solaris Volume Manager GUI or the metaonline command to put a submirror online. Use the Solaris Volume Manager GUI or the metaoffline command to take a submirror offline.

How to Place a Submirror Offline and Online

Enable a slice within a submirror 

Use the Solaris Volume Manager GUI or the metareplace command to enable a slice in a submirror.

How to Enable a Slice in a Submirror

Check mirror status 

Use the Solaris Volume Manager GUI or the metastat command to check the status of RAID-1 volumes.

How to View the Status of Mirrors and Submirrors

Change mirror options 

Use the Solaris Volume Manager GUI or the metaparam command to change the options for a specific RAID-1 volume.

How to Change RAID-1 Volume Options

Expand a mirror 

Use the Solaris Volume Manager GUI or the metattach command to expand the capacity of a mirror.

How to Expand a RAID-1 Volume

Replace a slice within a submirror 

Use the Solaris Volume Manager GUI or the metareplace command to replace a slice in a submirror.

How to Replace a Slice in a Submirror

Replace a submirror 

Use the Solaris Volume Manager GUI or the metattach command to replace a submirror.

How to Replace a Submirror

Remove a mirror (unmirror) 

Use the Solaris Volume Manager GUI, the metadetach command, or the metaclear command to unmirror a file system.

How to Unmirror a File System

Remove a mirror (unmirror) of a file system that cannot be unmounted 

Use the Solaris Volume Manager GUI, the metadetach command, or the metaclear command to unmirror a file system that cannot be unmounted.

How to Unmirror a File System That Cannot Be Unmounted

Use a mirror to perform backups 

Use the Solaris Volume Manager GUI, the metaonline command, or the metaoffline commands to perform backups with mirrors.

How to Perform an Online Backup of a RAID-1 Volume

Creating a RAID-1 Volume

ProcedureHow to Create a RAID-1 Volume From Unused Slices

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.

Before You Begin

Check Prerequisites for Creating Solaris Volume Manager Components and Creating and Maintaining RAID-1 Volumes.

Steps
  1. Create two stripes or concatenations. These components become the submirrors.

    See How to Create a RAID-0 (Stripe) Volume or How to Create a RAID-0 (Concatenation) Volume.

  2. To create the mirror, use one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume and follow the onscreen instructions. For more information, see the online help.

    • Use the following form of the metainit command to create a one-way mirror:


      # metainit volume-name -m  submirror-name
      
      volume-name

      Specifies the name of the volume to create

      -m

      Specifies to create a mirror

      submirror-name

      Specifies the name of the component that will be the first submirror in the mirror

      See the following examples and the metainit(1M) man page for more information.

  3. To add the second submirror, use one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the mirror you want to modify. Choose Action⇒Properties, then the Submirrors. Follow the onscreen instructions to attach the submirror. For more information, see the online help.

    • Use the following form of the metattach command:


      # metattach volume-name submirror-name
      
      volume-name

      Specifies the name of the RAID-1 volume on which to add the submirror

      submirror-name

      Specifies the name of the component that will be the second submirror attached to the mirror

      See the following examples and the metattach(1M) man page for more information.


Example 11–1 Creating a Two-Way Mirror


# metainit d51 1 1 c0t0d0s2
d51: Concat/Stripe is setup
# metainit d52 1 1 c1t0d0s2
d52: Concat/Stripe is setup
# metainit d50 -m d51
d50: Mirror is setup
# metattach d50 d52
d50: Submirror d52 is attached

This example shows you how to create the two-way mirror, d50. The metainit command creates two submirrors (d51 and d52), which are RAID-0 volumes. The metainit -m command creates the one-way mirror from the d51 RAID-0 volume. The metattach command attaches d52, creating a two-way mirror and causing a resynchronization. Any data on the attached submirror is overwritten by the other submirror during the resynchronization.



Example 11–2 Creating a Two-Way Mirror Without Resynchronization


# metainit d51 1 1 c0t0d0s2
d51: Concat/Stripe is setup
# metainit d52 1 1 c1t0d0s2
d52: Concat/Stripe is setup
# metainit d50 -m d51 d52
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

This example shows the creation a two-way mirror, d50. The metainit command creates two submirrors (d51 and d52), which are RAID-0 volumes. The metainit -m command is then run with both submirrors to create the mirror. When you create a mirror using the metainit command rather than the metattach 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.


See Also

To prepare a newly created mirror for a file system, see Chapter 18, Creating UFS, TMPFS, and LOFS File Systems (Tasks), in System Administration Guide: Devices and File Systems. 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.

ProcedureHow to Create a RAID-1 Volume From a File System

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 /usr and /swap, the system must be rebooted to complete the procedure.

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.

For the procedures associated with mirroring the root (/) file system, see SPARC: How to Create a RAID-1 Volume From the root (/) File System and x86: How to Create a RAID-1 Volume From the root (/) File System by Using DCA.

In the example used in this procedure, the existing slice is c1t0d0s0. The second slice, c1t1d0s0, is available for the second half of the mirror. The submirrors are d1 and d2, respectively, and the mirror is d0.


Caution – Caution –

Be sure to create a one-way mirror with the metainit command then attach the additional submirrors with the metattach command. When the metattach 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.


Before You Begin

Check Prerequisites for Creating Solaris Volume Manager Components and Creating and Maintaining RAID-1 Volumes.

Steps
  1. Identify the slice that contains the existing file system to be mirrored This example uses the slice c1t0d0s0.

  2. Create a new RAID-0 volume on the slice from the previous step by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions . For more information, see the online help.

    • Use the following form of the metainit command:


      # metainit -f  volume-name number-of-stripes components-per-stripe component-name
      
      -f

      Forces the command to continue. You must use this option when the slice contains a mounted file system.

      volume-name

      Specifies the name of the volume to create. For information on naming volumes, see Volume Names.

      number-of-stripes

      Specifies the number of stripes to create.

      components-per-stripe

      Specifies the number of components each stripe should have.

      component-names

      Specifies the names of the components that are used. This example uses the root slice, c0t0d0s0.

  3. Create a second RAID-0 volume (concatenation) on an unused slice (c1t1d0s0 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:

    • 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.

    • Use the following form of the metainit command.


      # metainit volume-name number-of-stripes components-per-stripe component-name
      

      Note –

      See Step 2 for an explanation of the options.


  4. Create a one-way mirror by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions . For more information, see the online help.

    • Use the following form of the metainit command.


      # metainit volume-name -m submirror-name
      
      volume-name

      Specifies the name of the volume to create.

      -m

      Specifies to create a mirror.

      submirror-name

      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.

    See the metainit(1M) man page for more information.


    Caution – Caution –

    When you create a mirror from an existing file system, you must follow the next two steps precisely to avoid data corruption.


  5. Edit the /etc/vfstab file so that the file system mount instructions refer to the mirror, not to the block device. For more information about the/etc/vfstab file, see Mounting File Systems in System Administration Guide: Devices and File Systems.

    For example, if the /etc/vfstab file contains the following entry for the file system:


    /dev/dsk/slice /dev/rdsk/slice /var ufs 2 yes -

    Change the entry to read as follows:


    /dev/md/dsk/mirror-name /dev/md/rdsk/mirror-name /var ufs 2 yes -
  6. Remount your newly mirrored file system according to one of the following procedures:

    • If you are mirroring a file system that can be unmounted, then unmount and remount the file system.


      # umount /filesystem
      # mount /filesystem
      
    • If you are mirroring a file system that cannot be unmounted, then reboot your system.


      # reboot
      
  7. Use the following form of the metattach command to attach the second submirror.


    # metattach volume-name submirror-name
    
    volume-name

    Specifies the name of the RAID-1 volume on which to add the submirror

    submirror-name

    Specifies the name of the component that will be the second submirror attached to the mirror

    See the metattach(1M) man page for more information.


Example 11–3 Creating a Two-Way Mirror From a File System That Can Be Unmounted


# metainit -f d1 1 1 c1t0d0s0
d1: Concat/Stripe is setup
# metainit d2 1 1 c1t1d0s0
d2: Concat/Stripe is setup
# metainit d0 -m d1
d0: Mirror is setup
# umount /master
(Edit the /etc/vfstab file so that the file system references the mirror)
# mount /master
# metattach d0 d2
d0: Submirror d2 is attached

In this example, the -f option forces the creation of the first concatenation, d1, which contains the mounted file system /master on /dev/dsk/c1t0d0s0. The second concatenation, d2, is created from /dev/dsk/c1t1d0s0. This slice must be the same size as , or larger than the size of d1.) The metainit command with the -m option creates the one-way mirror, d0, from d1.

Next, the entry for the file system should be changed in the /etc/vfstab file to reference the mirror. The following line in the /etc/vfstab file initially appears as follows:


/dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 /var ufs 2 yes -

The entry is changed to the following:


/dev/md/dsk/d0 /dev/md/rdsk/d0 /var ufs 2 yes -

Finally, the file system is remounted and submirror d2 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 d2 is attached.



Example 11–4 Creating a Two-way Mirror From a File System That Cannot Be Unmounted


# metainit -f d12 1 1 c0t3d0s6
d12: Concat/Stripe is setup
# metainit d22 1 1 c1t0d0s6
d22: Concat/Stripe is setup
# metainit d2 -m d12
d2: Mirror is setup
(Edit the /etc/vfstab file so that /usr references the mirror)
# reboot
...
# metattach d2 d22
d2: Submirror d22 is attached

This example creates a two-way mirror using a slice containing the /usr file system. The -f option forces the creation of the first concatenation, d12, which contains the mounted file system /usr on /dev/dsk/c0t3d0s6. The second concatenation, d22, is created from /dev/dsk/c1t0d0s6. This slice must be the same size as, or larger than the size of d12. The metainit command with the -m option creates the one-way mirror d2 using the concatenation that contains the /usr file system. Next, the /etc/vfstab file must be edited to change the entry for /usr to reference the mirror.

The /etc/vfstab file contains the following entry for the /usr file system:


/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /usr ufs 1 yes -

Change the entry to read as follows:


/dev/md/dsk/d2 /dev/md/rdsk/d2 /usr ufs 1 yes -

After a reboot, the second submirror d22 is attached to the mirror, causing a mirror resynchronization.



Example 11–5 Creating a Mirror From the /swap Space


# metainit -f d11 1 1 c0t0d0s1
d11: Concat/Stripe is setup
# metainit d21 1 1 c1t0d0s1
d21: Concat/Stripe is setup
# metainit d1 -m d11
d1: Mirror is setup
(Edit the /etc/vfstab file so that swap references the mirror)
# reboot
...
# metattach d1 d21
d1: Submirror d21 is attached

In this example, the -f option forces the creation of the first concatenation, d11, which contains the mounted file system swap on /dev/dsk/c0t0d0s1. The second concatenation, d21, is created from /dev/dsk/c1t0d0s1. This slice must be the same size as, or larger than the size of d11. The metainit command with the -m option creates the one-way mirror d1 using the concatenation that contains swap. Next, if there is an entry for swap in the /etc/vfstab file, it must be edited to reference the mirror.

The /etc/vfstab file contains the following entry for the swap space:


/dev/dsk/c0t0d0s1 - - swap - no -

Change the entry to read as follows:


/dev/md/dsk/d1 - - swap - no -

After a reboot, the second submirror d21 is attached to the mirror, causing a mirror resynchronization.

To save the crash dump when you have mirrored the swap space, use the dumpadm command to configure the dump device as a volume. For instance, if the swap device is named /dev/md/dsk/d2, use the dumpadm command to set this device as the dump device.


ProcedureSPARC: How to Create a RAID-1 Volume From the root (/) File System

The process for mirroring the root (/) file system on a SPARC platform is similar to mirroring any other file system that you cannot unmount. The procedure differs in that the metaroot command is run instead of manually editing the /etc/vfstab file. Mirroring the root (/) file system also requires recording the path to the alternate boot device. This device reboots the system if the submirror fails.

In the example used in this procedure, the existing slice is c1t0d0s0. The second slice, c1t1d0s0, is available for the second half of the mirror. The submirrors are d1 and d2, respectively, and the mirror is d0.


Caution – Caution –

Be sure to create a one-way mirror with the metainit command then attach the additional submirrors with the metattach command. When the metattach 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.


Before You Begin

Check Prerequisites for Creating Solaris Volume Manager Components and Creating and Maintaining RAID-1 Volumes.

Steps
  1. Identify the slice that contains the existing root (/) file system to be mirrored. This example uses the slice c1t0d0s0.

  2. 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.

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions . For more information, see the online help.

    • Use the following form of the metainit command:


      # metainit -f  volume-name number-of-stripes components-per-stripe component-name
      
      -f

      Forces the command to continue. You must use this option when the slice contains a mounted file system.

      volume-name

      Specifies the name of the volume to create. For information on naming volumes, see Volume Names.

      number-of-stripes

      Specifies the number of stripes to create.

      components-per-stripe

      Specifies the number of components each stripe should have.

      component-names

      Specifies the names of the components that are used. This example uses the root slice, c0t0d0s0.

  3. Create a second RAID-0 volume on an unused slice (c1t1d0s0 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:

    • 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.

    • Use the following form of the metainit command.


      # metainit volume-name number-of-stripes components-per-stripe component-name
      

      Note –

      See Step 2 for and explanation of the options.


  4. Create a one-way mirror by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions . For more information, see the online help.

    • Use the following form of the metainit command.


      # metainit volume-name -m submirror-name
      
      volume-name

      Specifies the name of the volume to create.

      -m

      Specifies to create a mirror.

      submirror-name

      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.

  5. Remount your newly mirrored file system. Run the metaroot volume-name command, replacing volume-name with the name of the mirror you have created. Then, reboot your system.


    # metaroot volume-name
    # reboot
    

    For more information, see the metaroot(1M) man page.

  6. Use the following form of the metattach command to attach the second submirror.


    # metattach volume-name submirror-name
    
    volume-name

    Specifies the name of the RAID-1 volume on which to add the submirror

    submirror-name

    Specifies the name of the component that will be the second submirror attached to the mirror

    See the metattach(1M) man page for more information.

  7. Record the alternate boot path.

    1. Determine the path to the alternate root device. Use the ls -l command on the slice that is being attached as the second submirror to the root (/) file system mirror.


      # ls -l /dev/dsk/c1t1d0s0
      lrwxrwxrwx 1  root root  55 Mar 5 12:54  /dev/rdsk/c1t1d0s0 -> \ 
      ../../devices/sbus@1,f8000000/esp@1,200000/sd@3,0:a
    2. Record the string that follows the /devices directory: /sbus@1,f8000000/esp@1,200000/sd@3,0:a.


      Note –

      Because the system might not be available, this information should also be written down somewhere other than on the system. See Recovering From Boot Problems for details on booting from the alternate boot device.


    3. Edit the string to change the major name (sd, in this case) to disk, resulting in /sbus@1,f8000000/esp@1,200000/disk@3,0:a. If the system uses an IDE bus, the original full path might look like


      $ ls -l /dev/dsk/c1t1d0s0 
      lrwxrwxrwx 1 root root 38 Mar 13 15:03 /dev/dsk/c0t0d0s0 -> \
      ../../devices/pci@1f,0/ide@d/dad@0,0:a

      After changing the major name dad to disk, you would have /pci@1f,0/ide@d/disk@0,0:a

    4. Use the OpenBootTM PROM nvalias command to define a “backup root” device alias for the secondary root (/) file system mirror. For example:


      ok  nvalias backup_root /sbus@1,f8000000/esp@1,200000/disk@3,0:a
      
    5. Redefine the boot-device alias to reference both the primary and secondary submirrors, in the order in which you want them to be used, and store the configuration.


      ok printenv boot-device
      boot-device =         disk net
      ok setenv boot-device disk backup_root net
      boot-device =         disk backup_root net
      ok nvstore
      

    Note –

    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:


    ok boot backup_root
    


Example 11–6 SPARC: Creating a Mirror From the root (/) File System


# metainit -f d1 1 1 c0t0d0s0
d1: Concat/Stripe is setup
# metainit d2 1 1 c0t1d0s0
d2: Concat/Stripe is setup
# metainit d0 -m d1
d0: Mirror is setup
# metaroot d0
# lockfs -fa
# reboot
...
# metattach d0 d2
d0: Submirror d2 is attached
# ls -l /dev/dsk/c0t1d0s0
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
# init 0
.
.
.
ok nvalias backup_root /pci@1f,0/pci@1,1/ide@3/disk@0,0:a
ok setenv boot-device disk backup_root net
ok nvstore

In this example, the -f option forces the creation of the first RAID-0 volume, d1, which contains the mounted root (/) file system on /dev/dsk/c0t0d0s0. The second concatenation, d2, is created from /dev/dsk/c0t1d0s0. This slice must be the same size as, or larger than the size of d1. The metainit command with the -m option creates the one-way mirror d0 using the concatenation that contains root (/).

Next, the metaroot command edits the /etc/vfstab and /etc/system files so that the system can be booted with the root (/) file system on a volume. It is a good idea to run the lockfs -fa command before rebooting. For more information, see the lockfs(1M) man page.

Do not attach the second submirror before the system is rebooted. You must reboot after running the metaroot command and before attaching the second submirror.

After a reboot, the submirror d2 is attached to the mirror, causing a mirror resynchronization. The system confirms that the concatenations and the mirror are set up, and that submirror d2 is attached.

The ls -l 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.


x86: Creating a RAID-1 Volume From the root (/) File System

Beginning with the Solaris 10 1/06 release, the GRand Unified Bootloader (GRUB) has replaced the Device Configuration Assistant (DCA) for boot processes and configurations in x86 based systems. For a brief description of this feature and the enhancements it introduces, refer to the GRUB Based Booting in Solaris 10 What’s New.

The procedures in this section describe steps to create RAID-1 volumes from the root (/) file system. If your system is running the Solaris 10 1/06 OS or subsequent releases, follow the first procedure that uses GRUB. Otherwise, perform the steps in the second procedure that uses DCA.

The process for mirroring the root (/) file system on an x86 based system is similar to mirroring root on a SPARC system. However, on x86 based systems, the BIOS and fdisk partitioning add an additional layer of complexity.

In the example used in the procedures, the existing slice is c1t0d0s0. The second slice, c1t1d0s0, is available for the second half of the mirror. The submirrors are d1 and d2, respectively, and the mirror is d0.


Note –

Before implementing any of the procedures, check Prerequisites for Creating Solaris Volume Manager Components and Creating and Maintaining RAID-1 Volumes.


Procedurex86: How to Create a RAID-1 Volume From the root (/) File System by Using GRUB

Steps
  1. 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.

    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:

    • Perform startup functions.

    • Detect the correct device from which to boot the system.

    • Load the master boot record from that device to allow the system to self-boot.

    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

    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.

  2. Verify that the fdisk partitions are configured to support root mirroring.

    The existence of a separate x86 boot partition presents a problem when mirroring the root (/) file system. Because it exists outside of the Solaris fdisk 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.

    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.

    To determine if your system has a separate x86 boot partition, check the /etc/vfstab file. The x86 boot partition exists if the file contains an entry similar to the following:


    /dev/dsk/c2t1d0p0:boot  -       /boot   pcfs    -       no      -

    To use the Solaris Volume Manager to mirror the root (/) file system, the file system must use the single Solaris fdisk partition. Therefore, if the x86 boot partition already exists in the system, delete this partition with the fdisk command and then reinstall the Solaris software. When you reinstall, the boot partition is no longer recreated.


    Note –

    Solaris Volume Manager can only mirror slices within the Solaris fdisk partition If you have multiple fdisk partitions, you need to use another approach to protect the data outside of the Solaris fdisk partition.


  3. Make the secondary submirror bootable with a master boot program.

    1. Specify the master boot program.


      # fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c1t1d0p0
      

      The following screen appears:


                   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: 
    2. Choose number 5 from the menu, and press return.

  4. Make the secondary disk bootable.


    # /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0
    

    For more information about installgrub, refer to the installgrub(1M) man page.

  5. Identify the slice that contains the existing root (/) file system to be mirrored.

    This example uses the slice c1t0d0s0.

  6. Create a new RAID-0 volume on the slice from the previous step.

    Only the single slice can be included in the RAID-0 volume. Use one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions. For more information, see the online help.

    • Use the following form of the metainit command:


      # metainit -f volume-name number-of-stripes components-per-stripe component-name
      
      -f

      Forces the command to continue. You must use this option when the slice contains a mounted file system.

      volume-name

      Specifies the name of the volume to create. For information on naming volumes, see Volume Names.

      number-of-stripes

      Specifies the number of stripes to create.

      components-per-stripe

      Specifies the number of components each stripe should have.

      component-names

      Specifies the names of the components that are used. This example uses the root slice, c0t0d0s0.

  7. Create a second RAID-0 volume (c1t1d0s0 in this example) on an unused slice to act as the second submirror.


    Note –

    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 “root” and the root slice must be slice 0.

    For information on configuring the slice tag field, see the format(1M) man page.


    Use either of the following methods:

    • 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.

    • Use the following form of the metainit command.


      # metainit volume-name number-of-stripes components-per-stripes component-names
      

      Note –

      See Step 6 for an explanation of the options.


  8. Create a one-way mirror by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions. For more information, see the online help.

    • Use the following form of the metainit command.


      # metainit volume-name -m submirror-name
      
      volume-name

      Specifies the name of the volume to create.

      -m

      Specifies to create a mirror.

      submirror-name

      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.

  9. Remount your newly mirrored file system, then reboot the system.


    # metaroot volume-name
    # reboot
    

    For more information, see the metaroot(1M) man page.

  10. Attach the second submirror.


    # metattach volume-name submirror-name
    
    volume-name

    Specifies the name of the RAID-1 volume on which to add the submirror.

    submirror-name

    Specifies the name of the component that will be the second submirror attached to the mirror.

    See the metattach(1M) man page for more information.

  11. Define the alternative boot path in the menu.lst file.

    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, c1t1d0s0, the alternative path is on the first slice of the first fdisk partition on the second disk. Thus, you would edit the menu.lst with the following entry:


    title alternate boot
     root (hd1,0,a)
     kernel /boot/multiboot
     module /boot/x86.miniroot-safe

    Note –

    To properly edit entries in menu.lst, you must be familiar with disk-naming conventions in GRUB. For details, see Chapter 11, GRUB Based Booting (Tasks), in System Administration Guide: Basic Administration


    After you have completed editing the menu.lst 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.


    Caution – Caution –

    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 metadevice maintenance which synchronizes both primary and secondary disks and restores the valid boot archive to the primary disk.


Procedurex86: How to Create a RAID-1 Volume From the root (/) File System by Using DCA

Steps
  1. 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.

    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. In addition to its other startup functions, the BIOS is responsible for finding the correct device to boot from and for loading the master boot record from the device that allows the system to boot itself. 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 does not have this feature and the primary submirror fails, you need to access the BIOS while the system is booting and reconfigure it 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.

    You can use the DCAon 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.

  2. Verify that the fdisk partitions are configured to support root mirroring.

    Another feature of x86 based systems is the use of fdisk partitions. The default boot-disk partition layout of the Solaris OS installation program creates a Solaris fdisk partition and another, small fdisk partition of about 10MB called the x86 boot partition.

    The x86 boot partition presents a problem when mirroring the root (/) file system. The x86 boot partition is outside of the Solaris fdisk partition. For that reason, 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.

    You can determine if your Solaris OS has a separate x86 boot partition. The x86 boot partition is mounted in the /etc/vfstab file with an entry similar to the following:


    /dev/dsk/c2t1d0p0:boot  -       /boot   pcfs    -       no      -

    If the separate x86 boot partition does not exist, this entry does not appear in the /etc/vfstab file.

    In order to mirror the root (/) file system, you need to customize your fdisk partitions to delete the x86 boot partition and use the single Solaris fdisk partition. If you intend to use Solaris Volume Manager root mirroring, do not create a separate x86 boot partition during the system installation. If the system is already installed and a separate x86 boot partition was created, delete that fdisk partition using the fdisk command and reinstall the system. During installation, avoid creating a separate x86 boot partition by customizing your disk partitions during the installation process.


    Note –

    Solaris Volume Manager can only mirror slices within the Solaris fdisk partition If you have multiple fdisk partitions, you need to use another approach to protect the data outside of the Solaris fdisk partition.


  3. Make the secondary submirror bootable with a master boot program.

    1. Use the fdisk command to specify the master boot program.


      # fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c1t1d0p0
      

      The following screen appears:


                   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: 
    2. Choose number 5 from the menu, and press return.

  4. Install bootblocks on the secondary submirror in order to make it bootable.

    Slice 8 on the disk where the secondary submirror resides is necessary for booting the Solaris OS from this fdisk partition. This slice holds the partition boot record (pboot), the Solaris VTOC for the disk, and the bootblock. This information is disk specific, so it is not mirrored with Solaris Volume Manager. However, you must ensure that both disks are bootable so that you can boot from the secondary disk if the primary fails. Use the installboot command to setup the second disk as a Solaris bootable disk. See the installboot(1M) man page for more information.

    You must specify slice 2 of the disk as the device, and slice 2 must comprise the entire disk.


    # installboot /usr/platform/i86pc/lib/fs/ufs/pboot \
    /usr/platform/i86pc/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s2
    
  5. Identify the slice that contains the existing root (/) file system to be mirrored. This example uses the slice c1t0d0s0.

  6. 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.

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions. For more information, see the online help.

    • Use the following form of the metainit command:


      # metainit -f volume-name number-of-stripes components-per-stripe component-name
      
      -f

      Forces the command to continue. You must use this option when the slice contains a mounted file system.

      volume-name

      Specifies the name of the volume to create. For information on naming volumes, see Volume Names.

      number-of-stripes

      Specifies the number of stripes to create.

      components-per-stripe

      Specifies the number of components each stripe should have.

      component-names

      Specifies the names of the components that are used. This example uses the root slice, c0t0d0s0.

  7. Create a second RAID-0 volume on an unused slice (c1t1d0s0 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:


    Note –

    The slice you use as the second submirror must have a slice tag of “root” and the root slice must be slice 0. For information on configuring the slice tag field, see the format(1M) man page.


    • 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.

    • Use the following form of the metainit command.


      # metainit volume-name number-of-stripes components-per-stripes component-names
      

      Note –

      See Step 6 for and explanation of the options.


  8. Create a one-way mirror by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions. For more information, see the online help.

    • Use the following form of the metainit command.


      # metainit volume-name -m submirror-name
      
      volume-name

      Specifies the name of the volume to create.

      -m

      Specifies to create a mirror.

      submirror-name

      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.

  9. Remount your newly mirrored file system. Run the metaroot volume-name command, replacing volume-name with the name of the mirror you have created. Then, reboot your system.


    # metaroot volume-name
    # reboot
    

    For more information, see the metaroot(1M) man page.

  10. Use the following form of the metattach command to attach the second submirror.


    # metattach volume-name submirror-name
    
    volume-name

    Specifies the name of the RAID-1 volume on which to add the submirror.

    submirror-name

    Specifies the name of the component that will be the second submirror attached to the mirror.

    See the metattach(1M) man page for more information.

  11. Record the alternate boot path.

    You need to configure your system so that if your primary submirror fails, the system boots from the secondary submirror. 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.

    1. Determine the path to the alternate boot device. Use the ls -l command on the slice that is being attached as the second submirror to the root (/) file system mirror.


      # ls -l /dev/dsk/c1t1d0s0
      lrwxrwxrwx 1  root root  55 Mar 5 12:54  /dev/rdsk/c1t1d0s0 -> ../.
      ./devices/eisa/eha@1000,0/cmdk@1,0:a
    2. Record the string that follows the /devices directory, /eisa/eha@1000,0/cmdk@1,0:a. This is the device tree path.


      Note –

      Because the system might not be available, this information should be written down somewhere other than on the system. This enables you to more easily enter the device tree path information if you must use the DCA to boot the system.


    3. Use the eeprom command to define the alternative boot path. For example:


      # eeprom altbootpath=/eisa/eha@1000,0/cmdk@1,0:a
      

      If the primary submirror fails, the system tries to boot from the secondary submirror. The boot process is automatic if the BIOS can be configured to automatically failover to the second disk. If not, you need to enter the BIOS and configure it to boot from the secondary disk. Once the system starts to boot, it tries to boot from the bootpath device. Since the primary boot disk is the dead disk in the root mirror, the system then attempts to boot from the altbootpath device. Consult the user's guide for your BIOS for instructions on how to configure settings in your BIOS.

      If the system does not boot automatically, you can try using the DCA to select the secondary submirror. On some systems, you can choose to enter the DCA during the boot process. If this option is not available, you need to boot from an x86 boot floppy disk and use the DCA to select the secondary submirror. After the operating system has booted, update the eeprom bootpath value with the value that you set as the alternate boot path (the altbootpath value). Then, the system will boot automatically.

      For more information on using the eeprom command, see the eeprom(1M) man page.


Example 11–7 x86: Creating a Mirror From the root (/) File System By Using DCA


# metainit -f d1 1 1 c0t0d0s0
d1: Concat/Stripe is setup
# metainit d2 1 1 c0t1d0s0
d2: Concat/Stripe is setup
# metainit d0 -m d1
d0: Mirror is setup
# metaroot d0
# lockfs -fa
# reboot
...
# metattach d0 d2
d0: Submirror d2 is attached
# ls -l /dev/dsk/c0t1d0s0
lrwxrwxrwx   1 root     root          88 Feb  8 15:51 /dev/dsk/c1t3d0s0 ->
../../devices/pci@1f,0/pci@1,1/ide@3/dad@0,0:a,raw
# eeprom altbootpath=/pci@1f,0/pci@1,1/ide@3/dad@0,0:a,raw
# fdisk -b /usr/lib/fs/ufs/mboot /dev/dsk/c0t1d0p0
             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: 5
# installboot /usr/platform/i86pc/lib/fs/ufs/pboot \
/usr/platform/i86pc/lib/fs/ufs/bootblk /dev/rdsk/c0t1d0s2

Understanding Boot Time Warnings When Mirroring the root (/) File System

After you mirror your root (/) file system, error messages will be displayed in the console and logged in the system log that is defined in the /etc/syslog.conf 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:


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

You can safely disregard these error messages.

Working With Submirrors

ProcedureHow to Attach a Submirror


Note –

An error message stating “can't attach labeled submirror to an unlabeled mirror” 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.


Before You Begin

Read Creating and Maintaining RAID-1 Volumes.

Steps
  1. Identify the component (concatenation or stripe) to be used as a submirror.

    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 Creating RAID-0 (Stripe) Volumes or Creating RAID-0 (Concatenation) Volumes.

  2. Make sure that you have root privilege and that you have a current backup of all data.

  3. Verify that the status of the mirror you want to work with is in an “Okay” state using the metastat command.


    # metastat mirror
    
  4. Use one of the following methods to attach 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 Submirror tab. Follow the onscreen instructions. For more information, see the online help.

    • Use the metattach mirror submirror command.


      # metattach mirror submirror
      

    See the metattach(1M) man page for more information.

  5. View the status of the mirror using the metastat command.


    # metastat mirror
    

Example 11–8 Attaching a Submirror


# metastat d30
d30: mirror
    Submirror 0: d60
      State: Okay   
...
# metattach d30 d70
d30: submirror d70 is attached
# metastat d30
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
...

This example shows the attaching of a submirror, d70, to a one-way mirror, d30. You create a two-way mirror when your attach the submirror to the mirror. The mirror d30 initially consists of submirror d60. The submirror d70 is a RAID-0 volume. You verify that the status of the mirror is “Okay” with the metastat command, then attach the submirror. When the metattach 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 metastat command.


ProcedureHow to Detach a Submirror

Before You Begin

Read Creating and Maintaining RAID-1 Volumes.

Steps
  1. Make sure that you have root privilege. Make sure that you have a current backup of all data.

  2. Verify that the status of the mirror you want to work with is in an “Okay” state using the metastat command.

  3. Use one of the following methods to detach 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 Submirror tab. Follow the onscreen instructions. For more information, see the online help.

    • Use the metadetach command to detach a submirror from a mirror.


      # metadetach mirror submirror
      

      See the metadetach(1M) man page for more information.


Example 11–9 Detaching a Submirror


# metastat
d5: mirror
    Submirror 0: d50
...
# metadetach d5 d50
d5: submirror d50 is detached

In this example, mirror d5 has a submirror, d50. You detach the submirror with the metadetach command. The underlying slices from d50 can be reused elsewhere. After the submirror is detached from the mirror, the system displays a confirmation message.


ProcedureHow to Place a Submirror Offline and Online

The metaonline command can only be used when a submirror was taken offline by the metaoffline command. After the metaonline command runs, Solaris Volume Manager automatically begins resynchronizing the submirror with the mirror.


Note –

The metaoffline command's capabilities are similar to the capabilities offered by the metadetach command. However, the metaoffline command does not sever the logical association between the submirror and the mirror.


Before You Begin

Read Creating and Maintaining RAID-1 Volumes.

Steps
  1. Make sure that you have root privilege and that you have a current backup of all data.

  2. Use one of the following methods to place a submirror online or offline.

    • 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.

    • Use the metaoffline command to a submirror offline.


      # metaoffline mirror submirror
      

      See the metaoffline(1M) man page for more information.

    • Use the metaonline command to place a submirror online.


      # metaonline mirror submirror
      

      See the metaonline(1M) man page for more information.


Example 11–10 Placing a Submirror Offline


# metaoffline d10 d11
d10: submirror d11 is offlined

In this example, submirror d11 is taken offline from mirror d10. 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.



Example 11–11 Placing a Submirror Online


# metaonline d10 d11d10: submirror d11 is onlined

In this example, submirror d11 is brought back online in mirror d10.


ProcedureHow to Enable a Slice in a Submirror

Before You Begin

Read Overview of Replacing and Enabling Components in RAID-1 and RAID-5 Volumes and Creating and Maintaining RAID-1 Volumes.

Steps
  1. Make sure that you have root privilege and that you have a current backup of all data.

  2. Use one of the following methods to enable a slice in 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 Submirror tab. Follow the onscreen instructions. For more information, see the online help.

    • Use the metareplace command to enable a failed slice in a submirror.


      # metareplace -e mirror failed-slice 
      

      The metareplace command automatically starts a resynchronization to synchronize the repaired or replaced slice with the rest of the mirror.

      See the metareplace(1M) man page for more information.


Example 11–12 Enabling a Slice in a Submirror


# metareplace -e d11 c1t4d0s7
d11: device c1t4d0s7 is enabled

In this example, the mirror d11 has a submirror that contains slice, c1t4d0s7, which had a soft error. The metareplace command with the -e option enables the failed slice.

If a physical disk is defective, you can replace it with another available disk (and its slices) on the system as documented in How to Replace a Slice in a Submirror. Alternatively, you can repair or replace the disk, format it, and then run the metareplace command with the -e option as shown in this example.


Maintaining RAID-1 Volumes

ProcedureHow to View the Status of Mirrors and Submirrors

Before You Begin

For an overview of the status information associated with RAID-1 volumes and submirrors, see Understanding Submirror Status to Determine Maintenance Actions.

Step

    Use one of the following methods to the check mirror or submirror status.

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties. Follow the onscreen instructions. For more information, see the online help.

    • Run the metastat command on the mirror to view the status of each submirror.


      # metastat mirror
      

      See How to Change RAID-1 Volume Options to change a mirror's pass number, read option, or write option.

      See metastat(1M) for more information about checking device status.


Example 11–13 Checking Status of RAID-1 Volumes

Here is sample output from the metastat command. Use metastat command without a mirror name to display all the status of all mirrors.


# metastatd70: 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        
 
...

Use the metastat command with a mirror name argument to display output for a specific mirror.


metastat d70
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    

For each submirror in the mirror, the metastat command shows the status, an “invoke” 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.


ProcedureHow to Change RAID-1 Volume Options

Before You Begin

Check About RAID-1 Volume Options.

Steps
  1. Make sure that you have root privilege and that you have a current backup of all data.

  2. Use one of the following methods to change the RAID-1 options.

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties. Follow the onscreen instructions. For more information, see the online help.

    • Use the metaparam command to display and change a mirror's options.


      # metaparam [mirror options] mirror
      

      See About RAID-1 Volume Options for a description of mirror options. Also, see the metaparam(1M) man page.


Example 11–14 Changing a RAID-1 Volume's Read Policy


# metaparam -r geometric d30
# metaparam d30
d30: mirror current parameters are:
    Pass: 1
    Read option: geometric (-g)
    Write option: parallel (default)

In this example, the -r option changes a mirror's read policy to geometric.



Example 11–15 Changing a RAID-1 Volume's Write Policy


# metaparam -w serial d40
# metaparam d40
d40: mirror current parameters are:
    Pass: 1
    Read option: roundrobin (default)
    Write option: serial (-S)

In this example, the -w option changes a mirror's write policy to serial.



Example 11–16 Changing a RAID-1 Volume's Pass Number


# metaparam -p 5 d50
# metaparam d50
d50: mirror current parameters are:
    Pass: 5
    Read option: roundrobin (default)
    Write option: parallel (default)

In this example, the -p option changes a mirror's pass number to 5.


ProcedureHow to Expand a RAID-1 Volume

Before You Begin

Read Creating and Maintaining RAID-1 Volumes.

Steps
  1. Make sure that you have root privilege and that you have a current backup of all data.

  2. Use one of the following methods to expand a mirror.

    • 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.

    • Use the metattach command to attach additional slices to each submirror.


      # metattach submirror slice
      

      Each submirror in a mirror must be expanded. See the metattach(1M) man page for more information.

  3. Use the metattach command to cause the mirror to recompute its size based on the size of the submirror.


    # metattach mirror
    

Example 11–17 Expanding a Two-Way Mirror That Contains a Mounted File System


# metastat
d8: Mirror
    Submirror 0: d9
      State: Okay        
    Submirror 1: d10
      State: Okay        
...
# metattach d9 c0t2d0s5
d9: component is attached
# metattach d10 c0t3d0s5
d10: component is attached
# metattach d8

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 d8 and contains two submirrors named d9 and d10.


See Also

For a UFS, run the growfs(1M) command on the mirror volume. See How to Expand a File System.

An application, such as a database, that uses the raw volume must have its own way of expanding the added storage.

Responding to RAID-1 Volume Component Failures

ProcedureHow to Replace a Slice in a Submirror

Before You Begin

Read Overview of Replacing and Enabling Components in RAID-1 and RAID-5 Volumes and Creating and Maintaining RAID-1 Volumes.

Steps
  1. Make sure that you have root privilege and that you have a current backup of all data.

  2. Use the metastat command to view the status of the RAID-1 volume and associated submirrors.


    # metastat mirror-name
    
  3. Use one of the following methods to replace a slice in 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 Submirror tab. Follow the onscreen instructions. For more information, see the online help.

    • Use the following form of the metareplace command to replace a slice in a submirror:


      # metareplace mirror-name component-name
      
      • mirror-name is the name of the volume to create.

      • component-name specifies the name of the component to replace.

      mirror-name

      Specifies the name of the volume to create

      component-name

      Specifies the name of the component to replace

      See the following examples and the metainit(1M) man page for more information.


Example 11–18 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 16, 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.


ProcedureHow to Replace a Submirror

Before You Begin

Read Overview of Replacing and Enabling Components in RAID-1 and RAID-5 Volumes and Creating and Maintaining RAID-1 Volumes.

Steps
  1. Make sure that you have root privilege and that you have a current backup of all data.

  2. Use the metastat command to view the status of the RAID-1 volume and associated submirrors.


    # metastat mirror-name
    
  3. 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 Submirror tab. Follow the onscreen instructions. For more information, see the online help.

    • Use the metadetach, metaclear, metatinit, and metattach commands to replace an entire submirror.

      1. Use the metadetach command to the failed submirror from the mirror.


        # metadetach -f mirror-name submirror
        
        -f

        Forces the detach to occur

        mirror-name

        Specifies the name of the mirror

        submirror

        Specifies the submirror to detach

      2. Use the metaclear command to delete the submirror.


        # metaclear -f submirror
        
        -f

        Forces the deletion of the submirror to occur

        submirror

        Specifies the submirror to delete

      3. Use the metainit command to create a new submirror.


        # metainit volume-name number-of-stripes components-per-stripe component-name
        
        volume-name

        Specifies the name of the volume to create. For information on naming volumes, see Volume Names.

        number-of-stripes

        Specifies the number of stripes to create.

        components-per-stripe

        Specifies the number of components each stripe should have.

        component-names

        Specifies the names of the components that are used. This example uses the root slice, c0t0d0s0.

      4. Use the metattach command to attach the new submirror.


        # metattach mirror submirror
        

Example 11–19 Replacing a Submirror in a Mirror

The following example illustrates how to replace a submirror in an active mirror.


# 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

In this example, 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 needs to be cleared and recreated. The metadetach command detaches the failed submirror from the mirror by using the -f option, which forces the detachment to occur. The metaclear command clears the submirror. The metainit command recreates submirror, d22, with new slices. Finally, the metattach command attaches the rebuilt submirror. A mirror resynchronization begins automatically.

The specific configuration of the new volume, d22, 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.

You temporarily lose the capability for data redundancy while the mirror is a one-way mirror.


Removing RAID-1 Volumes (Unmirroring)

ProcedureHow 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.

Before You Begin

Read Creating and Maintaining RAID-1 Volumes.

Steps
  1. Make sure that you have root privilege and that you have a current backup of all data.

  2. Verify that at least one submirror is in the Okay state.


    # metastat mirror
    
  3. Unmount the file system.


    # umount /file-system
    
  4. Detach the submirror that will continue to be used for the file system.


    # metadetach mirror submirror
    

    For more information, see the metadetach(1M) man page.

  5. Clear the mirror and remaining subcomponents.


    # metaclear -r mirror
    

    For more information, see the metaclear(1M) man page.

  6. Edit the /etc/vfstab file to use the component detached in Step 4, if necessary.

  7. Remount the file system.


    # mount /file-system
    

Example 11–20 Unmirroring the /opt File System


# metastat d4
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 

...
# 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 file system is composed of a two-way mirror, d4. The submirrors of the mirror are d2 and d3. The submirrors are composed of slices /dev/dsk/c0t0d0s0 and /dev/dsk/c1t0d0s0. 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.

In this example the /etc/vfstab file contains the following entry for the /opt file system:


/dev/md/dsk/d4  /dev/md/rdsk/d4  /opt ufs  2  yes -

Change the entry to read as follows:


/dev/md/dsk/d2  /dev/md/rdsk/d2  /opt 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.

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.


ProcedureHow to Unmirror a File System That Cannot Be Unmounted

Use this task to unmirror file systems, including root (/), /usr, /opt, and swap, that cannot be unmounted during normal system operation.

Steps
  1. Make sure that you have root privilege and that you have a current backup of all data.

  2. Verify that at least one submirror is in the Okay state.


    # metastat mirror
    
  3. Detach the submirror that will continue to be used for the file system.


    # metadetach mirror submirror
    

    For more information, see the metadetach(1M) man page.

  4. Use one of the following commands, depending the file system you want to unmirror:

    • For the /usr, /opt, or swap file systems, change the file system entry in the /etc/vfstab file to use a non-Solaris Volume Manager device (slice).

    • For the root (/) file system only: run the metaroot command.


      # metaroot rootslice
      

      For more information, see the metaroot(1M) man page.

  5. Reboot the system.


    # reboot
    
  6. Clear the remaining mirror and submirrors.


    # metaclear -r mirror
    

    For more information, see the metaclear(1M) man page.


Example 11–21 Unmirroring the root (/) File System


# metastat d0
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 


# metadetach d0 d20
d0: submirror d20 is detached
# metaroot /dev/dsk/c0t3d0s0
# reboot
...
# metaclear -r d0
d0: Mirror is cleared
d10: Concat/Stripe is cleared
# metaclear d20
d20: Concat/Stripe is cleared

In this example, the root (/) file system is a two-way mirror, d0. The submirrors of the mirror are d10 and d20. The submirrors are composed of slices /dev/dsk/c0t3d0s0 and /dev/dsk/c1t3d0s0. 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.) Submirror d20 is detached to make d0 a one-way mirror.

The rootslice is the slice containing the root (/) file system. The metaroot command is run, using the rootslice from which the system is going to boot. This command edits the /etc/system and /etc/vfstab files. The command removes information that specifies mirroring of the root (/) file system.

After rebooting the system, the metaclear -r command deletes the mirror and the other submirror, d10. The last metaclear command clears submirror d20.



Example 11–22 Unmirroring the swap File System


# metastat d1
d1: Mirror
    Submirror 0: d11
      State: Okay        
    Submirror 1: d21
      State: Okay        
...
# metadetach d1 d21
d1: submirror d21 is detached
(Edit the /etc/vfstab file to change the entry for swap from  metadevice to slice name)
# reboot
...
# metaclear -r d1
d1: Mirror is cleared
d11: Concat/Stripe is cleared
# metaclear d21
d21: Concat/stripe is cleared

In this example, the swap file system is made of a two-way mirror, d1. The submirrors of the mirror are d11 and d21. The submirrors are composed of slices /dev/dsk/c0t3d0s1 and /dev/dsk/c1t3d0s1. 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.) Submirror d21 is detached to make d1 a one-way mirror. Next, the /etc/vfstab file is edited to change the entry for swap to reference the slice that is in submirror d21.

In this example, the /etc/vfstab file contains the following entry for the swap file system:


/dev/md/dsk/d4  /dev/md/rdsk/d4  /opt ufs  2  yes -

/dev/md/dsk/d1 - - swap - no -

Change the entry to read as follows:


/dev/dsk/c0t3d0s1 - - swap - no -

After rebooting the system, the metaclear -r command deletes the mirror and the other submirror, d11. The final metaclear command clears submirror d21.


Backing Up Data on a RAID-1 Volume

Solaris Volume Manager is not meant to be a “backup product.” Solaris Volume Manager does provide a means for backing up mirrored data without causing any of the following to occur:

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.


Note –

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 Chapter 26, Using UFS Snapshots (Tasks), in System Administration Guide: Devices and File Systems.


ProcedureHow to Perform an Online Backup of a RAID-1 Volume

You can use this procedure on any file system except the root (/) file system. Be aware that this type of backup creates a “snapshot” 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.

The following limitations apply to this procedure:

The high-level steps in this procedure are as follows:


Note –

If you use these procedures regularly, put them into a script for ease of use.



Tip –

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.


Steps
  1. Verify that the mirror is in the “Okay” state.

    A mirror that is in the “Maintenance” state should be repaired first.


    # metastat mirror
    
  2. Flush data and UFS logging data from cache to disk and write-lock the file system.


    # /usr/sbin/lockfs -w mount-point 
    

    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 lockfs command is not necessary. You might, however, want to run the appropriate vendor-supplied utility to flush any buffers and lock access.


    Caution – Caution –

    Do not write-lock the root (/) file system. Write-locking the root (/) file system causes the system to hang. If you are backing up your root (/) file system, skip this step.


  3. Detach one submirror from the mirror.


    # metadetach mirror submirror 
    
    mirror

    Is the volume name of the mirror.

    submirror

    Is the volume name of the submirror (volume) being detached.

    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 Step 7.

  4. Unlock the file system and allow writes to continue.


    # /usr/sbin/lockfs -u mount-point 
    

    You might need to perform necessary unlocking procedures based on vendor-dependent utilities used in Step 2.

  5. Use the fsck command to check the file system on the detached submirror. This step ensures a clean backup occurs.


    # fsck /dev/md/rdsk/name
    
  6. Perform a backup of the offlined submirror.

    Use the ufsdump command or your usual backup utility. For information on performing the backup using the ufsdump command, see Performing Mounted Filesystem Backups Using the ufsdump Command.


    Note –

    To ensure a proper backup, use the raw volume name, such as /dev/md/rdsk/d4. Using the raw volume name access to storage that is greater than 2 Gbytes.


  7. Attach the submirror.


    # metattach mirror submirror
    

    Solaris Volume Manager automatically begins resynchronizing the submirror with the mirror.


Example 11–23 Performing an Online Backup of a RAID-1 Volume

This example uses a mirror, d1. The mirror consists of submirrors d2, d3 and d4. The submirror d3 is detached and backed up while submirrors d2 and d4 stay online. The file system on the mirror is /home1.


# metastat d1
d1: Mirror
    Submirror 0: d2
      State: Okay        
    Submirror 1: d3
      State: Okay        
    Submirror 1: d4
      State: Okay        
...

# /usr/sbin/lockfs -w /home1
# metadetach d1 d3
# /usr/sbin/lockfs -u /home1
# /usr/sbin/fsck /dev/md/rdsk/d3
(Perform backup using /dev/md/rdsk/d3)
# metattach d1 d3