River008

 

lsscsi和SCSI

SCSI(Small Computer System Interface)是一套完整的数据传输协议,其主要功能是在主机和存储设备之间传送命令、状态和块数据。

lsscsi输出的第一列例如[6:0:0:0]表示[SCSI host:Channel id: Id:Lun]

SCSI host为一块基于PCI总线的HBA或者为一个SCSI控制器芯片。每个scsi host可以存在多个channel,一个channel实际扩展了一条SCSI总线。

每个channel可以连接多个scsi节点(对应target),具体连接的数量与scsi总线带载能力有关,每个scsi节点又包含多个scsi设备(对应lun)

一个scsi Host可能拥有多个channel,每个channel拥有一条scsi总线,每个scsi target可能拥有多个lun,即多个scsi devie。scsi_device就是对lun的抽象

如下是我的系统的lsscsi输出,物理拓扑是HBA<--->expander 背板<--->两个硬盘sdb和sdc

xxx@xxx:~$ lsscsi
[0:0:0:0]    disk    ATA      INTEL SSDSC2CW24 400i  /dev/sda
[6:0:0:0]    disk    ATA      SAMSUNG MZ7LH240 B04Q  /dev/sdb
[6:0:1:0]    disk    ATA      V300 512G-SSDV04 AA20  /dev/sdc
[6:0:2:0]    enclosu BN       BP24D_EA_B341    RevB  -

sys文件系统devices下的输出如下

xxx@xxx:~$ ls /sys/bus/scsi/devices/ -l
total 0
lrwxrwxrwx 1 root root 0 Jul 26 05:50 0:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0
lrwxrwxrwx 1 root root 0 Jul 29 02:54 6:0:0:0 -> ../../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host6/port-6:0/expander-6:0/port-6:0:0/end_device-6:0:0/target6:0:0/6:0:0:0
lrwxrwxrwx 1 root root 0 Jul 29 02:54 6:0:1:0 -> ../../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host6/port-6:0/expander-6:0/port-6:0:1/end_device-6:0:1/target6:0:1/6:0:1:0
lrwxrwxrwx 1 root root 0 Jul 29 02:54 6:0:2:0 -> ../../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host6/port-6:0/expander-6:0/port-6:0:36/end_device-6:0:36/target6:0:2/6:0:2:0
lrwxrwxrwx 1 root root 0 Jul 26 05:50 host0 -> ../../../devices/pci0000:00/0000:00:1f.2/ata1/host0
lrwxrwxrwx 1 root root 0 Jul 26 05:50 host1 -> ../../../devices/pci0000:00/0000:00:1f.2/ata2/host1
lrwxrwxrwx 1 root root 0 Jul 26 05:50 host2 -> ../../../devices/pci0000:00/0000:00:1f.2/ata3/host2
lrwxrwxrwx 1 root root 0 Jul 26 05:50 host3 -> ../../../devices/pci0000:00/0000:00:1f.2/ata4/host3
lrwxrwxrwx 1 root root 0 Jul 26 05:50 host4 -> ../../../devices/pci0000:00/0000:00:1f.2/ata5/host4
lrwxrwxrwx 1 root root 0 Jul 26 05:50 host5 -> ../../../devices/pci0000:00/0000:00:1f.2/ata6/host5
lrwxrwxrwx 1 root root 0 Jul 29 02:54 host6 -> ../../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host6
lrwxrwxrwx 1 root root 0 Jul 26 05:50 target0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0
lrwxrwxrwx 1 root root 0 Jul 29 15:59 target6:0:0 -> ../../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host6/port-6:0/expander-6:0/port-6:0:0/end_device-6:0:0/target6:0:0
lrwxrwxrwx 1 root root 0 Jul 29 15:59 target6:0:1 -> ../../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host6/port-6:0/expander-6:0/port-6:0:1/end_device-6:0:1/target6:0:1
lrwxrwxrwx 1 root root 0 Jul 29 15:59 target6:0:2 -> ../../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host6/port-6:0/expander-6:0/port-6:0:36/end_device-6:0:36/target6:0:2
river@inspur:~$ 

scsi内核log控制开关打开,root用户

echo -1 > /proc/sys/dev/scsi/logging_level

  

 

 

 

 

参考

1:Linux Scsi子系统框架介绍(可以知道host target channel id lun的关系)_scsi 通用sg节点名称-CSDN博客

2:Linux命令lsscsi详解 - 一口Linux - 博客园 (cnblogs.com)

posted on 2024-08-23 17:51  River008  阅读(131)  评论(0)    收藏  举报

导航