windows下有HDTune可以查看磁盘的状态,防止磁盘挂掉才会自己知道,CentOS下有SMART (Self-Monitoring, Analysis and  Reporting Technology System) 同样对磁盘做状态检测

http://www.smartmontools.org/

下面以dell R720服务器举例,/dev/sda是1T的scsi接口普通硬盘,/dev/sdd 是三块盘做的raid5

# df -h                                  #查看磁盘的名字

# dmesg |grep sdd               #查看开机信息里面的磁盘info

sd 0:2:0:0: [sdd] Attached SCSI disk

# hdparm -I /dev/sda           #查看磁盘硬件信息、开启的功能等,信息特别详细

下面用smart查看磁盘的状态:

# yum install smartmontools  //安装SMART

# smartctl -H /dev/sdd   //磁盘健康状况查看

smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.10.56-11.el6.centos.alt.x86_64] (local build)

Copyright (C) 2002-12 by Bruce Allen,

http://smartmontools.sourceforge.net

SMART Health Status: OK

# smartctl -A /dev/sda  或者 smartctl --all /dev/sda  #硬盘的smart信息

查看centos服务器硬盘状态信息


# smartctl -a /dev/sdd 

smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.10.56-11.el6.centos.alt.x86_64] (local build)

Copyright (C) 2002-12 by Bruce Allen,

http://smartmontools.sourceforge.net

Vendor: DELL

Product: PERC H310

Revision: 2.12

User Capacity: 598,879,502,336 bytes [598 GB]

Logical block size: 512 bytes

Logical Unit id

Serial number: 

Device type: disk

Local Time is: Wed Jan 14 15:37:39 2015 CST

Device does not support SMART

Error Counter logging not supported

Device does not support Self Test logging

这里提示Device does not support SMART,所以按下面方式查看  

查看raid5中第一块磁盘的状态

# smartctl -a -d megaraid,0 /dev/sdd

查看centos服务器硬盘状态信息

同样查看第二块、第三块磁盘的状态,根据自己的监控情况,加速nagios、zabbix报警

# smartctl -a -d megaraid,1 /dev/sdd  

# smartctl -a -d megaraid,2 /dev/sdd

除此之外的smartctl用法,介绍的很详细:

# smartctl -h

Usage: smartctl [options] device

============================================ SHOW INFORMATION OPTIONS =====

  -h, --help, --usage

         Display this help and exit


=================================================== SMARTCTL EXAMPLES =====

  smartctl --all /dev/hda                    (Prints all SMART information)

  smartctl --smart=on --offlineauto=on --saveauto=on /dev/hda

                                              (Enables SMART on first disk)

  smartctl --test=long /dev/hda          (Executes extended disk self-test)

  smartctl --attributes --log=selftest --quietmode=errorsonly /dev/hda

                                      (Prints Self-Test & Attribute errors)

  smartctl --all --device=3ware,2 /dev/sda

  smartctl --all --device=3ware,2 /dev/twe0

  smartctl --all --device=3ware,2 /dev/twa0

  smartctl --all --device=3ware,2 /dev/twl0

          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)

  smartctl --all --device=hpt,1/1/3 /dev/sda

          (Prints all SMART info for the SATA disk attached to the 3rd PMPort

           of the 1st channel on the 1st HighPoint RAID controller)

  smartctl --all --device=areca,3/1 /dev/sg2

          (Prints all SMART info for 3rd ATA disk of the 1st enclosure

           on Areca RAID controller)

转:http://linux.it.net.cn/CentOS/fast/2015/0116/12045.html

转载于:https://blog.51cto.com/314258/1683889

相关文章:

  • 2021-11-13
  • 2021-10-27
  • 2021-09-18
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2021-12-15
  • 2021-12-28
  • 2022-02-05
相关资源
相似解决方案