Script to get the WWID of disks

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Script to get the WWID of disks

satish
Dear Erman,

I am expecting to get the WWID of all the disks as below

Disk: sda       WWID: 3600601602b702d006218b7de8130e111
Disk: sdaa      WWID: 3600601602b702d000652b695c648e111
Disk: sdab      WWID: 3600601602b702d000752b695c648e111
Disk: sdac      WWID: 3600601602b702d007f2a73fbc648e111
Disk: sdad      WWID: 3600601602b702d007e2a73fbc648e111

I have got the script something like:

#!/bin/ksh
for disk in `ls /dev/sd*`
do
disk_short=`basename $disk`
wwid=`/usr/lib/udev/scsi_id -g -u -s /block/$disk_short`
if [ "$wwid" != "" ]
then
  echo -e "Disk:" $disk_short "\tWWID:" $wwid
fi
done

But when i ran it,we are facing invalid option error as below


[root@erpuatdb1 etc]# sh abc.sh
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'
/usr/lib/udev/scsi_id: invalid option -- 's'

we are using Red Hat Enterprise Linux Server release 7.3 (Maipo)

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Script to get the WWID of disks

ErmanArslansOracleBlog
Administrator
it seems "-s" is not a valid argument for the scsi_id program that is delivered with Redhat 7.
you can check it using "man scsi_id" command.
Why do you use "-s" argument anyways?
Reply | Threaded
Open this post in threaded view
|

Re: Script to get the WWID of disks

satish
Thanks erman for the update.

I got this script from internet.Tried removing -s but not getting any output

[root@erpproddb1 ~]# sh scsc_id.sh
[root@erpproddb1 ~]#

[root@erpproddb1 ~]# /usr/lib/udev/scsi_id --help
Usage: scsi_id [OPTION...] DEVICE

SCSI device identification.

  -h --help                        Print this message
     --version                     Print version of the program

  -d --device=                     Device node for SG_IO commands
  -f --config=                     Location of config file
  -p --page=0x80|0x83|pre-spc3-83  SCSI page (0x80, 0x83, pre-spc3-83)
  -s --sg-version=3|4              Use SGv3 or SGv4
  -b --blacklisted                 Treat device as blacklisted
  -g --whitelisted                 Treat device as whitelisted
  -u --replace-whitespace          Replace all whitespace by underscores
  -v --verbose                     Verbose logging
  -x --export                      Print values as environment keys
[root@erpproddb1 ~]#
Reply | Threaded
Open this post in threaded view
|

Re: Script to get the WWID of disks

ErmanArslansOracleBlog
Administrator
First check the command , then the script.
First check the command starting with scsi_id. Ensure it is working, and then go into the script.

Check scsi_id command!

For example:

scsi_id -g -u -d /dev/sdb
scsi_id -g -u -d /dev/sdb1

Are these commands working?
Reply | Threaded
Open this post in threaded view
|

Re: Script to get the WWID of disks

satish
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
Reply | Threaded
Open this post in threaded view
|

Re: Script to get the WWID of disks

ErmanArslansOracleBlog
Administrator
Good. 

24 Oca 2019 Per 08:26 tarihinde satish [via Erman Arslan's Oracle Forum] <[hidden email]> şunu yazdı:
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


If you reply to this email, your message will be added to the discussion below:
http://erman-arslan-s-oracle-forum.2340467.n4.nabble.com/Script-to-get-the-WWID-of-disks-tp7134p7144.html
To start a new topic under RAC, email [hidden email]
To unsubscribe from Erman Arslan's Oracle Forum, click here.
NAML