Certification Objective 13.02Creating State Databases and Mirrors


Certification Objective 13.02—Creating State Databases and Mirrors

Exam Objective 3.2: Create the state database, build a mirror, and unmirror the root file system.

Solaris Volume Manager manages stare databases and logical volumes. Such creation is one of many management tasks that can be performed by using SVM.

Creating State Databases

You can use either the SVM GUI or the metadb command to create, delete, or check the status of a state database. First, note that the default size for a state database replica in SVM is 8192 blocks (4MB), whereas the default size in Solstice DiskSuite (an older Solaris product for managing volumes) is 1034 blocks. Be sure to take extra precautions if you are upgrading from the DiskSuite to the SVM. For example, if you delete a default size DiskSuite replica and add a default size SVM replica, you are overwriting 8192 - 1034 (that is, 7158) blocks of file system data that is sharing the slice with the replica.

The metadb command has the following syntax:

    metadb <action> [<options>] <component> 

The argument <component> is used to specify the component that holds (or will hold) the replica. You can specify one of the following values for <action>:

  • -a. Add a database replica. Used with the -f option when no database replica exists.

  • -d. Delete all replicas located on the specified slice and update the /kernel/drv/md.conf and /etc/1vm/mddb.cf files accordingly.

  • -f. Use with -a to create the database when no replica exists.

  • -i. Inquire about the status of the replica.

The options specified by the value of <options> are described below:

  • -c <number>. Specify the number of replicas to be added to a specified size. The default is 1.

  • -1 <replicaLength> Specify the size in blocks of the replica that is to be created. The default is 8192.

Now that you know how to use the metadb command to create or delete state databases, here are some practical scenarios and their solutions.

SCENARIO & SOLUTION

How would you issue the metadb command to create an initial (first) state database replica on a new system c0tld0s7?

 metadb -a -f c0t1d0s7 

How would you add a replica to the c0t1d0s7 slice that already has the initial state database?

 metadb -a c0t1d0s7 

How would you delete the replica that you added to c0t1d0s7?

 metadb -d c0t1d0s7 

Next, we explore how to mirror and unmirror a file system.

Performing Mirroring and Unmirroring

A mirror is a RAID 1 volume that is composed of stripe (RAID 0) volumes called submirrors. In other words, a mirror is a volume that maintains identical copies of data in RAID 0 volumes—stripe or concatenation. You can create a mirror for an existing file system.

Building a Mirror

You can create a mirror (RAID 1 volume) from a mounted or an umounted file system. If you create a file system that cannot be unmounted, such as a root (/), you will need to reboot the system after the mirror creation. However, a reboot is not necessary if the mirror creation was performed on an unmounted file system. You can create a mirror by performing the following steps:

  1. First, identify the slice that contains the existing file system to be mirrored. In this example, we use the slice c0t0d0s0.

  2. Create a new RAID 0 volume on the slice from step 1. You can do it by using SMC GUI:

     metainit -f <volumeName> <numberOfStripes> <componentsPerStripe> <componentName> 

    You must use the -f option (which forces the command to continue), when the slice contains a mounted file system. The arguments are explained here:

    • <VolumeName>. Specify the name of the volume that you are creating.

    • <numberOfstripes>. Specify the number of stripes to create in the volume.

    • <componentsPerStripe>. Specify the number of components each stripe should have.

    • <componentNames>. Specify the names of the components that will be used to create the volume, c0t0d0s0 in this example.

  3. Create a second RAID 0 volume on an unused slice, say cltld0s0, to act as the second submirror.

  4. Create a one-way mirror (a mirror that contains only one submirror) by using the SMC GUI, or the following command:

        metainit <volumeName> -m <subMirrorName> 

    The argument <volumeName> specifies the name of the volume that you want to create, the -m option means create a mirror, and the <subMirrorName> argument 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. If the file system you are mirroring is not the root (/) file system, you should edit the /etc/vfstab file to make sure that the file system mount instructions refer to the mirror, not to the block device. For example, an entry like the following in the /etc/vfstab file would be wrong:

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

    Change this entry to read:

     /dev/md/dsk/<mirrorName> /dev/md/rdsk/<mirrorName> /var ufs 2 yes - 

  6. Remount your newly mirrored file system according to one of the following methods depending on the file system you are mirroring:

    • If you are mirroring the root (/) file system, execute the metaroot command to tell the system to boot from the mirror, and then reboot:

          metaroot <volumeName>    # reboot 

    • If you are mirroring a file system that is not the root (/) and that cannot be unmounted, just reboot your system:

          reboot 

      If you are mirroring a file system that can be unmounted, you do not need to reboot. Just unmount and remount the file system:

          umount <fileSystem>    mount <fileSystem> 

  7. Attach the second submirror by issuing the metattach command:

        metattach <volumeName> <submirrorName> 

<volumeName> specifies the name of the RAID 1 volume to which to add the submirror whose name is specified by <submirrorName>.

Once you create a one-way mirror with the metainit command, you should always attach another submirror with the metattach command. This is important because if you do not use the metattach command, resynchronization (the process of copying data from one submirror to another) will not happen.

There will be situations in which you would want to unmirror your mirrored file system.

Unmirroring a Mounted File System

Following is the procedure to unmirror file systems that cannot be unmounted during the normal operation, such as root (/), /usr, /opt, and swap file systems:

  1. Become superuser.

  2. Issue the following command to verify that at least one submirror is in the Okay state:

        metastat <mirror> 

  3. Issue the following command to detach the submirror that you want to continue using for the file system:

        metadetach <mirror> <submirror> 

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

    • For the root (/) file system, execute the metaroot command to tell the system where to boot from:

          metaroot <rootSlice> 

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

  5. Reboot the system:

        reboot 

  6. Clear the remaining mirror and submirrors:

        metaclear -r <mirror> 

This command will recursively delete the metadevices and hot spare pool specified by <mirror> but does not delete the one on which others depend.

The three most important takeaways from this chapter are listed here:

  • Solaris supports RAID 0, RAID 1, RAID 5, RAID 0 + 1, and RAID 1 + 0 volumes. RAID 0 stripe volumes provide only improved I/O performance, whereas RAID 1 and RAID 5 provide fault tolerance through data redundancy.

  • Hot spares provide additional fault tolerance, because a hot spare is a slice that stands ready to replace a failed slice automatically. A hot spare pool can be assigned to multiple volumes, but a given volume can be associated with only one hot spare pool.

  • The configuration and status information of disk sets, hot spares, and logical volumes is contained in a database called a state database.




Sun Certified System Administrator for Solaris 10 Study Guide Exams 310-XXX & 310-XXX
Sun Certified System Administrator for Solaris 10 Study Guide Exams 310-XXX & 310-XXX
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net