smartctl
虚拟机不支持这个工具我主要是用它的查看健康状态这个功能,其它的用的少,算是mark以后用的时候再看吧
(1)检测是否开启
/dev/sda2是设备名,可以写需要检测的设备名称,N是终端编号,我在不加-d megaraid,0的时候终端提示如下
[root@rsync ~]# smartctl -i -d megaraid,0 /dev/sda2 | grep Device Device type: disk Device supports SMART and is Disabled //查看之后支持但是是关闭状态
(2)开启smart
[root@rsync ~]# smartctl --smart=on --offlineauto=on --saveauto=on -d megaraid,0 /dev/sda2
检测是否开启
[root@rsync ~]# smartctl -i -d megaraid,0 /dev/sda2|grep Device Device type: disk Device supports SMART and is Enabled //已经是enabled状态
(3)查看健康状态
[root@rsync ~]# smartctl -H -d megaraid,0 /dev/sda2 | grep SMART SMART Health Status: OK
(4)显示设备厂商和属性
[root@rsync ~]# smartctl -A -d megaraid,0 /dev/sda2 smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-504.el6.x86_64] (local build) Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net Current Drive Temperature: 34 C //设备当前温度 Drive Trip Temperature: 68 C //驱动跳闸温度(不准确,大神可以告知) Elements in grown defect list: 0 Vendor (Seagate) cache information Blocks sent to initiator = 426726713 Blocks received from initiator = 2972125000 Blocks read from cache and sent to initiator = 532160568 Number of read and write commands whose size <= segment size = 71965320 Number of read and write commands whose size > segment size = 33 Vendor (Seagate/Hitachi) factory information number of hours powered up = 37215.42 number of minutes until next internal SMART test = 2
(5)显示硬盘历史错误信息
[root@rsync ~]# smartctl -l error -d megaraid,0 /dev/sda2 smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-504.el6.x86_64] (local build) Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net Error counter log: Errors Corrected by Total Correction Gigabytes Total ECC rereads/ errors algorithm processed uncorrected fast | delayed rewrites corrected invocations [10^9 bytes] errors read: 157102965 0 0 157102965 157102965 3898.788 0 write: 0 0 0 0 0 5959.977 0 verify: 1984547768 0 0 1984547768 1984547768 46628.006 0 Non-medium error count: 5
(6)硬盘自测
[root@rsync ~]# smartctl --test=TEST -d megaraid,0 /dev/sda2 > /var/log/smart_short.log smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-504.el6.x86_64] (local build) Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net =======> INVALID ARGUMENT TO -t: TEST =======> VALID ARGUMENTS ARE: offline, short, long, conveyance, force, vendor,N, select,M-N, pending,N, afterselect,[on|off] <======= //可以采用这些参数,也可以将输出输入到文件中 Use smartctl -h to get a usage summary
中断自测
[root@rsync ~]# smartctl -X -d megaraid,0 /dev/sda2 smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-504.el6.x86_64] (local build) Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net Self Test returned without error
显示硬盘测试信息
[root@rsync ~]# smartctl -l selftest -d megaraid,0 /dev/sda2 smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-504.el6.x86_64] (local build) Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net SMART Self-test log Num Test Status segment LifeTime LBA_first_err [SK ASC ASQ] Description number (hours) # 1 Background long Aborted (by user command) 16 37215 - [- - -] # 2 Background short Completed 16 37215 - [- - -] # 3 Background long Completed 16 1 - [- - -] # 4 Background short Completed 16 0 - [- - -]
(7)显示全部信息
[root@rsync ~]# smartctl -a -d megaraid,0 /dev/sda2 smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-504.el6.x86_64] (local build) Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net Vendor: SEAGATE Product: ST3300657SS Revision: ES64 User Capacity: 300,000,000,000 bytes [300 GB] Logical block size: 512 bytes Logical Unit id: 0x5000c50043b38c53 Serial number: 6SJ3P4SG Device type: disk Transport protocol: SAS Local Time is: Mon Aug 8 18:02:21 2016 CST Device supports SMART and is Enabled Temperature Warning Enabled SMART Health Status: OK Current Drive Temperature: 35 C Drive Trip Temperature: 68 C Elements in grown defect list: 0 Vendor (Seagate) cache information Blocks sent to initiator = 431906112 Blocks received from initiator = 2980399378 Blocks read from cache and sent to initiator = 532720120 Number of read and write commands whose size <= segment size = 71975696 Number of read and write commands whose size > segment size = 33 Vendor (Seagate/Hitachi) factory information number of hours powered up = 37216.00 number of minutes until next internal SMART test = 27 Error counter log: Errors Corrected by Total Correction Gigabytes Total ECC rereads/ errors algorithm processed uncorrected fast | delayed rewrites corrected invocations [10^9 bytes] errors read: 157150833 0 0 157150833 157150833 3900.082 0 write: 0 0 0 0 0 5961.649 0 verify: 1984547768 0 0 1984547768 1984547768 46628.006 0 Non-medium error count: 5 SMART Self-test log Num Test Status segment LifeTime LBA_first_err [SK ASC ASQ] Description number (hours) # 1 Background long Aborted (by user command) 16 37215 - [- - -] # 2 Background short Completed 16 37215 - [- - -] # 3 Background long Completed 16 1 - [- - -] # 4 Background short Completed 16 0 - [- - -] Long (extended) Self Test duration: 3200 seconds [53.3 minutes]
hdparm
[root@rsync ~]# hdparm -t /dev/sda /dev/sda: Timing buffered disk reads: 894 MB in 3.00 seconds = 297.79 MB/sec
HDSentinel
这个工具我自己装了几遍都有问题,执行以后得到的信息很少,我以为是自己装的有问题,但是反复检查没什么毛病,然后直接去的官网看的,才发现linux版本确实存在这个问题,很多系统或者服务器都不支持。但是windows版本还是可以的。作者在回复网友说是会继续开发linux版本,有最新版本会在官网上发布的,敬请期待。
- [root@shijiazhuang ~]# mkdir HDSential
- [root@shijiazhuang ~]# cd HDSential/
- [root@shijiazhuang HDSential]# ls
- hdsentinel_008_x64.zip
- [root@shijiazhuang HDSential]# unzip hdsentinel_008_x64.zip
- [root@shijiazhuang HDSential]# ls
- HDSentinel hdsentinel_008_x64.zip
- [root@shijiazhuang HDSential]# chmod +x HDSentinel
- [root@shijiazhuang HDSential]# cp HDSentinel /usr/bin/
- [root@shijiazhuang HDSential]# HDSentinel