How can I enumerate SAS addresses/WWNs in Linux?

7,840

Solution 1

They should be available in /dev/disk/by-id, on your machine it should look something like this:

[root@ae1 ~]# ls -l /dev/disk/by-id/

total 0

lrwxrwxrwx 1 root root  9 Feb 11  2011 scsi-3600050e0d1806400285a0000c0590000 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 11  2011 scsi-3600050e0d1806400285a0000c0590000-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Feb 11  2011 scsi-3600050e0d1806400285a0000c0590000-part2 -> ../../sda2

Solution 2

The Linux utility lsscsi written by Doug Gilbert will provide the information you are looking for. It is in the Base repository of CentOS 5, 6, and 7, but YMMV with other distros. The output of lsscsi on my CentOS 7 system with the argument required to display WWNs:

[root@sklad ~]# lsscsi --wwn
[0:0:0:0]    disk    0x5000c50041b932d7              /dev/sda 
[0:0:1:0]    disk    0x5000c50041b917cb              /dev/sdb 
[1:0:0:0]    disk    0x50025385501f66f1              /dev/sde 
[2:0:0:0]    disk    0x5002538550125c20              /dev/sdf 
[3:0:0:0]    cd/dvd                                  /dev/sr0 
[6:0:0:0]    disk    0x5000cca37ec38857              /dev/sdg 
[7:0:0:0]    disk    0x5000c50041b909df              /dev/sdc 
[7:0:1:0]    disk    0x5000c5004182c53b              /dev/sdd 

I realize this is an old question, but I came across it and thought I'd offer another solution.

Share:
7,840

Related videos on Youtube

kdt
Author by

kdt

Updated on September 18, 2022

Comments

  • kdt
    kdt almost 2 years

    I have some SAS devices in a server, I would like to find out what their SAS addresses are. How can I do that in Linux? I'm using CentOS 6.