This chapter provides tasks associated with Solaris Volume Manager top-down volume creation using the metassist command.
This is a list of the information in this chapter:
For conceptual information about top-down volume creation, see Chapter 22, Top-Down Volume Creation (Overview).
The following task map identifies the procedures needed to create Solaris Volume Manager volumes using the metassist command. This command enables you to specify volumes based on quality-of-service characteristics and to create sets of layered volumes with a single command.
Task |
Description |
Instructions |
---|---|---|
Create volumes automatically |
Enables you to use the metassist command to create one or more Solaris Volume Manager volumes. Also, enables you to control the amount of information about the volume creation process that the metassist command provides for troubleshooting or for diagnosing problems. | |
Create a command file |
Helps you create a shell script with the metassist command to generate the volumes that the command specifies. |
Creating a Volume Configuration File With the metassist Command |
Create a volume with a shell script |
Shows you how to create the Solaris Volume Manager volumes that the metassist command specified with the shell script previously generated by the command. |
Creating a Volume With a Saved Shell Script Created by the metassist Command |
Create a volume configuration file |
Helps you create a volume configuration file, describing the characteristics of the volumes you want to create. |
Creating a Volume Configuration File With the metassist Command |
Change the volume defaults file |
Allows you to set default volume characteristics to customize the behavior of metassist command. |
Creating volumes and volume configurations automatically using the metassist command requires that you have a functional Solaris Volume Manager configuration. Before you begin, you should have the following:
Superuser access, or be able to assume an equivalent role-based access control (RBAC) role. See Becoming Superuser (root) or Assuming a Role in System Administration Guide: Basic Administration for more information.
State database replicas, distributed appropriately for your system. See About the Solaris Volume Manager State Database and Replicas for more information about state database replicas.
Available disks for creating volumes. The metassist command uses disk sets to help manage storage. Completely unused disks (or an existing disk set) must be available to create new volumes using the metassist command. See Determining Which Disks Are Available for Top-Down Volume Creation for more information about disk availability.
In addition to these minimum requirements, do not disable the Solaris Volume Manager RPC daemons (rpc.metad, rpc.metamhd, and rpc.metamedd) in the /etc/inetd.conf file. These daemons are configured to start by default. They must remain enabled to allow Solaris Volume Manager to use shared disk sets.
The metassist command enables you to create Solaris Volume Manager volumes, as well as sets of volumes, based on quality-of-service criteria. The metassist command creates volumes for you with one command, rather than the series of commands that Solaris Volume Manager traditionally requires to create volumes.
You can use the metassist command to create RAID-1 (mirror) volumes directly. Thus, you do not have to first create the submirrors (concatenations or stripes) that are used as components of the RAID-1 (mirror) volume.
When you run the metassist command, you can specify the level of verbose output. More verbose output can help diagnose problems, such as determining why disks were or were not selected for use in a volume, or to determine why a specific attempted command failed. Less verbose output can reduce the amount of extraneous information that you must review.
When you specify output verbosity, you can learn what the metassist command does and how it makes its decisions. This information is useful for troubleshooting some of the following:
Why a volume was created in a certain way
Why a volume was not created
What volumes the metassist command would create, without actually creating the volumes
Check Prerequisites for Top-Down Volume Creation.
Identify the available storage on which to create the volume.
If you do not explicitly specify storage, Solaris Volume Manager identifies unused storage on the system and uses it, as appropriate. If you choose to specify storage, either broadly (for example, all storage on controller 1) or specifically (for example, use c1t4d2, but do not use c1t4d1), Solaris Volume Manager uses the storage you specify.
Use the metassist command and the appropriate options for your task.
To create volumes from the command line, use the following form of the metassist command.
# metassist create -s diskset-name -f -r redundancy -a device1, device2... -S size -v verbosity |
Is the subcommand used to create volumes.
Specifies the name of the disk set to use for the volume.
Specifies that the volume be associated with a hot spare.
Specifies the level of redundancy (number of data copies) to create.
Specifies the devices that are available for creating the volume.
Specifies the size of the volume to create in KB, MB, GB, or TB, for kilobytes, megabytes, gigabytes, and terabytes, respectively.
Specifies how verbose the output should be. Allowable values range from 0 (nearly silent output) to 2 (significant output). The default level is 1 (moderate output).
To create volumes using an input file to specify volume characteristics, use one of the following forms of the metassist command.
# metassist create [-v n] [-c] -F config_file # metassist create [-v n] [-c | -d] -F request_file |
Specifies to output the command script that would implement the specified or generated volume configuration. The command script is not run, and processing stops at this stage.
Specifies to output the volume configuration that satisfies the specified or generated volume request. No command script is generated or executed, and processing stops at this stage.
Specifies the volume request or volume configuration file to process. If config_file or request_file is specified as a dash (-), it is read from standard input. The -d option cannot be specified when input file is a volume configuration file.
A volume configuration file describes detailed configurations of the volumes to be created, while a volume request file provides characteristics for the volumes to be produced. For more information, see volume-config(4)volume-config(4) and volume-request(4) man pages.
Specifies how verbose the output should be. Allowable values range from 0 (nearly silent output) to 2 (significant output). The default level is 1 (moderate output).
See the following examples and the metassist(1M) man page for more information.
Once you have created the volumes, view the new volumes.
# metastat -s diskset-name |
The following example shows how to create a two-way mirror, 10 Mbytes in size. The metassist command identifies unused disks and creates the best mirror possible using those disks. The -s myset argument specifies that the volumes will be created in the myset disk set. The disk set is created, if necessary.
# metassist create -s myset -r 2 -S 10mb |
The following example shows how to use the metassist command to create a two-way mirror, 10 Mbytes in size, with a hot spare to provide additional fault tolerance. The -f option specifies the fault tolerance.
# metassist create -s myset -f -r 2 -S 10mb |
The following example shows how to use the metassist command to create a stripe using disks available on controller 1. The -a option specifies the available controller.
# metassist create -s myset -a c1 -S 10mb |
The following example shows how to use the metassist command to create a two-way mirror, 10 Mbytes in size, with a hot spare to provide additional fault tolerance. The -f option specifies fault tolerance. The final argument (-v 2) specifies a verbosity level of two, which is the maximum level and will provide the most information possible about how the metassist command worked.
# metassist create -s myset -f -r 2 -S 10mb -v 2 Scanning system physical device configuration... These HBA/Controllers are known:. c0 /pci@1f,0/pci@1,1/ide@3 c1 /pci@1f,0/pci@1/pci@2/SUNW,isptwo@4 These disks are known: c0t0d0 id1,dad@AST34342A=____________VGD97101 c1t1d0 id1,sd@SSEAGATE_ST39204LCSUN9.0G3BV0L88P000021097XNL c1t2d0 id1,sd@SSEAGATE_ST39102LCSUN9.0GLJW22867000019171JDF c1t3d0 id1,sd@SSEAGATE_ST39204LCSUN9.0G3BV0L7RV00007108TG0H c1t4d0 id1,sd@SSEAGATE_ST39204LCSUN9.0G3BV0LDFR000021087R1T c1t5d0 id1,sd@SSEAGATE_ST39204LCSUN9.0G3BV0L0M200002109812L c1t6d0 id1,sd@SSEAGATE_ST39204LCSUN9.0G3BV0L8K8000021087R0Z . . . (output truncated) |
The following example shows how to use the metassist command to create a two-way mirror, 10 Mbytes in size, with a hot spare to provide additional fault tolerance. The -f option specifies fault tolerance. The final argument (-v 0) specifies a verbosity level of zero, which is the minimum level and will provide nearly silent output when the command runs.
# metassist create -s myset -f -r 2 -S 10mb -v 0 myset/hsp000: Hotspare pool is setup myset/hsp000: Hotspare is added myset/d2: Concat/Stripe is setup myset/d1: Concat/Stripe is setup myset/d0: Mirror is setup myset/d0: submirror myset/d1 is attached |
The following example shows how to use the metassist command to create a volume using an input file.
# metassist create -F request.xml |
For more information on using input files with the metassist command, see Working With File-Based Data Using the metassist Command.
The metassist command enables you to create files that you can use to evaluate volume characteristics or for actual volume creation.
By running the metassist command with the -c argument, you can generate a Bourne shell script containing the commands that would be used to create the volume configuration. This technique enables you to review the commands before actually creating the volume, or even to modify the script somewhat to meet specific needs.
Check Prerequisites for Top-Down Volume Creation.
Identify the available storage on which to create the volume.
If you do not explicitly specify storage, Solaris Volume Manager identifies unused storage on the system and uses it, as appropriate. If you choose to specify storage, either broadly (for example, all storage on controller 1) or specifically (for example, use c1t4d2, but do not use c1t4d1), Solaris Volume Manager uses the storage you specify.
Use the metassist command and the appropriate options for your task.
Use the -c option to specify that the volume should not actually be created.
# metassist create -s diskset-name -f -r redundancy -a device1, device2... \ -S size -v verbosity [-c] |
Is the subcommand used to create volumes.
Specifies the name of the disk set to use for the volume.
Specifies that the volume be associated with a hot spare.
Specifies the level of redundancy (number of data copies) to create.
Specifies the devices that are available for creating the volume.
Specifies the size of the volume to create in KB, MB, GB, or TB, for kilobytes, megabytes, gigabytes, and terabytes, respectively.
Specifies how verbose the output should be. Allowable values range from 0 (nearly silent output) to 2 (significant output). The default level is 1 (moderate output).
Specifies that the volume should not actually be created. Instead, a shell script that can be used to create the specified configuration is sent to standard output.
The shell script required by the -c argument is sent to standard output, while the rest of the output from the metassist command goes to standard error. You can redirect the output streams as you choose.
See the following examples and the metassist(1M) man page for more information.
The following example shows how to use the metassist command to create a two-way mirror, 10 Mbytes in size, with a hot spare to provide additional fault tolerance. The -f option specifies fault tolerance. The final argument (-c) specifies that the volume should not actually be created. Rather, a shell script that could be used to create the specified configuration should be sent to standard output.
# metassist create -s myset -f -r 2 -S 10mb -c (output truncated) . . . Volume request completed successfully. #!/bin/sh # # Environment # # Amend PATH PATH="/usr/sbin:/usr/bin:$PATH" export PATH # Disk set name diskset='myset' # # Functions # # Echo (verbose) and exec given command, exit on error execho () { test -n "$verbose" && echo "$@" "$@" || exit } # Get full /dev/rdsk path of given slice fullpath () { case "$1" in /dev/dsk/*|/dev/did/dsk/*) echo "$1" | sed 's/dsk/rdsk/' ;; /*) echo "$1" ;; *) echo /dev/rdsk/"$1" ;; esac } # Run fmthard, ignore partboot error, error if output fmthard_special () { ignore='Error writing partboot' out=`fmthard "$@" 2>&1` result=$? echo "$out" | case "$out" in *"$ignore"*) grep -v "$ignore"; return 0 ;; '') return "$result" ;; *) cat; return 1 ;; esac >&2 } # # Main # # Verify root if [ "`id | sed 's/^[^(]*(\([^)]*\).*/\1/'`" != root ] then echo "This script must be run as root." >&2 exit 1; fi # Check for verbose option case "$1" in -v) verbose=1 ;; *) verbose= ;; esac # Does the disk set exist? if metaset -s "$diskset" >/dev/null 2>&1 then # Take control of disk set execho metaset -s "$diskset" -t else # Create the disk set autotakeargs= /usr/sbin/clinfo || autotakeargs='-A enable' execho metaset -s "$diskset" $autotakeargs -a -h `uname -n | cut -f1 -d.` fi # Format slices execho fmthard_special -d 7:0:0:0:0 `fullpath c1t3d0s7` execho fmthard_special -d 7:0:0:0:0 `fullpath c1t6d0s7` execho fmthard_special -d 7:0:0:0:0 `fullpath c1t4d0s7` # Add disks to set execho metaset -s "$diskset" -a c1t3d0 execho metaset -s "$diskset" -a c1t6d0 execho metaset -s "$diskset" -a c1t4d0 # Format slices execho fmthard_special -d 0:4:0:10773:17649765 `fullpath c1t3d0s0` execho fmthard_special -d 0:4:0:10773:17649765 `fullpath c1t6d0s0` execho fmthard_special -d 0:4:0:10773:17649765 `fullpath c1t4d0s0` execho fmthard_special -d 1:4:0:17660538:21546 `fullpath c1t3d0s1` execho fmthard_special -d 1:4:0:17660538:21546 `fullpath c1t4d0s1` execho fmthard_special -d 1:4:0:17660538:21546 `fullpath c1t6d0s1` # Does hsp000 exist? metahs -s "$diskset" -i hsp000 >/dev/null 2>&1 || { # Create hsp hsp000 execho metainit -s "$diskset" hsp000 } # Add slices to hsp000 execho metahs -s "$diskset" -a hsp000 c1t3d0s1 # Create concat d2 execho metainit -s "$diskset" d2 1 1 c1t4d0s1 # Associate concat d2 with hot spare pool hsp000 execho metaparam -s "$diskset" -h hsp000 d2 # Create concat d1 execho metainit -s "$diskset" d1 1 1 c1t6d0s1 # Associate concat d1 with hot spare pool hsp000 execho metaparam -s "$diskset" -h hsp000 d1 # Create mirror d0 execho metainit -s "$diskset" d0 -m d2 1 execho metattach -s "$diskset" d0 d1 # |
The following example shows how to use the metassist command to create a two-way mirror, 10 Mbytes in size, with a hot spare to provide additional fault tolerance. The -f option specifies fault tolerance. The final argument (-c) specifies that the volume should not actually be created. Rather, a shell script that could be used to create the specified configuration should be sent to standard output. The end of the command redirects standard output to create the /tmp/metassist-shell-script.sh shell script that can later be used to create the specified volume.
# metassist create -s myset -f -r 2 -S 10mb -c > \ /tmp/metassist-shell-script.sh |
After you have created a shell script with the metassist command, you can use that script to create the volumes that you specified when the shell script was created.
The command script created by the metassist command has significant dependencies on the specific system configuration of the system on which the script was created, at the time the script was created. Using the script on different systems or after any changes to the system configuration can lead to data corruption or loss.
Check Prerequisites for Top-Down Volume Creation.
Ensure that the system configuration has not changed since the shell script was created, and that you are executing the script on the same system it was created on.
Execute the saved shell script.
# sh ./metassist-shell-script-name |
View the new volume.
# metastat -s diskset-name |
The following example shows how to use the metassist command to create a volume using a shell script.
# sh ./tmp/metassist-shell-script.sh myset/hsp000: Hotspare pool is setup myset/hsp000: Hotspare is added myset/d2: Concat/Stripe is setup myset/d1: Concat/Stripe is setup myset/d0: Mirror is setup myset/d0: submirror myset/d1 is attached |
By running the metassist command with the -d argument, you can generate an XML-based volume configuration file that specifies the volumes and their components in detail, including all options and relevant information about the volumes. Reviewing this file helps you to understand the configuration that the metassist command recommends. Making careful changes to this file can also enable you to fine-tune the configuration, then to use the volume configuration file as input to the metassist command to actually create volumes.
Check Prerequisites for Top-Down Volume Creation.
Identify the available storage on which to create the volume.
If you do not explicitly specify storage, Solaris Volume Manager identifies unused storage on the system and uses it, as appropriate. If you choose to specify storage, either broadly (for example, all storage on controller 1) or specifically (for example, use c1t4d2, but do not use c1t4d1), Solaris Volume Manager uses the storage you specify.
Use the metassist command and the appropriate options for your task.
Use the -d option to specify that the volume should not actually be created. Instead, an XML-based volume configuration file is sent to standard output:
# metassist create -s diskset-name -f -r redundancy -a device1, device2... \ -S size -v verbosity [-d] |
Is the subcommand used to create volumes.
Specifies the name of the disk set to use for the volume.
Specifies that the volume be associated with a hot spare.
Specifies the level of redundancy (number of data copies) to create.
Specifies the devices that are available for creating the volume.
Specifies the size of the volume to create in KB, MB, GB, or TB, for kilobytes, megabytes, gigabytes, and terabytes, respectively.
Specifies how verbose the output should be. Allowable values range from 0 (nearly silent output) to 2 (significant output). The default level is 1 (moderate output).
Specifies that the volume should not actually be created.
The XML-based volume configuration file required by the -d argument is sent to standard output. However, the rest of the output from the metassist command goes to standard error. You can redirect the output streams as you choose.
See the following examples and the metassist(1M) man page for more information.
This example shows how to use the metassist command to create a two-way mirror, 10 Mbytes in size, with a hot spare to provide additional fault tolerance. The -f option specifies fault tolerance. The final argument (-d) specifies that the volume should not actually be created. Rather, a volume configuration file that could eventually be used to create the specified configuration should be sent to standard output.
# metassist create -s myset -f -r 2 -S 10mb -d .(output truncated) . . Volume request completed successfully. <?xml version="1.0"?> <!DOCTYPE volume-config SYSTEM "/usr/share/lib/xml/dtd/volume-config.dtd"> <volume-config> <diskset name="myset"/> <disk name="c1t3d0"/> <disk name="c1t6d0"/> <disk name="c1t4d0"/> <slice name="c1t3d0s7" sizeinblocks="0"/> <slice name="c1t3d0s0" sizeinblocks="17649765" startsector="10773"/> <slice name="c1t6d0s7" sizeinblocks="0"/> <slice name="c1t6d0s0" sizeinblocks="17649765" startsector="10773"/> <slice name="c1t4d0s7" sizeinblocks="0"/> <slice name="c1t4d0s0" sizeinblocks="17649765" startsector="10773"/> <hsp name="hsp000"> <slice name="c1t3d0s1" sizeinblocks="21546" startsector="17660538"/> </hsp> <mirror name="d0" read="ROUNDROBIN" write="PARALLEL" passnum="1"> <concat name="d2"> <slice name="c1t4d0s1" sizeinblocks="21546" startsector="17660538"/> <hsp name="hsp000"/> </concat> <concat name="d1> <slice name="c1t6d0s1"sizeinblocks="21546" startsector="17660538"/> <hsp name="hsp000"/> </concat> </mirror> </volume-config> # |
This example shows how to use the metassist command to create a two-way mirror, 10 Mbytes in size, with a hot spare to provide additional fault tolerance. The -f option specifies fault tolerance. The final argument (-d) specifies that the volume should not actually be created. Rather, a volume configuration file that could eventually be used to create the specified configuration should be sent to standard output. The end of the command redirects standard output to create the /tmp/metassist-volume-config.xml volume configuration file that can later be used to create the specified volume.
# metassist create -s myset -f -r 2 -S 10mb -d > \ /tmp/metassist-volume-config.xml |
You can use the volume defaults file (/etc/defaults/metassist.xml) to change the default behavior for the metassist command. By changing the defaults file, you can explicitly exclude from consideration, or include for consideration, specific disks or controllers. You can also specify requirements for most volume settings used by the metassist command.
The format of the /etc/defaults/metassist.xml is specified by the /usr/share/lib/xml/dtd/volume-defaults.dtd Document Type Definition (DTD). The format is documented in the volume-defaults(4) man page.
Edit the volume defaults file (/etc/defaults/metassist.xml) to specify how the metassist command should behave.
When you edit the file, you must ensure that the file continues to be compliant with the /usr/share/lib/xml/dtd/volume-defaults.dtd Document Type Definition (DTD). If the XML file is not compliant with the DTD, the metassist command will fail with an error message.
Before creating a volume, edit the /etc/default/metassist.xml file to specify the default settings that you want to apply to all volumes you will create with the metassist command. In this example, the metassist command only creates volumes on controller c1 and, when creating stripes, only creates stripes with exactly four components and an interlace of value 512KB. These constraints apply to all uses of the metassist command until the /etc/default/metassist.xml file is changed again.
# cat /etc/default/metassist.xml <!DOCTYPE volume-defaults SYSTEM \ "/usr/share/lib/xml/dtd/volume-defaults.dtd"> <volume-defaults> <available name="c1" /> <stripe mincomp="4" maxcomp="4" interlace="512KB" ></stripe> </volume-defaults> # metassist create -s myset -S 10Gb |
The metassist command creates a 10-Gbyte stripe, using exactly four slices and an interlace value of 512 Kbytes, as specified in the /etc/default/metassist.xml file.