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 |