Linux使用smartctl检查服务器硬盘状况

1.安装smartmontools.

#CentOS
yum install smartmontools

2.查询通电时间及通电次数

[root@wsi ~]# smartctl -a /dev/sda | grep -E "Power_On_Hours|Power_Cycle_Count"
  9 Power_On_Hours          0x0012   100   100   000    Old_age   Always       -       3987
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       24

3.错误日志查询

[root@wsi ~]# smartctl -l error /dev/sda
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-042stab084.17] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART Error Log Version: 1
No Errors Logged

4.完整检测

[root@wsi ~]# smartctl -t long /dev/sdb
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-042stab084.17] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Extended self-test routine immediately in off-line mode".
Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 122 minutes for test to complete.
Test will complete after Sun Feb  2 03:45:23 2014

Use smartctl -X to abort test.

#通过该命令进行磁盘的扩展彻底检查 (大约要持续数小时,应该在低负载进行如果发现错误,基本可以说明需要更换硬盘)

5.查看完整检测日志:

[root@wsi ~]# smartctl -l selftest /dev/sdb
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-042stab084.17] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%      1120         -

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注


此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据