Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display ALL scsi/ide devices hirarchy

support utilities

Display ALL scsi/ide devices hirarchy

by  MoshiachNow  Posted    (Edited  )
HI,

Just got tired of all lspv/lsvg/lsfs/lsdev nonsense when logging in to a customer system.
So wrote a small script that displays ALL devices config:
#########################################################################################################
ide0 Available 1G-19 ATA/IDE Controller Device
cd0 Available 1G-19-00 IDE DVD-ROM Drive
scraid0 Available 1Z-08 PCI 4-Channel Ultra3 SCSI RAID Adapter
hdisk4 Available 1Z-08-00-0,0 SCSI Disk Array RAID 5, 700067 MB
hdisk5 Available 1Z-08-00-1,0 SCSI Disk Array RAID 5, 840080 MB
scsi0 Available 1S-08 Wide/Ultra-3 SCSI I/O Controller, LVD/SE, 40 MHz
hdisk0 Available 1S-08-00-8,0 16 Bit LVD SCSI Disk Drive, 34715 MB
hdisk1 Available 1S-08-00-9,0 16 Bit LVD SCSI Disk Drive, 70006 MB
hdisk2 Available 1S-08-00-10,0 16 Bit LVD SCSI Disk Drive, 70006 MB
hdisk3 Available 1S-08-00-11,0 16 Bit LVD SCSI Disk Drive, 34715 MB
ses0 Available 1S-08-00-15,0 SCSI Enclosure Services Device
scsi1 Available 1S-09 Wide/Ultra-3 SCSI I/O Controller, LVD/SE, 40 MHz
scsi2 Available 1c-08 Wide/Fast-20 SCSI I/O Controller, Single_Ended, 20 MHz
#########################################################################################################

The script is below.

#!/bin/ksh
# Written on 1/7/05
# Updated May 31, 2005
# Version 1.12
# The script displays all scsi and ide devices hirarchy

echo "##########################################################################################################"
if lsdev -Cspci|grep sisscsia >/dev/null ;then
ULTRA3=YES #sisscsia ULTRA3 adapter is present
fi
for DEVICE in `lsdev -Cspci | grep -E "scsi|scraid|ide"|awk '{print $1}'` ;do
NOMORE=1 #display lsattr params on scsi boards
device=`lsdev -Cspci | grep $DEVICE` #check for first level devices
if [[ ${DEVICE%[0-9]*} = "scsi" ]] ;then #Check if it's a board or a bus
if [[ $ULTRA3 = YES ]] ;then
printf -- "\t"
fi
SPEED=`lsattr -El $DEVICE | grep -E "max" | awk '{print $2}'`
TYPE=`lsattr -El $DEVICE | awk '/bus_type/ {print $2}'`
printf "%-79s %-13s %-6s %-4s\n" "$device," "$TYPE," "$SPEED" "MHz"
NOMORE=0 #do not display lsattr params on scsi devices on lower levels
elif [[ ${DEVICE%[0-9]*} != "sisscsia" ]] && [[ $ULTRA3 = YES ]] ;then
printf "\t%-70s\n" "$device"
else
printf "%-70s\n" "$device"
fi

for DEVICE1 in `lsdev -p $DEVICE|awk '{print $1}'` ;do
printf -- "\t"
device1=`lsdev -p $DEVICE | grep $DEVICE1` #check for second level devices
if [[ $NOMORE != 0 && ${DEVICE1%[0-9]*} = "scsi" ]] ;then
SPEED=`lsattr -El $DEVICE1 | grep -E "max" | awk '{print $2}'`
TYPE=`lsattr -El $DEVICE1 |awk '/bus_type/ {print $2}'`
printf "%-79s %-13s %-6s %-4s\n" "$device1," "$TYPE," "$SPEED" "MHz"
elif [[ ${DEVICE1%[0-99]*} = "hdisk" ]] ;then
if [[ $ULTRA3 = YES ]] ;then
printf -- "\t"
fi
VG=`lspv | grep $DEVICE1| awk '{print $3}'`
printf -- "%-8s" "$VG:"
SIZE=`bootinfo -s $DEVICE1`
printf "%-77s %-6s %-2s\n" "$device1," "$SIZE" "MB"
elif [[ ${DEVICE1%[0-99]*} = "cd" && ${DEVICE%[0-9]*} = "ide" ]] && [[ $ULTRA3 = YES ]] ;then
printf "\t%-80s\n" "$device1"
else
echo "$device1"
fi
for DEVICE2 in `lsdev -p $DEVICE1|awk '{print $1}'` ;do
printf -- "\t\t"
device2=`lsdev -p $DEVICE1|grep $DEVICE2`
if [[ ${DEVICE2%[0-99]*} = "hdisk" ]] ;then
VG=`lspv | grep $DEVICE2| awk '{print $3}'`
printf -- "%-8s" "$VG:"
SIZE=`bootinfo -s $DEVICE2`
printf "%-77s %-6s %-2s\n" "$device2," "$SIZE" "MB"
else
echo "$device2"
fi
done
done
done
echo "##########################################################################################################"


Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top