Linux查看硬盘型号的实例讲解

发布时间:2020-03-10编辑:脚本学堂
本文介绍下,在linux中查看硬盘型号的例子,分有无raid两种情况,有需要的朋友参考下吧。

在开始操作前,请先确定服务器是否有配RAID,有无raid操作方法是有区别的哦。
 
1,有RAID的情况
通过对应的RAID管理(监控)工具查看。
例如,LSI的MegaCli:
 

复制代码 代码示例:
# /opt/MegaCli -PDList -aALL
Adapter #0
Enclosure Device ID: 8
Slot Number: 0
Device Id: 0
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
Raw Size: 140014MB [0x11177328 Sectors]
Non Coerced Size: 139502MB [0x11077328 Sectors]
Coerced Size: 139392MB [0x11040000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c5000506c469
SAS Address(1): 0x0
Connected Port Number: 0
Inquiry Data: SEAGATE ST3146855SS     S5133LN1FB9Q
Enclosure Device ID: 8
Slot Number: 1
Device Id: 1
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
Raw Size: 140014MB [0x11177328 Sectors]
Non Coerced Size: 139502MB [0x11077328 Sectors]
Coerced Size: 139392MB [0x11040000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c50005071371
SAS Address(1): 0x0
Connected Port Number: 1
Inquiry Data: SEAGATE ST3146855SS     S5133LN1F4N6
Enclosure Device ID: 8
Slot Number: 2
Device Id: 2
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
Raw Size: 140014MB [0x11177328 Sectors]
Non Coerced Size: 139502MB [0x11077328 Sectors]
Coerced Size: 139392MB [0x11040000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c5000506b351
SAS Address(1): 0x0
Connected Port Number: 2
Inquiry Data: SEAGATE ST3146855SS     S5133LN1FC40
Enclosure Device ID: 8
Slot Number: 3
Device Id: 3
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
Raw Size: 140014MB [0x11177328 Sectors]
Non Coerced Size: 139502MB [0x11077328 Sectors]
Coerced Size: 139392MB [0x11040000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c5000506cc01
SAS Address(1): 0x0
Connected Port Number: 3
Inquiry Data: SEAGATE ST3146855SS     S5133LN1FBKX

一共有4块物理硬盘,型号均为SEAGATE ST3146855SS(希捷)。
 
2,没有RAID的情况
通过hdpalinuxjishu/13981.html target=_blank class=infotextkey>rm命令查看即可,步骤如下:
1、通过fdisk -l列出物理硬盘的设备名称
 

复制代码 代码示例:
# fdisk -l
Disk /dev/hda: 160.0 GB, 160040803840 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          25      200781   83  Linux
/dev/hda2              26        1069     8385930   83  Linux
/dev/hda3            1070        2113     8385930   83  Linux
/dev/hda4            2114       19457   139315680    5  Extended
/dev/hda5            2114        3157     8385898+  83  Linux
/dev/hda6            3158        3418     2096451   82  Linux swap
/dev/hda7            3419       19457   128833236   83  Linux
Disk /dev/hdd: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/hdd1               1       19457   156288321   83  Linux
 

共两块硬盘:/dev/hda、/dev/hdd。

2、通过hdparm命令查看指定硬盘的型号
 

复制代码 代码示例:
# hdparm -i /dev/hda
/dev/hda:
 Model=WDC WD1600BB-22GUC0, FwRev=08.02D08, SerialNo=WD-WMAL94830149
 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
 RawCHS=16383/16/63, TrkSize=57600, SectSize=600, ECCbytes=74
 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=268435455
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: device does not report version:
 * signifies the current active mode
# hdparm -i /dev/hdd
/dev/hdd:
 Model=WDC WD1600BB-00DWA0, FwRev=15.05R15, SerialNo=WD-WMAEK1512278
 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
 RawCHS=16383/16/63, TrkSize=57600, SectSize=600, ECCbytes=74
 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=268435455
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: device does not report version:
 * signifies the current active mode

/dev/hda的型号为WDC WD1600BB-22GUC0(西数),/dev/hdd的型号为WDC WD1600BB-00DWA0(西数)。
注意:如果服务器有配RAID,用hdparm查看硬盘信息时就会报错:
 

复制代码 代码示例:
# hdparm -i /dev/sda
/dev/sda:
 HDIO_GET_IDENTITY failed: Invalid argument