我有一个装有五个磁盘驱动器的 Linux 机器,我想更换其中一个。有问题的驱动器是/dev/sdc
,但这并没有告诉我如何区分硬件。驱动器是 SATA,驱动器到设备的分配有时会在启动后发生变化。
我希望能够使用磁盘上打印的型号名称。我知道这些名称是机器可读的,因为它们是 BIOS 使用的名称。
有没有办法使用 Linux 来找出系统的型号/dev/sdc
,甚至是所有驱动器的型号?
答案1
尝试hdparm
程序:
# hdparm -i /dev/sdc
/dev/sda:
Model=INTEL SSDSA2CW080G3, FwRev=4PC10362, SerialNo=CVPR112003RA080BGN
...
选项-i
可hdparm
用于检索识别信息。
答案2
我不确定它是否存在于所有发行版上,但请尝试查看 /dev/disk/by-id:
$ ls -l /dev/disk/by-id/
razem 0
lrwxrwxrwx 1 root root 9 08-08 14:45 ata-HL-DT-STDVD-RAM_GH22NS30 -> ../../sr0
lrwxrwxrwx 1 root root 9 08-08 14:45 ata-ST31000528AS_9VP8RZQM -> ../../sda
lrwxrwxrwx 1 root root 10 08-08 14:45 ata-ST31000528AS_9VP8RZQM-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 08-08 14:45 ata-ST31000528AS_9VP8RZQM-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 08-11 05:27 ata-ST31000528AS_9VP8RZQM-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 08-08 14:45 ata-ST31000528AS_9VP8RZQM-part7 -> ../../sda7
lrwxrwxrwx 1 root root 9 08-08 14:45 ata-ST3500630A_9QG9YH73 -> ../../sdb
lrwxrwxrwx 1 root root 10 08-08 14:45 ata-ST3500630A_9QG9YH73-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 08-11 02:56 ata-ST3500630A_9QG9YH73-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 08-08 12:45 ata-ST3500630A_9QG9YH73-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 10 08-08 12:45 ata-ST3500630A_9QG9YH73-part5 -> ../../sdb5
lrwxrwxrwx 1 root root 9 08-08 14:45 wwn-0x5000c5002737ee0c -> ../../sda
lrwxrwxrwx 1 root root 10 08-08 14:45 wwn-0x5000c5002737ee0c-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 08-08 14:45 wwn-0x5000c5002737ee0c-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 08-11 05:27 wwn-0x5000c5002737ee0c-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 08-08 14:45 wwn-0x5000c5002737ee0c-part7 -> ../../sda7
您还可以尝试通过 dmesg 搜索设备名称:
# dmesg|grep -C3 sda [2.387103]ata6.00:1953525168 个扇区,多 0:LBA48 NCQ(深度 31/32) [2.388346]ata6.00:配置为UDMA/133 [2.388418] scsi 5:0:0:0: 直接访问 ATA ST31000528AS CC38 PQ: 0 ANSI: 5 [2.388611]sd 5:0:0:0:[sda] 1953525168 512 字节逻辑块:(1.00 TB/931 GiB) [2.388653]sd 5:0:0:0:[sda]写保护已关闭 [2.388656]sd 5:0:0:0:[sda]模式感知:00 3a 00 00 [2.388664]sd 5:0:0:0:附加 scsi 通用 sg1 类型 0 [2.388669]sd 5:0:0:0:[sda]写入缓存:已启用,读取缓存:已启用,不支持 DPO 或 FUA [2.448514]SDA:SDA1 [2.448985]sd 5:0:0:0:[sda]附加的 SCSI 磁盘 [2.449040] scsi 8:0:0:0: 直接访问 ATA ST3500630A 3.AA PQ: 0 ANSI: 5 [2.449189]sd 8:0:0:0:[sdb] 976771055 512 字节逻辑块:(500 GB/465 GiB) [2.449225]sd 8:0:0:0:[sdb]写保护已关闭 --
在这种情况下,它是 ST31000528AS。
答案3
尝试运行:
$ sudo lshw
它将为您提供有关硬件的长输出,您所关心的输出将类似于此:
*-scsi:0
physical id: 0
logical name: scsi0
capabilities: emulated
*-disk
description: ATA Disk
product: WDC WD3200BEVT-7
vendor: Western Digital
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: 01.0
serial: WD-WX81A30C3330
size: 298GiB (320GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 sectorsize=512 signature=9f7685a8
*-volume:0
description: Linux filesystem partition
vendor: Linux
physical id: 1
bus info: scsi@0:0.0.0,1
logical name: /dev/sda1
logical name: /boot
version: 1.0
serial: aa84c5a8-6408-4952-b577-578f2a67af86
size: 141MiB
capacity: 141MiB
capabilities: primary extended_attributes ext2 initialized
configuration: filesystem=ext2 label=boot lastmountpoint=/boot modified=2012-08-11 17:03:06 mount.fstype=ext2 mount.options=rw,relatime mounted=2012-08-11 12:25:38 state=mounted
请注意,它将您的块设备 ID 标记为 ,logical name
并将序列号标记为product
。您可以使用它在物理上区分您的驱动器
答案4
如果lsblk
您的系统上已经安装,则可以使用此命令:
lsblk -o MODEL,SERIAL,SIZE,STATE --nodeps
这将返回如下所示的柱状显示,其中包含型号、制造商序列号、磁盘大小和状态。它也可以编写脚本以允许您访问远程机器。不过,您必须是 root 才能使用它。
MODEL SERIAL SIZE STATE
FUJITSU MHZ2320B K618T913BPHU 298.1G running
External W3PEEC6T 465.8G running
DVDRW DR-TD08HB 1024M running