Tag Archives: disks

aix disks that are currently not being used

Lists SSA disks that are currently not being used by either the OS or other  applications.  Lists what size the disk is and which enclosure and slot the disk is located in.

#!/bin/ksh

printf “Please wait, this could take a while… nn”

for pdisk in `lsdev -Cc pdisk | awk ‘/SSA/{print $1}’`
do
hdisk=`ssaxlate -l ${pdisk}`
if [ “${hdisk}” ]
then
vg=`lspv |grep ${hdisk}| awk ‘{print $3}’| head -1`
vgstatus=`lsvg -o | grep “${vg}”`
if [ “${vgstatus}” = “${vg}” ]
then
diskinfo=`lspv -l ${hdisk}`

if [ ! “${diskinfo}” ]
then
size=`lsattr -El ${pdisk} | awk ‘/size_in_mb/{print $2}’`
slot=`lsdev -Cc pdisk | grep ${pdisk} | awk -F”-” ‘{print $3,$4}’ | head -1`
echo “${hdisk}: size=${size}”
echo “Location: ${slot}”
echo
fi
fi
fi
done