lsscsi命令用法

lsscsi
Introduction
Overview
Command line interface
Transports
ATA
FC
1394
iSCSI
SAS
SATA
SPI
SRP
海陵文教网
人体之最USB
Examples
Download and Build information
Introduction
The lsscsi command lists information about SCSI devices in Linux. Using SCSI terminology, lsscsi lists SCSI logical units (or SCSI targets when the '--transport' option is given). The default action is to produce one line of output for each SCSI device currently attached to the system.
When the '--hosts' option is given the lsscsi command lists information about SCSI hosts attached to the system. A host can be actual hardware (sometimes referred to as Host Bu
s Adapters (HBAs)) or virtual. An example of a virtual host is USB mass storage that bridges between USB and the SCSI subsystem. In SCSI parlance, a host is referred to as an SCSI initiator.
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.
The lsscsi command works in the 2.6 and 3 Linux kernel series.
Overview
When executed without any options lsscsi outputs one line for each SCSI device attached to the system:
$ lsscsi
[0:0:8:0]    disk    FUJITSU  MAM3184MP        0105  /dev/sda锐意进取 开拓创新 努力提高服务能力水平
[2:0:0:0]    cd      CREATIVE CD5233E          1.00  /dev/scd0
唐武宗
[3:0:5:0]    tape    HP      C5713A          H910  /dev/st0
[3:0:5:1]    mediumx HP      C5713A          H910  -
[4:0:0:0]    disk    Linux    scsi_debug      0004  /dev/sdb
The first entry on each line is the scsi_host,channel,target_number,LUN tuple. It is placed in brackets and each element is colon separated. When there are multiple SCSI devices their entries are sorted in ascending tuple order. The next column is the SCSI peripheral type; rather than using the formal name (e.g. "direct access device") a shorter name is used. Then follows the vendor name, the model name and the revision string. The last entry is the primary device node name. The "primary" device node name is associated wit
h the upper level SCSI driver that "owns" the device. Examples of upper level SCSI drivers are sd (for disks), sr (for optical drives whose devices are often named /dev/scd<n> ) and st (for tapes). Some SCSI devices have peripheral types that either don't have upper level drivers to control them, or the associated driver module is not loaded. Such devices have '-' given for their device node name. All SCSI devices can be accessed via their corresponding scsi generic (sg) device node name (e.g. /dev/sg<n> ) which can be seen by adding a '--generic' option to the above lsscsi invocation.
By adding the '--size' option ('-s' in its short form) the size of disks is shown to the right of each line:
# lsscsi -s
[0:0:0:0]    cd/dvd  PIONEER  DVD-RW  DVR-212D 1.22  /dev/sr0        -
[1:0:0:0]    disk    ATA      ST3320620AS      3.AA  /dev/sda    320GB
[6:0:0:0]    disk    SEAGATE  ST32000444SS    0006  /dev/sdb  2.00TB
If the device is not a disk or its size is not available than '-' is output instead of a size.
Here is a "long" variant of this command. The '-l' (or '--long') option can be used multiple time for more output.
$ lscssi -l
[0:0:1:0]    disk    FUJITSU  MAM3184MP        0105  /dev/sda
  state=running queue_depth=16 scsi_level=4 type=0 device_blocked=0 timeout=30
The device node major and minor numbers can also be output with the '-d' option:
$ lsscsi -d
[0:0:1:0]    disk    FUJITSU  MAM3184MP        0105  /dev/sda[8:0]
The '-g' (or '--generic') option can be used to show the corresponding scsi generic device name:
$ lsscsi -g
[0:0:1:0]    disk    FUJITSU  MAM3184MP        0105  /dev/sda  /dev/sg0
Most modern storage devices have world wide unique identifiers. For an ATA or SATA disk this is known as a WWN. For a SCSI device the formal term is an Logical Unit (LU) name which comes in several forms including NAA and EUI-64 numbers and SCSI name strings as used by iSCSI. The '-u (or '--unit') option will show the LU_name/WWN in place of the manufacturer, product and revision strings:
$ lsscsi
[5:0:0:0]    disk    FreeBSD  iSCSI Disk      0123  /dev/sdb
$ lsscsi -u
[5:0:0:0]    disk    ample.istgt:12_ /dev/sdb
The url type name used by iSCSI (called an IQN) is too large to fit where the manufacture
r, product and revision strings were so it is truncated to the right with the underscore as an indication of that truncation. To see the whole IQN (and the device name to the right is dropped) use:
$ lsscsi -uuu
[5:0:0:0]    disk    ample.istgt:1200ssd-tgt,lun,0
四川师范大学学报
In "classic" mode lsscsi outputs a listing very similar to 'cat /proc/scsi/scsi' as often used in the Linux 2.4 series. This form of output should be familiar to long term users of Linux:
$ lsscsi -c
Attached devices:
Host: scsi0 Channel: 00 Id: 08 Lun: 00
  Vendor: FUJITSU  Model: MAM3184MP        Rev: 0105
  Type:  Direct-Access                    ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: CREATIVE Model: CD5233E          Rev: 1.00
  Type:  CD-ROM                          ANSI SCSI revision: 02
Host: scsi3 Channel: 00 Id: 06 Lun: 00
  Vendor: SONY    Model: SDT-7000        Rev: 0192
  Type:  Sequential-Access                ANSI SCSI revision: 02
Host: scsi4 Channel: 00 Id: 00 Lun: 00
  Vendor: Linux    Model: scsi_debug      Rev: 0004

本文发布于:2024-09-21 10:50:40,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/398910.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:能力   师范大学   水平   学报   服务   四川
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议