Answers:
lsscsi --verbose将提供类似于以下内容的输出:
[0:0:0:0] disk ATA TOSHIBA THNSNH12 HTRA /dev/sda
dir: /sys/bus/scsi/devices/0:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0]
[1:0:0:0] disk ATA WDC WD2003FZEX-0 01.0 /dev/sdb
dir: /sys/bus/scsi/devices/1:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0]
[2:0:0:0] disk ATA WDC WD3001FAEX-0 01.0 /dev/sdc
dir: /sys/bus/scsi/devices/2:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0]
[3:0:0:0] cd/dvd Optiarc DVD RW AD-7280S 1.01 /dev/sr0
dir: /sys/bus/scsi/devices/3:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/ata4/host3/target3:0:0/3:0:0:0]
它提供了ataN
可以与系统日志中找到的信息匹配的端口。如果您试图确定错误来自何处,则很有用。
编辑:如果which lsscsi
没有提供输出,则需要安装它:
sudo apt-get install lsscsi
进一步编辑:
这可能不言而喻,但是您当然可以过滤输出grep
以找到您感兴趣的内容,例如,如果发现错误,例如ata4: status: { DRDY ERR }
可以简单地发出命令
lsscsi-详细| grep -P1 -A1 ata4将产生如下输出:
[3:0:0:0] cd/dvd Optiarc DVD RW AD-7280S 1.01 /dev/sr0
dir: /sys/bus/scsi/devices/3:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/ata4/host3/target3:0:0/3:0:0:0]
这表明在调用时设备(ata4上的Opiarc DVD RW AD-7280S)尚未准备就绪。
这应该是足够的信息,以便您找到有问题的设备。
sudo lshw -c storage -c disk
为您提供了许多有关硬盘驱动器的信息。例如:
*-scsi:1
physical id: 2
logical name: scsi2
capabilities: emulated
*-disk
description: ATA Disk
product: ST31000524AS
vendor: Seagate
physical id: 0.0.0
bus info: scsi@2:0.0.0
logical name: /dev/sdb
version: JC4B
serial: 5VPDESM5
size: 931GiB (1TB)
capabilities: gpt-1.00 partitioned partitioned:gpt
configuration: ansiversion=5 guid=d6e747d2-3e9c-47c2-865b-44f8d7cc5808 sectorsize=512
*-volume
description: EXT4 volume
vendor: Linux
physical id: 1
bus info: scsi@2:0.0.0,1
logical name: /dev/sdb1
logical name: /mnt/hdd0
version: 1.0
serial: 2de34713-f0ee-4a12-9214-21a5431a7b7b
size: 931GiB
capabilities: journaled extended_attributes large_files huge_files dir_nlink recover extents ext4 ext2 initialized
configuration: created=2013-07-20 14:14:09 filesystem=ext4 lastmountpoint=/mnt/hdd0 modified=2013-08-29 21:29:24 mount.fstype=ext4 mount.options=rw,relatime,errors=remount-ro,data=ordered mounted=2013-08-29 21:29:24 state=mounted
我怀疑physical id
为您提供了HDD连接到的物理端口(在这种情况下为2)。
lsscsi --verbose
tech@tech:~$ lsscsi
[2:0:0:0] disk ATA SAMSUNG HD040GJ/ ZG10 /dev/sda
[3:0:1:0] disk ATA WDC WD3200AAJS-0 03.0 /dev/sdb
[4:0:0:0] disk Generic- Compact Flash 1.00 /dev/sdc
[4:0:0:1] disk Generic- SM/xD-Picture 1.00 /dev/sdd
[4:0:0:2] disk Generic- SD/MMC 1.00 /dev/sde
[4:0:0:3] disk Generic- MS/MS-Pro/HG 1.00 /dev/sdf
此实用程序将为您提供ATA端口0至3。
sudo lshw -c storage -c disk
为您提供了许多有关硬盘驱动器的信息。
该bus info
字段为您提供每个HDD / SSD连接到的物理端口(在这种情况下为端口0和2)。
请注意,如果您的系统具有多个SATA控制器(板载或通过扩展卡),则数字可能会有所不同。
例如:
*-scsi:0
physical id: 1
logical name: scsi0
capabilities: emulated
*-disk
description: ATA Disk
product: Samsung SSD 840
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: BB6Q
serial: S1DBNSAF791657P
size: 232GiB (250GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 sectorsize=512 signature=d6cfe005
*-scsi:1
physical id: 2
logical name: scsi2
capabilities: emulated
*-disk
description: ATA Disk
product: CT500MX500SSD1
physical id: 0.0.0
bus info: scsi@2:0.0.0
logical name: /dev/sdb
version: 010
serial: 1810E132AC1E
size: 465GiB (500GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 sectorsize=4096 signature=0007569c