我需要获取有关磁盘驱动器的一些详细信息,例如“型号”、“序列号”和“固件版本”并知道 hdparm 应该帮助我。
但这并没有帮助我获得所需的东西。以下是我得到的输出
sudo /sbin/hdparm -I /dev/sda
结果 :
/dev/sda:
ely used: 1
Configuration:
Logical max current
cylinders SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ATA device, with non-removable media
Standards:
Lik 0 0
heads 0 0
sectors/track 0 0
--
Logical/Physical Sector size: 512 bytes
device size with M = 1024*1024: 0 MBytes
device size with M = 1000*1000: 0 MBytes
cache/buffer size = unknown
Capabilities:
IORDY not likely
Cannot perform double-word IO
R/W multiple sector transfer: not supported
DMA: not supported
PIO: pio0
不知道我错过了什么。
答案1
lshw -class disk
部分产量:
*-disk
description: ATA Disk
product: WDC WD20EARS-00M
vendor: Western Digital
physical id: 0.0.0
bus info: scsi@2:0.0.0
logical name: /dev/sda
version: AB51
serial: WD-W[REDACTED]
size: 1863GiB (2TB)
capabilities: gpt-1.00 partitioned partitioned:gpt
configuration: ansiversion=5 guid=8e8f2916-5fc4-41ce-9430-30d7fe0c03ab logicalsectorsize=512 sectorsize=512
我相信version
是固件版本,product
是型号。
答案2
使用udevadm
info
:
$ udevadm info /dev/sda
P: /devices/pci0000:00/0000:00:15.0/0000:03:00.0/host2/target2:0:0/2:0:0:...
N: sda
S: disk/by-id/scsi-c250523c020fe61ec6913ee42aa060f8b
S: disk/by-id/wwn-0x250523c020fe61ec6913ee42aa060f8b
S: disk/by-path/pci-0000:03:00.0-scsi-0:0:0:0
E: DEVLINKS=/dev/disk/by-id/wwn-0x250523c020fe61ec6913ee42aa060f8b /dev/d...
E: DEVNAME=/dev/sda
E: DEVPATH=/devices/pci0000:00/0000:00:15.0/0000:03:00.0/host2/target2:0:...
E: DEVTYPE=disk
E: ID_BUS=scsi
E: ID_MODEL=VMware_Virtual_S
E: ID_MODEL_ENC=VMware\x20Virtual\x20S
E: ID_PART_TABLE_TYPE=dos
E: ID_PART_TABLE_UUID=eda8f246
E: ID_PATH=pci-0000:03:00.0-scsi-0:0:0:0
E: ID_PATH_TAG=pci-0000_03_00_0-scsi-0_0_0_0
E: ID_REVISION=1.0
E: ID_SCSI=1
E: ID_SCSI_SERIAL=250523c020fe61ec6913ee42aa060f8b
E: ID_SERIAL=c250523c020fe61ec6913ee42aa060f8b
E: ID_SERIAL_SHORT=250523c020fe61ec6913ee42aa060f8b
E: ID_TYPE=disk
E: ID_VENDOR=VMware_
E: ID_VENDOR_ENC=VMware\x2c\x20
E: ID_WWN=0x250523c020fe61ec
E: ID_WWN_VENDOR_EXTENSION=0x6913ee42aa060f8b
E: ID_WWN_WITH_EXTENSION=0x250523c020fe61ec6913ee42aa060f8b
E: MAJOR=8
E: MINOR=0
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZED=1867167
答案3
尝试获取数据时出现读取错误 ( SG_IO: bad/missing sense data
) 。hdparm
这就是为什么输出是无意义的,并且包含很多零。
查看dmesg
(读取错误发生后的最后几行)的输出,可能找出错误的详细信息。
您也可以尝试hdparm -i /dev/sda
(小写i
而不是大写I
),这将显示内核在启动时存储的型号和序列信息。这也可能出错,因为在启动时发生了类似的错误,但值得一试。
如果您的硬盘以某种方式损坏并且不支持获取供应商/型号/序列信息的命令,那么您将无法获取它。