如果伺服器有做磁碟陣列,那麼運行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相關資訊】