设为首页 收藏本站
查看: 990|回复: 0

[经验分享] 查看centos服务器硬盘状态信息

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-1-15 08:54:03 | 显示全部楼层 |阅读模式
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查看磁盘的状态:

1
2
3
4
5
6
# 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信息
QQ截图20150115085125.jpg


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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
QQ截图20150115085141.jpg
同样查看第二块、第三块磁盘的状态,根据自己的监控情况,加速nagios、zabbix报警

# smartctl -a -d megaraid,1 /dev/sdd
# smartctl -a -d megaraid,2 /dev/sdd
除此之外的smartctl用法,介绍的很详细:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# smartctl -h
Usage: smartctl [options] device
============================================ SHOW INFORMATION OPTIONS =====
  -h, --help, --usage
         Display this help and exit
  -V, --version, --copyright, --license
         Print license, copyright, and version information and exit
  -i, --info
         Show identity information for device
  -g NAME, --get=NAME
        Get device setting: all, aam, apm, lookahead, security, wcache
  -a, --all
         Show all SMART information for device
  -x, --xall
         Show all information for device
  --scan
         Scan for devices
  --scan-open
         Scan for devices and try to open each device

================================== SMARTCTL RUN-TIME BEHAVIOR OPTIONS =====

  -q TYPE, --quietmode=TYPE                                           (ATA)
         Set smartctl quiet mode to one of: errorsonly, silent, noserial
  -d TYPE, --device=TYPE      
Specify device type to one of: ata, scsi, sat[,auto][,N][+TYPE],
usbcypress[,X], usbjmicron[,x][,N], usbsunplus, marvell, areca,N/E,
3ware,N, hpt,L/M/N, megaraid,N, cciss,N, auto, test

  -T TYPE, --tolerance=TYPE                                           (ATA)
        Tolerance: normal, conservative, permissive, verypermissive
  -b TYPE, --badsum=TYPE                                              (ATA)
         Set action on bad checksum to one of: warn, exit, ignore
  -r TYPE, --report=TYPE
         Report transactions (see man page)
  -n MODE, --nocheck=MODE                                             (ATA)
         No check if: never, sleep, standby, idle (see man page)

============================== DEVICE FEATURE ENABLE/DISABLE COMMANDS =====

  -s VALUE, --smart=VALUE
        Enable/disable SMART on device (on/off)
  -o VALUE, --offlineauto=VALUE                                       (ATA)
        Enable/disable automatic offline testing on device (on/off)
  -S VALUE, --saveauto=VALUE                                          (ATA)
        Enable/disable Attribute autosave on device (on/off)
  -s NAME[,VALUE], --set=NAME[,VALUE]
        Enable/disable/change device setting: aam,[N|off], apm,[N|off],
        lookahead,[on|off], security-freeze, standby,[N|off|now],
        wcache,[on|off]

======================================= READ AND DISPLAY DATA OPTIONS =====

  -H, --health
        Show device SMART health status
  -c, --capabilities                                                  (ATA)
        Show device SMART capabilities
  -A, --attributes
        Show device SMART vendor-specific Attributes and values
  -f FORMAT, --format=FORMAT                                          (ATA)
        Set output format for attributes: old, brief, hex[,id|val]
  -l TYPE, --log=TYPE
        Show device log. TYPE: error, selftest, selective, directory[,g|s],
                               xerror[,N][,error], xselftest[,N][,selftest],
                               background, sasphy[,reset], sataphy[,reset],
                               scttemp[sts,hist], scttempint,N[,p],
                               scterc[,N,M], devstat[,N], ssd,
                               gplog,N[,RANGE], smartlog,N[,RANGE]
  -v N,OPTION , --vendorattribute=N,OPTION                            (ATA)
        Set display OPTION for vendor Attribute N (see man page)
  -F TYPE, --firmwarebug=TYPE                                         (ATA)
        Use firmware bug workaround: none, samsung, samsung2,
                                    samsung3, swapid
  -P TYPE, --presets=TYPE                                             (ATA)
        Drive-specific presets: use, ignore, show, showall
  -B [+]FILE, --drivedb=[+]FILE                                       (ATA)
        Read and replace [add] drive database from FILE
        [default is +/etc/smart_drivedb.h
         and then    /usr/share/smartmontools/drivedb.h]

============================================ DEVICE SELF-TEST OPTIONS =====

  -t TEST, --test=TEST
        Run test. TEST: offline, short, long, conveyance, force, vendor,N,
                        select,M-N, pending,N, afterselect,[on|off]
  -C, --captive
        Do test in captive mode (along with -t)
  -X, --abort
        Abort any non-captive test on device

=================================================== 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)



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-40840-1-1.html 上篇帖子: Linux文件和目录的特殊权限 下篇帖子: RHEL7.0启动时end_request I/O error及piix4_smbus错误提示处理 服务器 信息
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表