文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>One scripts to restore all metadevice over cluster

One scripts to restore all metadevice over cluster

时间:2007-04-11  来源:nimysun

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
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载