Here are some useful commands for the most popular Linux/Unix operating systems to find your HBA WWN. For brevity sake I am dividing this into a number of posts. For this one, it’s Linux, verified on CentOS/Redhat and Suse Linux Enterprise Server.
Useful stuff I hope, at least to me, because while we all love fiber storage, before it can even get presented to your server your Storage Admin needs to know your server’s HBA’s WWN (whether you are using a fiber switch or plugging directly). So here we go!
p.s. (pre-script) WE LOVE FIBER
Oh, and because of strange google search results, you might have come here looking to find info on getting HBA WWN info on a different OS than what is featured here. So a quick run down of what I have available:
By the way those Fiber One bars TOTALLY kick my butt. I like them, they’re delish, but I can’t eat more than half at one time because otherwise I get the stomach rumblies all day and can’t function.
My friend says it’s the chickory root.
If you have QLogic
Before I start, if you have QLOGIC, you might want to skip down to the bottom where I mention “QLOGIC ROCKS” because QLOGIC has a nice set of management tools you can use …
Otherwise if you are not using QLOGIC, then onward sysadmin traveler!
LINUX: Finding Fiber HBA WWN
The info is in
Where “N” is the number of device for your fiber HBAs.
Unfortunately, you may have a large number of listings depending on the different cards (besides fiber HBA) that you have on your system. In my example, I have six listings:
but only two represent a fiber HBA.
So you may have to do some digging. In my case they are
(I have two HBAs installed)
[root@centos63node01 ~]# cat /sys/class/scsi_host/host4/device/fc_host/host4/port_name
[root@centos63node01 ~]# cat /sys/class/scsi_host/host5/device/fc_host/host5/port_name
Here is a one liner command to find it. This is added 2/28/2014 per a comment on my blog made by reader Liivo L (THANKS Liivo L!!)
[root@testlinux ~]# cat /sys/class/scsi_host/host*/device/fc_host/host*/node_name
This is the way I did have it written down prior to Liivo L’s comment. 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. While the one liner command is easier, this is a nice example of using a “for do done” loop on your command line (very handy for many other things)
[root@centos63node01 scsi_host]# for i in 0 1 2 3 4 5; do cat host$i/device/fc_host/host$i/port_name; done
cat: host0/device/fc_host/host0/port_name: No such file or directory
cat: host1/device/fc_host/host1/port_name: No such file or directory
cat: host2/device/fc_host/host2/port_name: No such file or directory
cat: host3/device/fc_host/host3/port_name: No such file or directory
And by the by..QLOGIC ROCKS!
I strongly recommend QLOGIC HBA’s or any rebranded QLOGIC HBA.
Consider me old school, but when I first started in SAN and fiber it was pretty much QLOGIC vs Emulex. And we were having bad luck with Emulex. First, it wasn’t even supported on some of the unix platforms I was working on, and second we were having strange blips with Emulex in our production database (on Solaris with Sun Storage) and when I called Sun, they recommended I move to QLOGIC. Which I did. Problems gone.
(No wonder that QLOGIC for the longest time cost maybe twice as much as Emulex?)
Sure that was maybe 7 years ago, and things have probably improved since then, but sysadmins are a superstitious lot that when we find something that works, it’s hard to teach us new tricks sometimes.
Then again, have you seen how much time and resources are devoted to QLOGIC drivers and management?
As an example, I don’t go through any of the above shenangigans if I have QLOGIC. I just download QLOGIC’s command line tool (scli) which installs like a dream and you can use it to find anything and everything about your HBAs.
THAT’S ALL FOLKS!!!
(Did you see what I did there?)