(c) http://kbase.redhat.com/faq/docs/DOC-19446
Problem
When a system is connected to multiple SANs of the same type it is hard to tell what disk is on what SAN, or what disk is on what storage processor port it’s connected to.
Resolution
On Red Hat Enterprise Linux 5 all the data is stored in /sys and can be found independently of the Fibre Channel driver in use.
1) To find the Fibre Channel addresses of the HBAs on the machine, run the following:
# systool -c fc_host -v
(output trimmed for clarity)
Class Device path = "/sys/class/fc_host/host8"
port_name = "0x10000000c9802436"
node_name = "0x20000000c9802436"
Class Device path = "/sys/class/fc_host/host9"
port_name = "0x10000000c9802437"
node_name = "0x20000000c9802437"
On this particular machine, we have two HBAs acting currently as host8 and host9 (please notice that these numbers can change, they change every time the fibre channel driver is unloaded, reloaded, and can change across reboots). This host number is the H-value on HBTL SCSI addressing.
2) With the following command we can determine the fibre channel target WWN for the triplet HBT from HBTL SCSI addressing.
# systool -c fc_transport -v
(output trimmed for clarity)
Class = "fc_transport"
Class Device path = "/sys/class/fc_transport/target8:0:0"
node_name = "0x50060160ba601693"
port_name = "0x500601683a601693"
Class Device path = "/sys/class/fc_transport/target9:0:0"
node_name = "0x50060160ba601693"
port_name = "0x500601683a601693"
Class Device path = "/sys/class/fc_transport/target8:0:1"
node_name = "0x50060160ba601693"
port_name = "0x500601603a601693"
Class Device path = "/sys/class/fc_transport/target9:0:1"
node_name = "0x50060160ba601693"
port_name = "0x500601603a601693"
Where node_name, is the FC WWN of the Storage System, and port_name is the FC WWID of the Storage Processor Port.
3) With the following command, we can determine the mapping between SCSI HBTL addresses and the disks:
(sg_map is part of sg3_utils, and before running sg_map, it is necessary to have the sg module loaded on the system)
# sg_map -x
(output trimmed for clarity)
/dev/sg4 8 0 0 0 0 /dev/sdd
/dev/sg5 8 0 0 1 0 /dev/sde
/dev/sg6 8 0 0 2 0 /dev/sdf
/dev/sg7 8 0 1 0 0 /dev/sdg
/dev/sg8 8 0 1 1 0 /dev/sdh
/dev/sg9 8 0 1 2 0 /dev/sdi
/dev/sg10 9 0 0 0 0 /dev/sdj
/dev/sg11 9 0 0 1 0 /dev/sdk
/dev/sg12 9 0 0 2 0 /dev/sdl
/dev/sg13 9 0 1 0 0 /dev/sdm
/dev/sg14 9 0 1 1 0 /dev/sdn
/dev/sg15 9 0 1 2 0 /dev/sdo
4) From commands on (1), (2) and (3) we have the mapping from disk to HBTL SCSI addresses, and the mapping of SCSI address to fibre channel address. If, for instance, we want to see where the following multipath device is hosted, we do:
disc01 (3600601608e661a01486cd3c7f53ede11) dm-1 DGC,RAID 5
[size=10G][features=0][hwhandler=1 emc][rw]
\_ round-robin 0 [prio=2][active]
\_ 8:0:1:0 sdg 8:96 [active][ready]
\_ 9:0:1:0 sdm 8:192 [active][ready]
\_ round-robin 0 [prio=0][enabled]
\_ 8:0:0:0 sdd 8:48 [active][ready]
\_ 9:0:0:0 sdj 8:144 [active][ready]
5) We know already that it’s an EMC Clariion because the vendor is DGC, but I could have LUNs from more than one Clariion on this system, so let’s pick /dev/sdj as an example:
/dev/sg10 9 0 0 0 0 /dev/sdj
/dev/sdj = H:B:T:L = 9:0:0:0
Therefore for sdj we have, H=9 and HBT=9:0:0. From (1) and (2) we have:
Host HBA WWN: 0x20000000c9802437
Host HBA WWP: 0x10000000c9802437
Storage System WWN: 0x50060160ba601693
Storage Processor WWP: 0x500601683a601693
6) Doing for all disks:
Local Port Remote port STORAGE
8:0:1:0 sdg 0x10000000c9802436 0x500601603a601693 0x50060160ba601693
9:0:1:0 sdm 0x10000000c9802437 0x500601603a601693 0x50060160ba601693
8:0:0:0 sdd 0x10000000c9802436 0x500601683a601693 0x50060160ba601693
9:0:0:0 sdj 0x10000000c9802437 0x500601683a601693 0x50060160ba601693
ATTENTION: look carefully at the ‘Remote port’ values, they normally differ only in a few bits.
In this particular case, we see that both sdd and sdj are on the same remote port, and sdg and sdm are on the same ports as well.
7) A storage system can have many ports. In most cases 2 or 4, but the Storage ID should remain the same. In sysfs we have 0x50060160ba601693, which maps perfectly to the storage WWN from the storage admin interface.
Current Storage System Name: AX150
Storage System World Wide Name: 50:06:01:60:BA:60:16:93