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 Chris Miller 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 3

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
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 April 19, 2005
# Version 1.1
# The script displays all scsi devices hirarchy

echo "##########################################################################################################"
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`
if [[ ${DEVICE%[0-2]*} = "scsi" ]] ;then
SPEED=`lsattr -El $DEVICE | grep -E "max" | awk '{printf $2}'`
TYPE=`lsattr -El $DEVICE | grep -E "bus_type" | awk '{printf $2}'`
printf "%-70s %-17s %-6s %-4s\n" "$device," "$TYPE," "$SPEED" "MHz"
NOMORE=0 #do not display lsattr params on scsi devices anymore
elif [[ ${DEVICE%[0-2]*} != "sisscsia" ]] && lsdev -Cspci|grep sisscsia >/dev/null ;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`
if [[ $NOMORE != 0 && ${DEVICE1%[0-2]*} = "scsi" ]] ;then
SPEED=`lsattr -El $DEVICE1 | grep -E "max" | awk '{printf $2}'`
TYPE=`lsattr -El $DEVICE1 | grep -E "bus_type" | awk '{printf $2}'`
printf "%-70s %-17s %-6s %-4s\n" "$device1," "$TYPE," "$SPEED" "MHz"
elif [[ ${DEVICE1%[0-99]*} = "hdisk" ]] ;then
SIZE=`bootinfo -s $DEVICE1`
printf "%-80s %-6s %-2s\n" "$device1," "$SIZE" "MB"
elif [[ ${DEVICE1%[0-99]*} = "cd" && ${DEVICE%[0-2]*} = "ide" ]] && lsdev -Cspci|grep sisscsia >/dev/null ;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
SIZE=`bootinfo -s $DEVICE2`
printf "%-80s %-6s %-2s\n" "$device2," "$SIZE" "MB"
else
echo "$device2"
fi
done
done
done
echo "##########################################################################################################"




Long live king Moshiach !
 
Very cool. Thanks for the post
 
Very nice script , thx a lot for this one!
The script works like a charm if you don't mess around with the names of your hdisks :) ( I changed the names from hdiskxx to hdsk_servername_nr, so things get a little screwed up then )

greetz

R.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top