Friday, 19 September 2014

How to find WWN number of HBA in LINUX,Solaris,AIX

FIND WWN IN AIX
#lsdev -Cc adapter (Get the Fibre Adapter details)
ent0 Available Virtual I/O Ethernet Adapter (l-lan)
ent1 Available Virtual I/O Ethernet Adapter (l-lan)
ent2 Available Virtual I/O Ethernet Adapter (l-lan)
ent3 Available Virtual I/O Ethernet Adapter (l-lan)
fcs0 Available 08-T1 Virtual Fibre Channel Client Adapter
fcs1 Available 08-T1 Virtual Fibre Channel Client Adapter
vsa0 Available LPAR Virtual Serial Adapter
#lscfg -vpl fcs0 | grep -i network
Network Address………….C01234567CE00000
#lscfg -vpl fcs1 | grep -i network
Network Address………….C01234567CE00001
Posted by nandan pandith at 8:24 PM
######################################################
Linux Enterprise Server and CentOS/Redhat
/sys/class/scsi_host/hostN/device/fc_host/hostN/port_name
Where “N” is the number of device for your fiber HBAs.
Here’s my shortcut bash command if you don’t want to look around. This command is executed in the /sys/class/scsi_host directory.
#cd /sys/class/scsi_host
#for i in 0,1,2,3,4,5;do cat host$i/device/fc_host/host$i/port_name;done
Or
To view details about transporting HBA card
#systool -c fc_transport -v
WWPN – World Wide Port Name
WWNN – World Wide Node Name
OUI – Organizationally Unique Identifier
To view HBA card details and WWN details
systool -c fc_host –v
# systool -c fc_host -v | grep “port_name”
port_name = “0x5001438001347fdc”
port_name = “0x5001438001347fde”
port_name = “0x50014380013471f0″
port_name = “0x50014380013471f2″

#Useful command to find to list the FC Adapter
Get wwn for qlogic
lspci | grep -i Fibre
====================
To find WWN on linux with Emulex:
If you find difficult to find WWN on linux with Emulex HBA use below hbacmd to list the HBAs. This only available if hbanyware installed.
cd /usr/sbin/hbanyware
[root@tilak_phy01 hbanyware]# ./hbacmd ListHBAs
Manageable HBA List
Port WWN : 11:00:00:00:d9:58:bf:92
Node WWN : 10:00:00:00:b9:58:ba:92
Fabric Name: 20:3f:01:04:51:a1:71:00
Flags : 1100a980
Host Name : tilak_phy01
Mfg : Emulex Corporation
===================
On Redhat 4 and below (including OEL and CentOS), the /proc/scsi/{adapter-type}/{n} file contains the HBA WWN information as shown below.
{adapter-type} can be either qlaxxxx for QLogic adapters (or) lpfc for Emulex adapters.
Please substitude n with either 0, 1, or 2 according to your system.
The example belows shows the WWN number of the qlogic 2300 adapter on RedHat 3.
Ex:-
cat /proc/scsi/qla2300/1
QLogic PCI to Fibre Channel Host Adapter for QLA2460:
Firmware version: 4.00.23, Driver version 7.07.05
Entry address = f888d060
OR
cat /proc/scsi/qla2xxx/1
<snip>
SCSI Device Information:
scsi-qla0-adapter-node=200000xxxxxxxxxx;
scsi-qla0-adapter-port=210000xxxxxxxxx;
<snip>
Check state
cat /sys/class/fc_host/host[0-9]/port_state
ls -l /sys/block/sd[c-h]/device displays
Using the command scsi_id for each /block/a-h (for example, for /dev/sda we type scsi_id -g -s /block/sda) generates the output:
SATA WD2502ABYS-23B7 WD-WCAT1H504691
SATA HUA721075KLA330 GTA260P8H8893E
3600a0b8000753b49000006244dca89ae
3600a0b8000754bad000006144dca8a1f
3600a0b8000753b49000006274dca89ef
3600a0b8000754bad000006164dca8ad3
3600a0b8000753b490000062a4dca8aa5
3600a0b8000754bad000006194dca8b10
The two initial Scsi ids represent the local disks (/dev/sda and /dev/sdb). The remaining six represent the Scsi ids of the fibre channel attached LUNs
To determine the mapping between SCSI HBTL addresses & disks
Code:
sg_map -x
/dev/sg0 1 0 0 0 5 /dev/scd0
/dev/sg1 2 0 0 0 0 /dev/sda
/dev/sg2 2 0 1 0 0 /dev/sdb
/dev/sg3 2 0 2 0 0 /dev/sdc
/dev/sg4 2 0 3 0 0 /dev/sdd
/dev/sg5 3 0 1 0 0 /dev/sde
To Scan Luns:-
/usr/bin/rescan-scsi-bus.sh
###########################################################
SOLARIS:
Use “fcinfo” command to view WWN on solaris servers
bash-3.2# fcinfo hba-port
HBA Port WWN: 21000003ba######
OS Device Name: /dev/cfg/c1
Manufacturer: QLogic Corp.
Model: ##00
Firmware Version: 02.01.145
FCode/BIOS Version: ISP2200 FC-AL Host Adapter Driver: 1.15 04/03/22
Serial Number: not available
Driver Name: qlc
Driver Version: 20110321-3.05
Type: L-port
State: online
Supported Speeds: 1Gb
Current Speed: 1Gb
Node WWN: 20000003ba######
HBA Port WWN: 210000e08b######
OS Device Name: /dev/cfg/c3
Manufacturer: QLogic Corp.
Model: QLA##40
Firmware Version: 03.03.28
FCode/BIOS Version: BIOS: 1.43;
Serial Number: not available
Driver Name: qlc
Driver Version: 20110321-3.05
Type: unknown
State: offline
Supported Speeds: 1Gb 2Gb
Current Speed: not established
Node WWN: 200000e08b######
bash-3.2# fcinfo hba-port | grep HBA
HBA Port WWN: 21000003ba######
HBA Port WWN: 210000e08b######
Using prtconf
root@ sunserver:/root# prtconf -vp | grep -i wwn
port-wwn: 2100001b.32xxxxxx
node-wwn: 2000001b.32xxxxxx
port-wwn: 2101001b.32yyyyyy
node-wwn: 2001001b.32yyyyyy
Using prtpicl
root@ sunserver:/root# prtpicl -v | grep wwn
:node-wwn 20 00 00 1b 32 xx xx xx
:port-wwn 21 00 00 1b 32 xx xx xx
:node-wwn 20 01 00 1b 32 yy yy yy
:port-wwn 21 01 00 1b 32 yy yy yy
Using luxadm
Run the following command to obtain the physical path to the HBA Ports
root@ sunserver:/root$ luxadm -e port
/devices/pci@400/pci@0/pci@9/SUNW,qlc@0/fp@0,0:devctl CONNECTED
/devices/pci@400/pci@0/pci@9/SUNW,qlc@0,1/fp@0,0:devctl NOT CONNECTED

