小弟写的一个查看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.
--------------------------------------------------------------