×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

support utilities

Display ALL scsi/ide devices hirarchy by MoshiachNow
Posted: 22 May 05 (Edited 31 May 05)

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 "##########################################################################################################"



Back to IBM: AIX FAQ Index
Back to IBM: AIX Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close