首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 操作系统 > Windows98/ME > One scripts to restore all metadevice over cluster
【标  题】:One scripts to restore all metadevice over cluster
【关键字】:One,scripts,to,restore,all,metadevice,over,cluster
【来  源】:http://www.cublog.cn/u/43/showart.php?id=275917

One scripts to restore all metadevice over cluster

Assume that:
we have the excels including diskset'name & diskset' instance
All the low-layer rawdevices has been produced.
 
Now I can show you one snatch from shell scripts:
It may be noisy as the lack of all key information. Just due to security issue. sorry.
 
#!/usr/bin/sh
FORMAT=/usr/sbin/format
CUT=/usr/bin/cut
AWK=/usr/bin/awk
GREP=/usr/bin/grep
SH=/usr/bin/sh
MV=/usr/bin/mv
CAT=/usr/bin/cat
SORT=/usr/bin/sort
SCDIDADM=/usr/cluster/bin/scdidadm
METAINIT=/usr/sbin/metainit
METATTACH=/usr/sbin/metattach
 
fulllist()
{
if [ -f /tmp/scdid ]; then
/usr/bin/mv /tmp/scdid /tmp/scdid.bak
/usr/cluster/bin/scdidadm -l >/tmp/scdid
fi
/usr/bin/sed 's/://g' volumes.src|/usr/bin/sed 's/__/_/g' | /usr/bin/egrep "ISD|ADM|XREP" | /usr/bin/awk '{print $1,$9 }' |\
while read volname volwwn
do
  did=`/usr/bin/cat /tmp/scdid | /usr/bin/grep $volwwn | /usr/bin/awk '{print $NF}'`
  echo $volname $volwwn $did
done
}

#### create LUNs' labels ####
if [ !  -f /tmp/label ]; then
echo "The file label do NOT exists"
$MV /tmp/label /tmp/label.bak
exit 1
else
$FORMAT </dev/null | $GREP CSM100 | $CUT -d "<" -f 1 | $AWK '{print "/usr/sbin/format -f label /dev/rdsk/"$NF"s2" }'|$SH -v
fi
 
echo "##### disk label Completed ######"
sleep 60

#### put the LUNs into disksets ####
fulllist | $AWK '{
   if ( $1 ~ /ADM/ ) { print " /usr/sbin/metaset -s adm-ds -a ",$NF }
   else {
     if ( $1 ~ /XREP/ ) { print " /usr/sbin/metaset -s xrep-ds -a ",$NF }
       else if ( $1 ~ /ISD/ ) { print "/usr/sbin/metaset -s isd-ds -a",$NF }
        }
                 }' | /usr/bin/sh -v
echo "metaset creatation Completed"
sleep 60
 
###########################################
######### did metadevice relationship #####
fulllist|$AWK 'BEGIN {
        x = 600
        y = 700
        z = 800 }
{
  if ( $1 ~ /ADM/ ) { x++
                print $1,"d"x, $NF }
   else {
    if ( $1 ~ /XREP/ ) { y++
                print $1,"d"y, $NF }
     else if ($1 ~ /ISD/ ) { z++
                print $1,"d"z, $NF }
        }
}' |\
while read i1 i2 i3
do
  j1=`echo $i1|$CUT -d "_" -f 3-`
  j2=`echo $i1|$CUT -d "_" -f2`
  j3=`$GREP $j1 o4|$GREP $j2`
  echo $j3  $i2 $i3 $j2
done |\
awk '{
if ( $1 ~ /ADM/ ) {
                print $2,$3,$4,"adm-ds" }
   else {
    if ( $1 ~ /XREP/ ) { y++
                print  $2,$3,$4,"xrep-ds" }
     else if ($1 ~ /ISD/ ) { z++
                print  $2,$3,$4,"isd-ds" }
                 }
        }' |$SORT |\
awk '{
 if (NR%2==0) { print "/usr/sbin/metainit -s",$4,$2,"1 1 ",$3"s0"
                print "/usr/sbin/metattach -s",$4,$1,$2 }
   else       { print "/usr/sbin/metainit -s",$4,$2,"1 1 ",$3"s0"
                print "/usr/sbin/metainit -s",$4,$1,"-m",$2 }
     }' |$SH -v
沙漠玫瑰:【上一篇】
鼠洞验证 hole.mouse 之-----印象:【下一篇】
【相关文章】
  • 在MYECLIPS中建立动态表单验证框架DynaValidator
  • 硬盘安装CentOS5
  • 使用Castor XML
  • Effective C++读书笔记之在operator=中处理“自我赋值”
  • Ubuntu 6.10下安装source navigator
  • Finally, I resolved the python-devel dependence issue
  • R. Stallman及其生活方式
  • tomcat内存溢出解决
  • Oracle9i for SUN Solaris installation.
  • install grub1.9.5
  • 【随机文章】
  • 获取CPU使用率的C代码
  • 日志简介
  • java读文件
  • CLDC1.1的新特性
  • multiway1.1.2多路负载平衡路由破解补丁
  • virtual PC相关
  • linux中的启动管理编辑器
  • 多线程编程 实战篇秘籍 (二)
  • Perl教学 文件读写
  • Linux常用命令列表(翻译)~~4.1
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.