linux命令--查看硬盘信息(磁盘阵列模式下)

来源:互联网 发布:淘宝怎么免费开店 编辑:程序博客网 时间:2024/06/03 20:35

如果服务器有做磁盘阵列,那么运行fdisk -l或者smartctl –all /dev/sda,得不到你要的磁盘信息。

[root@localhost /]# fdisk -lWARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.Disk /dev/sda: 599.6 GB, 599584145408 bytes255 heads, 63 sectors/track, 72895 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk identifier: 0x000aadb9   Device Boot      Start         End      Blocks   Id  System/dev/sda1               1       72896   585531391+  ee  GPTPartition 1 does not start on physical sector boundary.WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.Disk /dev/sdb: 1999.3 GB, 1999307276288 bytes255 heads, 63 sectors/track, 243068 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk identifier: 0x00000000   Device Boot      Start         End      Blocks   Id  System/dev/sdb1               1      243069  1952448511+  ee  GPTPartition 1 does not start on physical sector boundary.[root@localhost /]# smartctl --all /dev/sdasmartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-358.el6.x86_64] (local build)Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.netVendor:               LSIProduct:              MR9260-8iRevision:             2.13User Capacity:        599,584,145,408 bytes [599 GB]Logical block size:   512 bytesLogical Unit id:      0x600605b00585ee301e70629e1af12036Serial number:        003620f11a9e62701e30ee8505b00506Device type:          diskLocal Time is:        Thu May  5 05:26:19 2016 EDTDevice does not support SMARTError Counter logging not supportedDevice does not support Self Test logging

可以借助MegaClI命令,MegaClI命令系统不自带,需要额外下载

下载地址,搜索MegaCLI即可找到:

http://www.avagotech.com/support/download-search

我下载到/root/usr/local目录下

[root@localhost local]# ls8-07-10_MegaCLI_Linux.zip  etc    include  lib64    sbin   srcbin                        games  lib      libexec  share

然后解压

[root@localhost local]# unzip 8-07-10_MegaCLI_Linux.zipArchive:  8-07-10_MegaCLI_Linux.zip  inflating: 8.07.10_MegaCLI_Linux/Linux MegaCLI 8.07.10.txt     creating: 8.07.10_MegaCLI_Linux/Linux MegaCLI 8.07.10/  inflating: 8.07.10_MegaCLI_Linux/Linux MegaCLI 8.07.10/MegaCli-8.07.10-1.noarch.rpm 

找到安装包

[root@localhost local]# ls8.07.10_MegaCLI_Linux      bin  games    lib    libexec  share8-07-10_MegaCLI_Linux.zip  etc  include  lib64  sbin     src[root@localhost local]# cd 8.07.10_MegaCLI_Linux/[root@localhost 8.07.10_MegaCLI_Linux]# ls -ltotal 52drwxr-xr-x. 2 root root  4096 Jun  6  2013 Linux MegaCLI 8.07.10-rw-r--r--. 1 root root 47364 Jun  7  2013 Linux MegaCLI 8.07.10.txt[root@localhost 8.07.10_MegaCLI_Linux]# cd Linux\ MegaCLI\ 8.07.10Linux MegaCLI 8.07.10/     Linux MegaCLI 8.07.10.txt  [root@localhost 8.07.10_MegaCLI_Linux]# cd Linux\ MegaCLI\ 8.07.10[root@localhost Linux MegaCLI 8.07.10]# ls -ltotal 1512-rw-r--r--. 1 root root 1546999 May 28  2013 MegaCli-8.07.10-1.noarch.rpm

安装MegaCLI,默认安装在/opt下面,建立软链到/usr/bin

[root@localhost Linux MegaCLI 8.07.10]# rpm -ivh MegaCli-8.07.10-1.noarch.rpm Preparing...                ########################################### [100%]   1:MegaCli                ########################################### [100%][root@localhost Linux MegaCLI 8.07.10]# ln -s /opt/MegaRAID/MegaCli/install.log                 libstorelibir-2.so.14.07-0  libstorelibir-2.so          MegaCli64                   [root@localhost Linux MegaCLI 8.07.10]# ln -s /opt/MegaRAID/MegaCli/MegaCli64 /usr/bin/

安装完成,命令查看硬盘信息

