Monday, November 25, 2013

Reset HBA Card using hbacmd in RHELinux

Here are the commands to reset the HBA Card.

Get the WWN number using list command

# /usr/sbin/hbanyware/hbacmd listhbas

Manageable HBA List

Port WWN   : 10:00:00:00:XX:XX:XX:XX
Node WWN   : 20:00:00:00:XX:XX:XX:XX
Fabric Name: 10:00:00:05:XX:XX:XX:XX
Flags      : 8000fexx
Host Name  : localhost
Mfg        : Emulex Corporation

then Reset

# /usr/sbin/hbanyware/hbacmd Reset 10:00:00:00:XX:XX:XX:XX

Reset HBA 10:00:00:00:XX:XX:XX:XX

Also, you can use the below commands to get HBA Attribute & Port attribute.

# /usr/sbin/hbanyware/hbacmd HBAAttrib 10:00:00:00:XX:XX:XX:XX

# /usr/sbin/hbanyware/hbacmd PortAttrib 10:00:00:00:XX:XX:XX:XX

Tuesday, November 19, 2013

How to delete / unmap the lun from RHEL Servers

Here is the procedure to delete / unmap the lun from RHEL Servers.

Pass echo 1 to the corresponding device which you want to delete or unmap.

# echo 1 > /sys/block/sde/device/delete
# echo 1 > /sys/block/sde/device/delete

How to scan New Lun / San Disk in RHEL Linux

Here is the different methods to scan the new Luns / SAN Disks in Qlogic and Emulex.

# /usr/bin/ (or) /sbin/ script can automatically update the logical unit configuration of the host as needed (after a device has been added to the system). The rescan- script can also perform an issue_lip on supported devices.


Emulex Linux LUN/target scan script enables you to dynamically (without a reboot, driver unload/reload, or HBA reset) discover new targets and LUNs (on new or existing targets) that have come online. This feature is supported via standard Linux mechanisms. The script enables you to automatically discover all new devices.


This utility scans for the newly added LUNs. After adding the new LUNs it is not required to unload/load the QLogic FC driver or reboot the system. To see the newly added LUNs, just run the utility.

By default the utility would re-scan the QLogic HBAs for new LUNs.

Manual Procedure for Qlogic

# echo "scsi-qlascan" > /proc/scsi/qla2300/0
# cat /proc/scsi/qla2300/0

Other Procedure for Emulex

for i in 0 1 2 3 4 5 6
echo "1" > /sys/class/fc_host/host$i/issue_lip
echo "- - -" > /sys/class/scsi_host/host$i/scan

Note : if scsi_host not exists, use fc_host

you can run fdisk -l or multipath -ll to see the new luns once its visible. also you can use sg_map -sd for disk mapping.

Sunday, November 17, 2013

How to find WWN/WWPN Number in RHELinux.

To find WWN/WWPN Number in RHELinux.

Here are the commands to get the wwpn from Qlogic or Emulex.
First check your HBA Card information using my previous blog.


Emulex card      # cat /proc/scsi/lpfc/host*/port_name
Qlogic card     # cat /proc/scsi/qla2*/* 2>/dev/null | grep "adapter-port"


Emulex card      # cat /sys/class/scsi_host/host*/port_name
Qlogic card     # cat /proc/scsi/qla2*/* 2>/dev/null | grep "adapter-port"


Emulex card      # cat /sys/class/fc_host/host*/port_name
Qlogic card     # cat /proc/scsi/qla2*/* 2>/dev/null | grep "adapter-port"


Emulex card      # cat /sys/class/fc_host/host*/port_name
Qlogic card     # cat /proc/scsi/qla2*/* 2>/dev/null | grep "adapter-port"

How to find HBA Card Information ( Qlogic & Emulex ) in RHEL Linux‏

There are multiple commands you can use to get the HBA Card information weather its Qlogic or Emulex in Redhat Linux.

# lsmod | grep -i 'lpfc\|qla'

# lspci | grep -i fibre

# systool -c scsi_host –v

# /usr/sbin/hbanyware/hbacmd listhbas

Also you can see the HBA card information from dmesg and /var /log/messages after reboot.

 # inq –hba

Inq is a command line utiliy from EMC to display the storage information, Lun id, capacity and etc . also you can use inq for QLogic alswell.

# scli

Scli is a Qlogic utility to display the storage information like HBA Card, WWPN etc..