Monday, 20 June 2011

How do I find discovered SAN targets and LUNs on a Linux host with Emulex HBA cards?

The sys file system (sysfs) provides details on what devices have been discovered.

Change directory to /sys/class/scsi_host. Perform an ls:

[tam@tsdownload scsi_host]$ ls

Each SCSI host adapter and those that look like SCSI host adapters to Linux are assigned a host number by Linux. You may see more than one hostX (where x is a number). In the example above, only one SCSI host bus adapter is found, host0. If there are more than one, perform an ls command on each:

[tam@tsdownload scsi_host]$ ls host0
[tam@tsdownload scsi_host]$ ls host0
board_online lpfc_discovery_min_wait node_name
cmd_per_lun lpfc_discovery_wait_limit nport_evt_cnt
ctlreg lpfc_drvr_version num_discovered_ports
device lpfc_fcp_bind_method option_rom_version
disc_adisc lpfc_fcp_class outfcpio
disc_map lpfc_fdmi_on portfcid
disc_npr lpfc_hba_queue_depth port_name
disc_plogi lpfc_link_speed portnum
disc_prli lpfc_linkup_wait_limit port_type
disc_reglgn lpfc_log_verbose proc_name
disc_unmap lpfc_lun_queue_depth programtype
disc_unused lpfc_max_luns scan
events lpfc_nodev_tmo serialnum
fabric_name lpfc_scan_down sg_tablesize
fwrev lpfc_topology speed
hdw lpfc_use_adisc state
host_busy management_version unchecked_isa_dma
info mbox unique_id
issue_lip modeldesc
lpfc_ack0 modelname

Any items listed with lpfc are Emulex adapters. You can check the model, firmware version, and driver version:

[tam@tsdownload host0]$ cat info
Emulex LP10000 2Gb PCI-X Fibre Channel Adapter on PCI bus 05 device 20 irq 209

[tam@tsdownload host0]$ cat lpfc_drvr_version
Emulex LightPulse Fibre Channel SCSI driver

[tam@tsdownload host0]$ cat fwrev
1.91A5 (T2D1.91A5)

Change directory to the host directory and then the device directory:

[tam@tsdownload scsi_host]$ cd host0
{tam@tsdownload host0]$ device
[tam@tsdownload device]$ ls
detach_state power target0:0:0 target0:0:1

Each target and LUN is listed as targetX:Y:Z where:
•X is the bus number
•Y is the target number
•Z is the LUN number.
These are the devices discovered by the host bus adapter and Linux SCSI midlayer.

To determine what type of devices were found, change directory to the targetX:Y:Z directory and then the X:X:X:X directory below it. You can cat the model, vendor, and other files to learn more about the devices:
[tam@tsdownload device]$ cd 0:target0:0:0
[tam@tsdownload target0:0:0]$ cd 0:0:0:0
[tam@tsdownload 0:0:0:0]$ ls
block detach_state dump power rescan scsi_level timeout vendor
delete device_blocked model queue_depth rev state type

[tam@tsdownload 0:0:0:0]$ cat model

[tam@tsdownload 0:0:0:0]$ cat vendor

[tam@tsdownload 0:0:0:0]$ cat state

The 0:0:0:0 directory represents host bus adapter 0, bus 0, target 0, LUN 0.

Original document (official Emulex web site):

No comments:

Post a Comment