[root@localhost Linux MegaCLI 8.07.10]# cd /usr/bin[root@localhost bin]# /opt/MegaRAID/MegaCli/MegaCli64 -PDlist -aALLAdapter #0Enclosure Device ID: 252Slot Number: 0Drive's position: DiskGroup: 0, Span: 0, Arm: 0Enclosure position: N/ADevice Id: 23WWN: 5000C5007E156790Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SASRaw Size: 558.911 GB [0x45dd2fb0 Sectors]Non Coerced Size: 558.411 GB [0x45cd2fb0 Sectors]Coerced Size: 558.406 GB [0x45cd0000 Sectors]Sector Size:  0Logical Sector Size:  0Physical Sector Size:  0Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: 000BShield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x5000c5007e156791SAS Address(1): 0x0Connected Port Number: 1(path0) Inquiry Data: SEAGATE ST3600057SS     000B6SL9AQG9            FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :47C (116.60 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Port-1 :Port status: ActivePort's Linkspeed: Unknown Drive has flagged a S.M.A.R.T alert : NoEnclosure Device ID: 252Slot Number: 1Drive's position: DiskGroup: 0, Span: 0, Arm: 1Enclosure position: N/ADevice Id: 22WWN: 5000C5007E1F08A0Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SASRaw Size: 558.911 GB [0x45dd2fb0 Sectors]Non Coerced Size: 558.411 GB [0x45cd2fb0 Sectors]Coerced Size: 558.406 GB [0x45cd0000 Sectors]Sector Size:  0Logical Sector Size:  0Physical Sector Size:  0Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: 000BShield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x5000c5007e1f08a1SAS Address(1): 0x0Connected Port Number: 0(path0) Inquiry Data: SEAGATE ST3600057SS     000B6SL9BEFK            FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :48C (118.40 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Port-1 :Port status: ActivePort's Linkspeed: Unknown Drive has flagged a S.M.A.R.T alert : NoEnclosure Device ID: 252Slot Number: 4Drive's position: DiskGroup: 1, Span: 0, Arm: 0Enclosure position: N/ADevice Id: 4WWN: 5000c5003cbcbbafSequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SATARaw Size: 931.512 GB [0x74706db0 Sectors]Non Coerced Size: 931.012 GB [0x74606db0 Sectors]Coerced Size: 931.0 GB [0x74600000 Sectors]Sector Size:  0Logical Sector Size:  0Physical Sector Size:  0Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: SN03Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x4433221104000000Connected Port Number: 2(path0) Inquiry Data:             Z1N2ENH2ST1000NM0011                            SN03    FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :35C (95.00 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoEnclosure Device ID: 252Slot Number: 5Drive's position: DiskGroup: 1, Span: 0, Arm: 1Enclosure position: N/ADevice Id: 5WWN: 5000c5003cbe2f17Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SATARaw Size: 931.512 GB [0x74706db0 Sectors]Non Coerced Size: 931.012 GB [0x74606db0 Sectors]Coerced Size: 931.0 GB [0x74600000 Sectors]Sector Size:  0Logical Sector Size:  0Physical Sector Size:  0Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: SN03Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x4433221105000000Connected Port Number: 5(path0) Inquiry Data:             Z1N0ZASWST1000NM0011                            SN03    FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :32C (89.60 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoEnclosure Device ID: 252Slot Number: 6Drive's position: DiskGroup: 1, Span: 1, Arm: 0Enclosure position: N/ADevice Id: 25WWN: 5000c5003cbe2fb5Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SATARaw Size: 931.512 GB [0x74706db0 Sectors]Non Coerced Size: 931.012 GB [0x74606db0 Sectors]Coerced Size: 931.0 GB [0x74600000 Sectors]Sector Size:  0Logical Sector Size:  0Physical Sector Size:  0Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: SN03Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x4433221106000000Connected Port Number: 3(path0) Inquiry Data:             Z1N22ZGSST1000NM0011                            SN03    FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :33C (91.40 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoEnclosure Device ID: 252Slot Number: 7Drive's position: DiskGroup: 1, Span: 1, Arm: 1Enclosure position: N/ADevice Id: 24WWN: 5000c5003cbe29c3Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SATARaw Size: 931.512 GB [0x74706db0 Sectors]Non Coerced Size: 931.012 GB [0x74606db0 Sectors]Coerced Size: 931.0 GB [0x74600000 Sectors]Sector Size:  0Logical Sector Size:  0Physical Sector Size:  0Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: SN03Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x4433221107000000Connected Port Number: 4(path0) Inquiry Data:             Z1N070NTST1000NM0011                            SN03    FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :32C (89.60 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoExit Code: 0x00

从上面可以看出服务器有六块硬盘:

2块 SEAGATE ST3600057SS 600GB硬盘 4块 Z1N070NTST1000NM0011 1TB硬盘

MegaCli常用参数介绍
MegaCli -adpCount 【显示适配器个数】
MegaCli -AdpGetTime –aALL 【显示适配器时间】
MegaCli -AdpAllInfo -aAll 【显示所有适配器信息】
MegaCli -LDInfo -LALL -aAll 【显示所有逻辑磁盘组信息】
MegaCli -PDList -aAll 【显示所有的物理信息】
MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
MegaCli -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
MegaCli -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】
MegaCli -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】
MegaCli -cfgdsply -aALL 【显示Raid卡型号,Raid设置,Disk相关信息】

1 0