|
|||
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 How to Create RAID-1 (mirror) Volumes Using the metassist Command Working With File-Based Data Using the metassist Command How to Create a Command File (Shell Script) Using the metassist Command How to Create a Volume Configuration File Using the metassist Command Changing the Default Behavior of the metassist Command 24. Monitoring and Error Reporting (Tasks) 25. Troubleshooting Solaris Volume Manager (Tasks) A. Important Solaris Volume Manager Files B. Solaris Volume Manager Quick Reference |
Working With File-Based Data Using the metassist CommandThe metassist command enables you to create files that you can use to evaluate volume characteristics or for actual volume creation. Creating a Command File (Shell Script) Using the metassist CommandBy 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. How to Create a Command File (Shell Script) Using the metassist CommandBefore You BeginCheck Prerequisites for Top-Down Volume Creation.
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 Creating a Volume With a Saved Shell Script Created by the metassist CommandAfter 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. How to Execute a Saved metassist Command Shell ScriptBefore You BeginCheck Prerequisites for Top-Down Volume Creation.
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 Creating a Volume Configuration File With the metassist CommandBy 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. How to Create a Volume Configuration File Using the metassist CommandBefore You BeginCheck Prerequisites for Top-Down Volume Creation.
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 |
||
|