ChinaUnix.net
 >> ChinaUnix.net > Solaris

查看veritas volume 磁盘组空间的一个脚本

作者:twlogin     发表时间:2002/12/02 04:27pm

小弟写的一个查看veritas volume 磁盘组空间的一个脚本 ,希望对大家有点用 呵呵

#!/usr/bin/ksh

echo "#######################################################################"
echo "#@auth twlogin twlogin@cta.cq.cn"
echo "#date 2002-10-18"
echo "#######################################################################"


disk_groups=`/usr/sbin/vxdg list | grep enabled | grep -v root | awk '{print $1}'`

       for list in $disk_groups

       do

        total_space=0


     /usr/sbin/vxprint -d -g $list  | awk '{print $5}' | grep -v LENGTH | while read line


               do

                        total_space=`expr $total_space + $line`
                        echo "$total_space" > total_space

               done


                        space_used=0


     /usr/sbin/vxprint -f -g $list | grep "v " | grep -v root |  awk '{print $5}' | while read l
ine


                       do

                        space_used=`expr $space_used + $line`
                        echo "$space_used" > space_used

                       done
                        space_used=$space_used

         total_space=`cat total_space`
         space_used=`cat space_used`
        total_space=`expr $total_space / 2`

        total_space=`expr $total_space / 1048576`

        space_used=`expr $space_used / 2`

        space_used=`expr $space_used / 1048576`

        available=`expr  $total_space - $space_used`
         rm total_space
         rm space_used


               echo

               echo "当前系统磁盘组: $list"

               echo

               echo "---------------------------------------------------------------"

       echo "分配给磁盘组 $list 的总空间位:  $total_space GB"

       echo "磁盘组 $list 当前已用空间为  :$space_used GB"

     echo "磁盘组 $list 剩余空间为: $available GB."

               echo "--------------------------------------------------------------"

               echo

               echo

       done

输出结果为:
当前系统磁盘组: msgdg

---------------------------------------------------------------
分配给磁盘组 msgdg 的总空间位:  710 GB
磁盘组 msgdg 当前已用空间为  :320 GB
磁盘组 msgdg 剩余空间为: 390 GB.
--------------------------------------------------------------


此文章相关评论:
该文章有6个相关评论如下:(点这儿可以发表评论)
twlogin 发表于: 2002/12/02 05:02pm
怎么没人捧场啊 :《
 
Obrother 发表于: 2002/12/02 05:28pm
只是为VM, 有其他的功能吗?
 
twlogin 发表于: 2002/12/02 05:37pm
说来听听
 
科学球 发表于: 2002/12/02 05:43pm
我来捧场,我来捧场:)

我刚看见嘛~~~~

 
twlogin 发表于: 2002/12/02 05:51pm
谢谢 呵呵
 
YT 发表于: 2002/12/02 10:08pm
我也来捧场!
高手啊,,,,偶可找到你了。。。。。
 
 

Copyright © ChinaUnix.net  *  转载请注明出处及作者