rdev.sh

Sript para desplegar la información del hardware y volúmenes lógicos definidos en el sistema. 

Formato:

$ /opt/scripts/utils/rdev.sh -d

inet0                             Available       Internet Network Extension

|---en0                           Available       Standard Ethernet Network Interface

|---en1                           Available       Standard Ethernet Network Interface

|---en2                           Defined         Standard Ethernet Network Interface

|---et0                           Defined         IEEE 802.3 Ethernet Network Interface

|---et1                           Defined         IEEE 802.3 Ethernet Network Interface

|---et2                           Defined         IEEE 802.3 Ethernet Network Interface

|---lo0                           Defined         Loopback Network Interface

iocp0                             Defined         I/O Completion Ports

iscsi0                            Available       iSCSI Protocol Device

|---hdisk5                        Defined         IBM 2076 iSCSI Disk

lvdd                              Available       LVM Device Driver

nsmb0                             Available       N/A

pty0                              Available       Asynchronous Pseudo-Terminal

rcm0                              Defined         Rendering Context Manager Subsystem

rootvg                            Defined         Volume group

|---hd1                           Defined         Logical volume

|---hd2                           Defined         Logical volume

|---hd3                           Defined         Logical volume

|---hd4                           Defined         Logical volume

|---hd5                           Defined         Logical volume

|---hd6                           Defined         Logical volume

|---hd8                           Defined         Logical volume

|---hd10opt                       Defined         Logical volume

|---hd11admin                     Defined         Logical volume

|---hd9var                        Defined         Logical volume

|---livedump                      Defined         Logical volume

sfw0                              Available       Storage Framework Module

sys0                              Available       System Object

|---sysplanar0                    Available       System Planar

|   |---L2cache0                  Available       L2 Cache

|   |---lhea0                     Available       Logical Host Ethernet Adapter (l-hea)

|   |   |---ent0                  Available       Logical Host Ethernet Port (lp-hea)

|   |   |---ent1                  Available       Logical Host Ethernet Port (lp-hea)

|   |---mem0                      Available       Memory

|   |---proc0                     Available 00-00 Processor

|   |---vio0                      Available       Virtual I/O Bus

|   |   |---ent2                  Available       Virtual I/O Ethernet Adapter (l-lan)

|   |   |---vsa0                  Available       LPAR Virtual Serial Adapter

|   |   |   |---vty0              Available       Asynchronous Terminal

|   |   |---vscsi0                Available       Virtual SCSI Client Adapter

|   |   |   |---cd0               Available       Virtual SCSI Optical Served by VIO Server

|   |   |   |---cd1               Available       Virtual SCSI Optical Served by VIO Server

|   |   |   |---cd2               Available       Virtual SCSI Optical Served by VIO Server

|   |   |   |---hdisk0            Available       Virtual SCSI Disk Drive

|   |   |   |---hdisk1            Available       Virtual SCSI Disk Drive

|   |   |   |---hdisk2            Available       Virtual SCSI Disk Drive

|   |   |   |---hdisk3            Available       Virtual SCSI Disk Drive

|   |   |---vscsi1                Available       Virtual SCSI Client Adapter

vgaudit                           Defined         Volume group

|---borrame                       Defined         Logical volume

|---loglv00                       Defined         Logical volume

|---lvaudit                       Defined         Logical volume

|---lviscsi                       Defined         Logical volume

Script:

# cat /opt/scripts/utils/rdev.sh

#!/usr/bin/ksh93

details="false"

if [ "$1" == "-d" ]; then details="true"; fi

s=0

function rdev {

        for d in `lsdev -p $1 -F name'`; do

                t=$((30 - s))

                printf "$i\-\-\-%-${t}s" $d

                $details && lsdev | grep "^$d " | sed "s/^[^ ]* *//" || echo

                i="$i   |"; s=$((s + 4))

                rdev $d

                i=${i/%   \|/}; s=$((s - 4))

        done

}

for dev in `lsdev -F name`; do

        parent=`lsdev -l $dev -F parent`

        if [ "$parent" == "" ]; then

                i="|"

                printf "%-34s" $dev;

                $details && lsdev | grep "^$dev " | sed "s/^[^ ]* *//" || echo

                rdev $dev

                echo

        fi

done