Login  Register

Re: Script to get the WWID of disks

Posted by satish on Jan 24, 2019; 5:26am
URL: http://erman-arslan-s-oracle-forum.124.s1.nabble.com/Script-to-get-the-WWID-of-disks-tp7134p7144.html

You are right erman.We are able to get the output of scsi_id -g -u -d /dev/sdb.Then we have identified the issue with the script

Original script

[root@erpproddb1 ~]# cat a.sh
#!/bin/ksh -x
for disk in `ls /dev/sd*`
do
disk_short=`basename $disk`
wwid=`/usr/lib/udev/scsi_id -g -u -d /block/$disk_short`
if [ "$wwid" != "" ]
then
  echo -e "Disk:" $disk_short "\tWWID:" $wwid
fi
done


Modified script

[root@node1~]# cat a.sh
#!/bin/ksh -x
for disk in `ls /dev/sd*`
do
disk_short=`basename $disk`
wwid=`/usr/lib/udev/scsi_id -g -u -d /dev/$disk_short`
if [ "$wwid" != "" ]
then
  echo -e "Disk:" $disk_short "\tWWID:" $wwid
fi
done

and now,with modifed script,we got what we are expecting as below

[root@erpproddb1 ~]# sh a.sh
Disk: sda       WWID: 3600508b1001caec3c0f4e9d6f7cba720
Disk: sda1      WWID: 3600508b1001caec3c0f4e9d6f7cba720
Disk: sda2      WWID: 3600508b1001caec3c0f4e9d6f7cba720
Disk: sda3      WWID: 3600508b1001caec3c0f4e9d6f7cba720
Disk: sdaa      WWID: 360002ac0000000000000008b0001c9fc
Disk: sdab      WWID: 360002ac000000000000000850001c9fc
Disk: sdac      WWID: 360002ac000000000000000800001c9fc
Disk: sdad      WWID: 360002ac000000000000000810001c9fc
Disk: sdae      WWID: 360002ac000000000000000820001c9fc
Disk: sdaf      WWID: 360002ac0000000000000007f0001c9fc
Disk: sdag      WWID: 360002ac000000000000000830001c9fc
Disk: sdah      WWID: 360002ac000000000000000870001c9fc
Disk: sdai      WWID: 360002ac000000000000000880001c9fc
Disk: sdaj      WWID: 360002ac000000000000000860001c9fc
Disk: sdak      WWID: 360002ac000000000000000890001c9fc
Disk: sdal      WWID: 360002ac000000000000000840001c9fc
Disk: sdam      WWID: 360002ac0000000000000007d0001c9fc
Disk: sdan      WWID: 360002ac0000000000000007b0001c9fc
Disk: sdao      WWID: 360002ac0000000000000007a0001c9fc
Disk: sdap      WWID: 360002ac0000000000000007c0001c9fc
Disk: sdaq      WWID: 360002ac000000000000000790001c9fc
Disk: sdar      WWID: 360002ac0000000000000007e0001c9fc
Disk: sdas      WWID: 360002ac000000000000000780001c9fc
Disk: sdat      WWID: 360002ac000000000000000b20001c9fc
Disk: sdau      WWID: 360002ac000000000000000b30001c9fc
Disk: sdav      WWID: 360002ac000000000000000b40001c9fc
Disk: sdaw      WWID: 360002ac000000000000000b50001c9fc
Disk: sdax      WWID: 360002ac000000000000000b60001c9fc
Disk: sday      WWID: 360002ac000000000000000b70001c9fc
Disk: sdaz      WWID: 360002ac000000000000000b80001c9fc
Disk: sdb       WWID: 360002ac000000000000000070001c9fc
Disk: sdba      WWID: 360002ac000000000000000b90001c9fc
Disk: sdbb      WWID: 360002ac000000000000000ba0001c9fc
Disk: sdbc      WWID: 360002ac000000000000000bb0001c9fc
Disk: sdbd      WWID: 360002ac000000000000000bd0001c9fc
Disk: sdbe      WWID: 360002ac000000000000000bc0001c9fc
Disk: sdbf      WWID: 360002ac000000000000000be0001c9fc
Disk: sdbg      WWID: 360002ac000000000000000bf0001c9fc
Disk: sdbh      WWID: 360002ac000000000000000c00001c9fc
Disk: sdbi      WWID: 360002ac000000000000000070001c9fc
Disk: sdbj      WWID: 360002ac000000000000000080001c9fc
Disk: sdbk      WWID: 360002ac000000000000000b10001c9fc
Disk: sdbl      WWID: 360002ac000000000000000540001c9fc
Disk: sdbm      WWID: 360002ac000000000000000630001c9fc
Disk: sdbn      WWID: 360002ac000000000000000640001c9fc
Disk: sdbo      WWID: 360002ac000000000000000650001c9fc
Disk: sdbp      WWID: 360002ac000000000000000580001c9fc
Disk: sdbq      WWID: 360002ac000000000000000660001c9fc
Disk: sdbr      WWID: 360002ac000000000000000670001c9fc
Disk: sdbs      WWID: 360002ac000000000000000680001c9fc
Disk: sdbt      WWID: 360002ac000000000000000690001c9fc
Disk: sdbu      WWID: 360002ac0000000000000006a0001c9fc
Disk: sdbv      WWID: 360002ac0000000000000006b0001c9fc
Disk: sdbw      WWID: 360002ac0000000000000006c0001c9fc
Disk: sdbx      WWID: 360002ac0000000000000006d0001c9fc
Disk: sdby      WWID: 360002ac0000000000000006e0001c9fc
Disk: sdbz      WWID: 360002ac0000000000000006f0001c9fc
Disk: sdc       WWID: 360002ac000000000000000080001c9fc
Disk: sdca      WWID: 360002ac000000000000000750001c9fc
Disk: sdcb      WWID: 360002ac000000000000000760001c9fc
Disk: sdcc      WWID: 360002ac000000000000000770001c9fc
Disk: sdcd      WWID: 360002ac0000000000000008a0001c9fc
Disk: sdce      WWID: 360002ac0000000000000008c0001c9fc
Disk: sdcf      WWID: 360002ac0000000000000008d0001c9fc
Disk: sdcg      WWID: 360002ac000000000000000890001c9fc
Disk: sdch      WWID: 360002ac0000000000000008b0001c9fc
Disk: sdci      WWID: 360002ac000000000000000850001c9fc
Disk: sdcj      WWID: 360002ac000000000000000800001c9fc
Disk: sdck      WWID: 360002ac000000000000000810001c9fc

Thanks for all your time.

Thank you,
satish