lsscsi命令详解
lsscsi命令详解
用法:
lsscsi [--classic] [--device] [--generic] [--help] [--hosts] [--kname] [--list] [--lunhex] [--long] [--protection] [--protmode] [--scsi_id] [--size] [--sysfsroot=PATH]
[--transport] [--verbose] [--version] [--wwn] [H:C:T:L]
# lsscsi "*:*:*:4"
[15:0:0:4] disk 3PARdata VV 3315 /dev/sdr
[16:0:0:4] disk 3PARdata VV 3315 /dev/sdb
[17:0:0:4] disk 3PARdata VV 3315 /dev/sdal
[18:0:0:4] disk 3PARdata VV 3315 /dev/sdah
title:
第一列:scsid设备ID [host:channel🆔lun]
第二列:设备类型
第三列:设备厂商
第四列:设备型号
第五列:版本信息
第六列:设备主节点名
-c, --classic
输出类似cat /proc/scsi/scsi
-d, --device
输出scsi设备的主、副设备号
-g, --generic
输出scsi通用设备的文件名
# lsscsi -g
[0:0:0:0] disk PM8060- DefaultValue0 V1.0 /dev/sda /dev/sg0
[0:1:0:0] disk SEAGATE ST600MM0208 N002 - /dev/sg1
[0:1:1:0] disk SEAGATE ST600MM0208 N002 - /dev/sg2
[0:3:0:0] enclosu ADAPTEC Virtual SGPIO 1 - /dev/sg3
[15:0:0:2] disk 3PARdata VV 3315 /dev/sdad /dev/sg36
[15:0:0:3] disk 3PARdata VV 3315 /dev/sdap /dev/sg48
[15:0:0:4] disk 3PARdata VV 3315 /dev/sdr /dev/sg24
[15:0:0:5] disk 3PARdata VV 3315 /dev/sdb /dev/sg4
-H, --hosts
列出当前连接到系统的SCSI主机
-k, --kname
显示磁盘设备的内核名称
-L, --list
以键值对的形式显示设备的附加信息,同-lll参数的显示信息
[0:3:0:0] enclosu ADAPTEC Virtual SGPIO 1 -
device_blocked=0
iocounterbits=32
iodone_cnt=0x10
ioerr_cnt=0x4
iorequest_cnt=0x10
queue_depth=1
queue_type=simple
scsi_level=6
state=running
timeout=0
type=13
[15:0:0:2] disk 3PARdata VV 3315 /dev/sdad
device_blocked=0
iocounterbits=32
iodone_cnt=0x2a0944
ioerr_cnt=0x2
iorequest_cnt=0x2a0944
queue_depth=32
queue_type=simple
scsi_level=7
state=running
timeout=30
type=0
-l, --long
输出scsi设备附加信息比,比-lll短一些的信息,每个设备两行
# lsscsi -l
[0:0:0:0] disk PM8060- DefaultValue0 V1.0 /dev/sda
state=running queue_depth=256 scsi_level=3 type=0 device_blocked=0 timeout=45
[0:1:0:0] disk SEAGATE ST600MM0208 N002 -
state=running queue_depth=1 scsi_level=7 type=0 device_blocked=0 timeout=0
[0:1:1:0] disk SEAGATE ST600MM0208 N002 -
state=running queue_depth=1 scsi_level=7 type=0 device_blocked=0 timeout=0
[0:3:0:0] enclosu ADAPTEC Virtual SGPIO 1 -
state=running queue_depth=1 scsi_level=6 type=13 device_blocked=0 timeout=0
[15:0:0:2] disk 3PARdata VV 3315 /dev/sdad
state=running queue_depth=32 scsi_level=7 type=0 device_blocked=0 timeout=30
[15:0:0:3] disk 3PARdata VV 3315 /dev/sdap
state=running queue_depth=32 scsi_level=7 type=0 device_blocked=0 timeout=30
[15:0:0:4] disk 3PARdata VV 3315 /dev/sdr
state=running queue_depth=32 scsi_level=7 type=0 device_blocked=0 timeout=30
[15:0:0:5] disk 3PARdata VV 3315 /dev/sdb
-x, --lunhex
十六进制显示lun
Logical Unit Number (LUN): 通常是8字节的数组64位。
lsscsi -x
[0:0:0:0x0000] disk PM8060- DefaultValue0 V1.0 /dev/sda
[0:1:0:0x0000] disk SEAGATE ST600MM0208 N002 -
[0:1:1:0x0000] disk SEAGATE ST600MM0208 N002 -
[0:3:0:0x0000] enclosu ADAPTEC Virtual SGPIO 1 -
[15:0:0:0x0002] disk 3PARdata VV 3315 /dev/sdad
[15:0:0:0x0003] disk 3PARdata VV 3315 /dev/sdap
-p, --protection
显示附加数据完整性(保护)信息没有啥用
# lsscsi -p
[0:0:0:0] disk PM8060- DefaultValue0 V1.0 /dev/sda - none
[0:1:0:0] disk SEAGATE ST600MM0208 N002 - - -
[0:1:1:0] disk SEAGATE ST600MM0208 N002 - - -
[0:3:0:0] enclosu ADAPTEC Virtual SGPIO 1 - - -
[15:0:0:2] disk 3PARdata VV 3315 /dev/sdad - none
[15:0:0:3] disk 3PARdata VV 3315 /dev/sdap - none
[15:0:0:4] disk 3PARdata VV 3315 /dev/sdr - none
-P, --protmode
输出每个磁盘设备的实际保护模式,同上
-i, --scsi_id
匹配输出/dev/disk/by-id/scsi*的scsi_Id
# lsscsi -i
[0:0:0:0] disk PM8060- DefaultValue0 V1.0 /dev/sda 2af633f3000d00000
[0:1:0:0] disk SEAGATE ST600MM0208 N002 - -
[0:1:1:0] disk SEAGATE ST600MM0208 N002 - -
[0:3:0:0] enclosu ADAPTEC Virtual SGPIO 1 - -
[15:0:0:2] disk 3PARdata VV 3315 /dev/sdad 360002ac00000000000005b86000211f7
[15:0:0:3] disk 3PARdata VV 3315 /dev/sdap 360002ac00000000000006c3e000211f7
[15:0:0:4] disk 3PARdata VV 3315 /dev/sdr 360002ac000000000000071aa000211f7
[15:0:0:5] disk 3PARdata VV 3315 /dev/sdb 360002ac00000000000000080000211f7
[15:0:0:6] disk 3PARdata VV 3315 /dev/sdal 360002ac000000000000129c2000211f7
-s, --size
打印磁盘的空间
# lsscsi -s
[0:0:0:0] disk PM8060- DefaultValue0 V1.0 /dev/sda 599GB
[0:1:0:0] disk SEAGATE ST600MM0208 N002 - -
[0:1:1:0] disk SEAGATE ST600MM0208 N002 - -
[0:3:0:0] enclosu ADAPTEC Virtual SGPIO 1 - -
[15:0:0:2] disk 3PARdata VV 3315 /dev/sdad 107GB
[15:0:0:3] disk 3PARdata VV 3315 /dev/sdap 536GB
[15:0:0:4] disk 3PARdata VV 3315 /dev/sdr 42.9GB
-t, --transport
输出传输信息
# lsscsi -t
[0:0:0:0] disk /dev/sda
[0:1:0:0] disk -
[0:1:1:0] disk -
[0:3:0:0] enclosu -
[15:0:0:2] disk iqn.2000-05.com.3pardata:21210002ac0211f7,t,0x79 /dev/sdad
[15:0:0:3] disk iqn.2000-05.com.3pardata:21210002ac0211f7,t,0x79 /dev/sdap
[15:0:0:4] disk iqn.2000-05.com.3pardata:21210002ac0211f7,t,0x79 /dev/sdr
[15:0:0:5] disk iqn.2000-05.com.3pardata:21210002ac0211f7,t,0x79 /dev/sdb
-v, --verbose
输出设备的目录信息
# lsscsi -v
[0:0:0:0] disk PM8060- DefaultValue0 V1.0 /dev/sda
dir: /sys/bus/scsi/devices/0:0:0:0 [/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/target0:0:0/0:0:0:0]
[0:1:0:0] disk SEAGATE ST600MM0208 N002 -
dir: /sys/bus/scsi/devices/0:1:0:0 [/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/target0:1:0/0:1:0:0]
[0:1:1:0] disk SEAGATE ST600MM0208 N002 -
dir: /sys/bus/scsi/devices/0:1:1:0 [/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/target0:1:1/0:1:1:0]
[0:3:0:0] enclosu ADAPTEC Virtual SGPIO 1 -
dir: /sys/bus/scsi/devices/0:3:0:0 [/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/target0:3:0/0:3:0:0]
[15:0:0:2] disk 3PARdata VV 3315 /dev/sdad
dir: /sys/bus/scsi/devices/15:0:0:2 [/sys/devices/platform/host15/session1/target15:0:0/15:0:0:2]
[15:0:0:3] disk 3PARdata VV 3315 /dev/sdap
dir: /sys/bus/scsi/devices/15:0:0:3 [/sys/devices/platform/host15/session1/target15:0:0/15:0:0:3]
-w, --wwn
输出wwn号,格式0x,即scsi_id去掉3
World Wide Name (WWN): 64bits位长(16进制),可以升级到128位
# lsscsi -w
[0:0:0:0] disk /dev/sda
[0:1:0:0] disk -
[0:1:1:0] disk -
[0:3:0:0] enclosu -
[15:0:0:4] disk /dev/sdr
[15:0:0:5] disk /dev/sdb
[15:0:0:6] disk /dev/sdal
[15:0:0:254] enclosu -
[16:0:0:2] disk /dev/sdae
[16:0:0:5] disk /dev/sdc
[16:0:0:6] disk /dev/sdam
[16:0:0:7] disk 0x60002ac00000000000012ac1000211f7 /dev/sdai
[16:0:0:8] disk /dev/sdo
[16:0:0:9] disk 0x60002ac00000000000005b84000211f7 /dev/sdw
-y, --sysfsroot=PATH
假设sysfs挂载在指定路径而不是默认的 “/sys”