3

I have a Debian 9 running. It has a SSD connected as well as a fibrechannel link to a SAN storage.

As far I see both are visible as /dev/sdX devices.

How can I find out what is the disk and what is the storage?

Where is the storage configured in the system?

chris01
  • 519
  • 1
  • 9
  • 22

3 Answers3

5

More convenient way is to use lsscsi utility.

From documentation about FC:

For FC devices (logical units), the '--transport' option will show the port name and the port identifier instead of the SCSI INQUIRY "strings". For example:

$ lsscsi -g
[3:0:0:0]    enclosu HP       A6255A           HP04  -         /dev/sg3
[3:0:1:0]    disk    HP 36.4G ST336753FC       HP00  /dev/sdd  /dev/sg4
[3:0:2:0]    disk    HP 36.4G ST336753FC       HP00  /dev/sde  /dev/sg5

$ lsscsi -g --transport
[3:0:0:0]    enclosu fc:0x50060b00002e48a3,0x0b109b  -         /dev/sg3
[3:0:1:0]    disk    fc:0x21000004cf97de68,0x0b109f  /dev/sdd  /dev/sg4
[3:0:2:0]    disk    fc:0x21000004cf97e385,0x0b10a3  /dev/sde  /dev/sg5

lsscsi uses sysfs(from Introduction section of documentation):

The lsscsi command scans the sysfs pseudo file system that was introduced in the 2.6 Linux kernel series. Since most users have permissions to read sysfs (usually mounted at /sys ) then meta information can be found on some or all SCSI devices without a user needing elevated permissions to access special files (e.g. /dev/sda ). The lsscsi command can also show the relationship between a device's primary node name, its SCSI generic (sg) node name and its kernel name.

Yurij Goncharuk
  • 4,177
  • 2
  • 19
  • 36
  • So all the configuration is made from the FC-controller itself (or maybe a BIOS inside it or the Linux kernel itself)? I did expect some manual settings in Linux but did not find any. But it does only appear as a normal SCSI device. Thats correct? – chris01 May 16 '19 at 05:32
  • 1
    @chris01 I've added info about how `lsscsi` get info about devices and append to answer. – Yurij Goncharuk May 16 '19 at 08:59
1

You can try something like: check the major and the minor numbers for this device:

# ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 May 15 12:58 /dev/sda

then go to directory

/sys/dev/block/8:0/device

where 8:0 represent above major and minor number and get the content of file model

# cat model
VBOX HARDDISK

P.S. This is for RHEL, on Debian the path maybe should be /sys/dev/8:0/device

Romeo Ninov
  • 16,541
  • 5
  • 32
  • 44
1

On a Debian 9 or similar fairly modern distribution, you might use the lsblk command like this:

lsblk -o +HCTL,TRAN,WWN

The TRAN field will identify the transport method used, but may be blank. But the first number of the HCTL quadlet will indicate the number of the host adapter providing access to this device: if a corresponding /sys/class/fc_host/host<N> directory exists, then the storage device is definitely a Fibre Channel SAN LUN.

You will find the WWN information of the Fibre Channel adapter within the /sys/class/fc_host/host<N> directory. For historical reasons, Emulex FibreChannel host adapter driver (lpfc.ko) presents a lot of run-time configurable settings at /sys/class/scsi_host/host<N>. Other vendors' FC drivers may present them differently.

telcoM
  • 87,318
  • 3
  • 112
  • 232