With the physical path obtained from the above command, we can trace the WWN numbers as follows. here I use the physical path to the one that is connected:
root@ sunserver:/root$ luxadm -e dump_map /devices/pci@400/pci@0/pci@9/SUNW,qlc@0/fp@0,0:devctl
Pos Port_ID Hard_Addr Port WWN Node WWN Type
0 123456 0 1111111111111111 2222222222222222 0×0 (Disk device)
1 789123 0 1111111111111111 2222222222222222 0×0 (Disk device)
2 453789 0 2100001b32xxxxxx 2000001b32xxxxxx 0x1f (Unknown Type,Host Bus Adapter)
SAN Foundation Software versions display as such
bash-2.03# modinfo | grep SunFC
38 102bcd25 209b8 150 1 fcp (SunFC FCP v20070703-1.98)
39 102d4071 855c – 1 fctl (SunFC Transport v20070703-1.41)
42 102ead69 164e0 149 1 fp (SunFC Port v20070703-1.60)
44 10300a79 cd574 153 1 qlc (SunFC Qlogic FCA v20070212-2.19)
To show Sun/Qlogic HBA’s
bash-2.03# luxadm qlgc
Found Path to 2 FC100/P, ISP2200, ISP23xx Devices
Opening Device: /devices/ssm@0,0/pci@18,700000/SUNW,qlc@2/fp@0,0:devctl
Detected FCode Version: ISP2312 Host Adapter fcode version 1.16 11/15/06
Opening Device: /devices/ssm@0,0/pci@19,700000/SUNW,qlc@2/fp@0,0:devctl
Detected FCode Version: ISP2312 Host Adapter fcode version 1.16 11/15/06
Complete
To show all vendor HBA’s
bash-2.03# luxadm fcode_download -p
Found Path to 0 FC/S Cards
Complete
Found Path to 0 FC100/S Cards
Complete
Found Path to 2 FC100/P, ISP2200, ISP23xx Devices
Opening Device: /devices/ssm@0,0/pci@18,700000/SUNW,qlc@2/fp@0,0:devctl
Detected FCode Version: ISP2312 Host Adapter fcode version 1.16 11/15/06
Opening Device: /devices/ssm@0,0/pci@19,700000/SUNW,qlc@2/fp@0,0:devctl
Detected FCode Version: ISP2312 Host Adapter fcode version 1.16 11/15/06
Complete
Found Path to 0 JNI1560 Devices.
Complete

Found Path to 0 Emulex Devices.
Complete
=========
# prtconf -vp | grep wwn
port-wwn:  2100001b.3202f94b
node-wwn:  2000001b.3202f94b
port-wwn:  210000e0.8b90e795
node-wwn:  200000e0.8b90e795

For Solaris 8 and 9:

Run the following script to determine the WWNs of the HBAs that are currently being utilized:
#!/bin/sh for i in `cfgadm |grep fc-fabric|awk ‘{print $1}’`;

do

dev=”`cfgadm -lv $i|grep devices |awk ‘{print $NF}’`” wwn= \

“`luxadm -e dump_map $dev |grep ‘Host Bus’|awk ‘{print $4}’`”

echo “$i: $wwn” done


bash-2.03# luxadm -e port

Found path to 2 HBA ports

/devices/ssm@0,0/pci@18,700000/SUNW,qlc@2/fp@0,0:devctl            CONNECTED
/devices/ssm@0,0/pci@19,700000/SUNW,qlc@2/fp@0,0:devctl            CONNECTED

To see the WWN’s (using address given to you from previous commands),

it is the last one that specifies it is a HBA, so the port WWN here is 50070e800475e108

bash-2.03# luxadm -e dump_map /devices/ssm@0,0/pci@18,700000/SUNW,qlc@2/fp@0,0:devctl
Pos  Port_ID Hard_Addr Port WWN         Node WWN         Type
0    642113  0         50070e800475e108 50070e800475e108 0×0  (Disk device)
1    643f13  0         550070e800475e108 50070e800475e108 0×0  (Disk device)
2    643913  0         2100001b3205e828 2000001b3205e828 0x1f (Unknown Type,Host Bus Adapter)


No comments:

Post a Comment