我有一个带有五个磁盘驱动器的 Linux 机器,我想更换其中一个。有问题的驱动器是/dev/sdc,但这并没有告诉我如何区分硬件。驱动器是 SATA 驱动器,设备的驱动器分配有时会在启动后发生变化。
我希望能够使用印在磁盘上的型号名称。我知道这些名称是机器可读的,因为它们是 BIOS 使用的名称。
有没有办法,使用Linux,找出/dev/sdc系统中所有驱动器的型号,甚至型号?
Lek*_*eyn 13
试试这个hdparm程序:
# hdparm -i /dev/sdc
/dev/sda:
Model=INTEL SSDSA2CW080G3, FwRev=4PC10362, SerialNo=CVPR112003RA080BGN
...
Run Code Online (Sandbox Code Playgroud)
该-i的选项hdparm可用于检索标识信息。
我不确定它是否在所有发行版上,但尝试查看 /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
Run Code Online (Sandbox Code Playgroud)
您还可以尝试使用 grepping 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。
尝试运行:
$ sudo lshw
Run Code Online (Sandbox Code Playgroud)
它将为您提供有关您的硬件的长输出,您所关心的输出将类似于以下内容:
*-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
Run Code Online (Sandbox Code Playgroud)
请注意,它提到了您的块设备 IDlogical name和序列号product。您可以使用它来物理区分您的驱动器