Script to check rootdisk under SVM/VXVM/ZFS !

Script to check rootdisk under SVM/VXVM/ZFS !

root@Labserver# more Script.sh
#!/bin/bash
## to check rootdisk under SVM/VXVM/ZFS
vol=`df -k | head -2| tail -1 | awk '{print $1 }' | cut -c6-10`
if [ $vol = "/ROOT" ]
then
# ZFS
## to check the disk
echo "Server is in ZFS"
zfsdisk=`zpool status rpool | grep s0 | head -1 | awk '{ print $1}' | cut -c1-21`
echo "rootdisk is $zfsdisk"
hard=`iostat -en | grep -i $zfsdisk | awk '{print $2}'`
echo "hardware error : $hard"
elif [ $vol = "md/ds" ]
then
## SVM
echo "Server is in SVM"
svmdisk=`metadb -i | grep -i m | grep -i dsk | awk '{print $7}' | cut -c10- | cut -c1-6`
echo "rootdisk is $svmdisk"
hard=`iostat -en | grep -i $svmdisk | awk '{print $2}'`
echo "hardware error : $hard"
elif [ $vol = "vx/ds" ]
then
## VXVM
echo "Server is in VXVM"
dgname=`vxdg bootdg`
vxvmdisk=`vxdisk -e list | grep -i $dgname | grep -i rootdisk | awk '{print $6}' | cut -c1-6`
echo "rootdisk is $vxvmdisk"
hard=`iostat -en | grep -i $vxvmdisk | awk '{print $2}'`
echo "hardware error : $hard"
else
## Single disk
echo "Server is up on single disk"
disk=`df -k | head -2| tail -1 | awk '{print $1 }' | cut -c10- | cut -c1-6`
echo "rootdisk is $disk"
hard=`iostat -en | grep -i $disk | awk '{print $2}'`
echo "hardware error : $hard"
fi
root@Labserver#

Leave a Reply

Your email address will not be published. Required fields are marked *