Jun.16

Script to Detect un-used/not mounted Storages

simple script to alert unused storage space. This will also tell you active storage path mount points

#!/usr/bin/bash
#created by Ben.T.George
LunId=( `luxadm probe |grep -v “Type:Tape” |grep -v “Node WWN:” | awk -F\/ ‘NR>3{print $4}’|sed ‘s/..$//g’` )
zonelist=( `zoneadm list` )
echo “__________________________________________________________________________________”
zoneadm list -cv
echo “__________________________________________________________________________________”
for luns in “${!LunId[@]}”;do
(echo -e “\x1B[31m ${LunId[$luns]} \x1B[0m”
echo “”
result=$(echo | format “${LunId[$luns]}” 2>&1 |egrep -c ‘(mounted|zpool)’)
if [ $result -gt 0 ]; then
echo -e “\x1B[01;96m ${LunId[$luns]} mounted on: $(mount | grep ${LunId[$luns]} | awk ‘{print $1}’)\x1B[0m”
else
echo -e “\x1B[01;31m ${LunId[$luns]} not mounted \x1B[0m”
fi)&
done

Share this Story:
  • facebook
  • twitter
  • gplus

About bentech4u

Leave a comment