How to find WWN number of HBA and scan FC Luns in Linux


How to find WWN number of HBA and scan the FC Luns in LINUX

This post will help you with How to find WWN number of HBA and scan the FC Luns in LINUX.

If you are interested in learning, Request you to go through the below recommended tutorial.




How to find WWN number of HBA and scan the FC Luns in LINUX?


As a Linux admin, we may come in a situation like, to find WWN number of HBA and scan the FC Luns in LINUX which are provided by Storage team. Its need to be scan from the Linux OS side without rebooting server.

So How to find WWN number of HBA and scan the FC Luns in LINUX without rebooting the server?

Here is a solution to find WWN number of HBA and scan the FC Luns.

Identify the number of HBA adapters


systool -c fc_host -v
or
ls /sys/class/fc_host
host0 host1

Note the number of hosts available in the server. We have Two HBA here from the above example (host0 and host1).

To get the WWNN (World Wide Node Number) of HBA or FC card in Linux


cat /sys/class/fc_host/host0/node_name
0x20000000c9538d83
cat /sys/class/fc_host/host1/node_name
0x20000000c9538dac

To get the WWPN (World Wide Port Number) of HBA or FC card in Linux


cat /sys/class/fc_host/host0/port_name0x10000000c9538d83
cat /sys/class/fc_host/host1/port_name0x10000000c9538dac

If you have more HBAs, replace "host0 or host1" with "hostN ". In most cases, System admins need to provide the WWPN to storage admins for the storage allocation.

Scan newly added disks or rescan existing LUNs in Linux


echo "1" > /sys/class/fc_host/host0/issue_lip
echo "- - -" > /sys/class/scsi_host/host0/scan

If you have more number of hosts file under the directory /sys/class/fc_host, then use the command for each hosts file by replacing the "host0".

From Redhat Linux 5.4 onwards, redhat introduced “/usr/bin/rescan-scsi-bus.sh” script to scan all the SCSI bus and update the SCSI layer to reflect new devices.

We can also use the "rescan-scsi-bus.sh" script to detect new LUNs without rebooting the server.
This script is available with sg3-utils package. So install the sg3-utils package using yum, refer this link to configure yum repo server in Linux.
yum install sg3_utils
rescan-scsi-bus.sh

Now check the detected disks using fdisk command.

Hope you have got an idea How to find WWN number of HBA and scan the FC Luns in LINUX.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

find wwn number in linux, find wwn linux, hba status in linux, find WWN number of HBA card in linux, how to check wwpn number in linux

Post a Comment

0 Comments