Skip Navigation Links | |
Exit Print View | |
Solaris Volume Manager Administration Guide Oracle Solaris 10 1/13 Information Library |
1. Getting Started With Solaris Volume Manager
2. Storage Management Concepts
3. Solaris Volume Manager Overview
4. Solaris Volume Manager for Sun Cluster (Overview)
5. Configuring and Using Solaris Volume Manager (Scenario)
8. RAID-0 (Stripe and Concatenation) Volumes (Overview)
9. RAID-0 (Stripe and Concatenation) Volumes (Tasks)
10. RAID-1 (Mirror) Volumes (Overview)
11. RAID-1 (Mirror) Volumes (Tasks)
12. Soft Partitions (Overview)
16. Hot Spare Pools (Overview)
20. Maintaining Solaris Volume Manager (Tasks)
21. Best Practices for Solaris Volume Manager
22. Top-Down Volume Creation (Overview)
23. Top-Down Volume Creation (Tasks)
Top-Down Volume Creation (Task Map)
Prerequisites for Top-Down Volume Creation
Creating Volumes Automatically
Analyzing Volume Creation by Specifying Output Verbosity
How to Create RAID-1 (mirror) Volumes Using the metassist Command
Working With File-Based Data Using the metassist Command
Creating a Command File (Shell Script) Using the metassist Command
How to Create a Command File (Shell Script) Using the metassist Command
Creating a Volume With a Saved Shell Script Created by the metassist Command
How to Execute a Saved metassist Command Shell Script
Creating a Volume Configuration File With the metassist Command
How to Create a Volume Configuration File Using the metassist Command
Changing the Default Behavior of the metassist Command
Changing the Volume Defaults File
24. Monitoring and Error Reporting (Tasks)
25. Troubleshooting Solaris Volume Manager (Tasks)
A. Important Solaris Volume Manager Files
B. Solaris Volume Manager Quick Reference
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.
Before You Begin
Check Prerequisites for Top-Down Volume Creation.
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 -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.
Note - 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.
Example 23-6 Creating a Command File (Shell Script) Using the metassist Command
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 #
Example 23-7 Saving a Command File (Shell Script) Using the metassist Command
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.
Caution - 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. |
Before You Begin
Check Prerequisites for Top-Down Volume Creation.
# sh ./metassist-shell-script-name
# metastat -s diskset-name
Example 23-8 Executing a Saved metassist Command Shell Script
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.
Before You Begin
Check Prerequisites for Top-Down Volume Creation.
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 -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.
Note - 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.
Example 23-9 Creating a Volume Configuration File Using the metassist Command
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> #
Example 23-10 Saving a Volume Configuration File Using the metassist Command
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