分类:
2005-10-19 10:47:59
The following task mapidentifies 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:
1,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
2,create a command file:
helps you create a shell script with the metassist command to generate the volumes that the command specifies
3,create a volume with a shell script:
shows you how to create the solaris volumes that the metassist command specified with the shell script previously generated by the command
4,create a volume configuration file:
helps you create a volume configuration file, cescribing the characteristics of the volumes you want to create
5,change the volume defaults file:
allows you to set default volume characteristics to customize the behavior of metassist command
使用metassist命令的语法:
# metassist create -s diskset-name -f -r redudancy -a device1,device2... -S size -v verbosity
其中create是用来创建卷的子命令
-s diskset-name参数是确定使用创建卷的disk set名称
-f参数用来确定和卷相联系的热插拔组件
-r redundancy参数用来确定要创建的冗余等级
用metassist命令创建一个shell脚本:
# metassist create -s diskset-name -f -r redundancy -a device1,device2... -S size -v verbosity [-c]
例如:
# 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
#
使用metassist命令将shell脚本保存到一个文件:
# metassist create -s myset -f -r 2 -S 10mb -c > /tmp/metassist-shell-script.sh
执行保存在文本文件里面的shell脚本:
1,确保自从上次保存了shell脚本到文本文件里面之后没有发生变化,并保证你所在路径正是文档所在点
2,执行保存的shell命令
# sh /.metassist-shell-script-name
3,检查状态
# metastat -s diskset-name