Question : Korn shell script to check filesystem and LUN size

Hi

I need help to write a short UNIX Korn shell script (Solaris 10) that creates a basic report showing the size (in GB) of the (for example) /data and /dump filesystems and the overall LUN size .. on a per database basis.

I assume the LUN is the sum of the disks and you can get it using vxprint but I haven't done much KSH scripting before. There will be at least one LUN assigned to each DB running on the server.

Many thanks,
Mike.

Answer : Korn shell script to check filesystem and LUN size

Ok .. I managed to script this myself in the end. I hope my answer can help somebody else. I did it as follows:
.
.
.
# Count number of disks on a server before calculating the LUN size
        Disk_Num=`vxprint  -g $diskg -f -dv | grep "dm " | awk '{print $1}' | wc -l`

# List the LUN size for the DB
# loop through from 1 to $Disk_Nim using
        x=2
        lun_total=0
        Check_Num=`expr $Disk_Num + 2`
        echo ""

        while [ $x -lt $Check_Num ]; do
                disk1=`vxprint -g ${diskg} -f -dv | sed -n "${x}p" | awk '{print $5}'` # gives size of one disk1

        # Change to GB
                disk1a=`expr $disk1 \* 512 / 1024 / 1024 / 1024`

                lun_total=`expr $lun_total + $disk1a`
                x=`expr $x + 1`
        done

# Total Lun size in GB
        echo "LUN Size in Gb: " $lun_total

Random Solutions  
 
programming4us programming4us