ceph存储 smartctl硬盘状态监控

来源:互联网 发布:手机定位软件开发 编辑:程序博客网 时间:2024/04/30 08:53
语法
smartctl [options] device

补充说明

系统需要安装smartmontools才可以使用smartctl命令。smartmontools 就是利用硬盘S.M.A.R.T. (Self-Monitoring_Analysis_and_Reporting) 特性特性监测硬盘的软件包,包含 smartctl 和 smartd 两个程序,前者是前台命令行工具、后者是后台运行程序。

# yum install kernel-utils

在 CentOS/Fedora 下安装smartmontools

# apt-get install smartmontools

在 Debian/Ubuntu 下安装

参数

smartctl -a  <device>    显示硬盘所有SMART信息。

smartctl -i <device>   显示硬盘model number, serial number,是否开启SMART等信息。

smartctl -s on <device>    如果没有打开SMART技术,使用该命令打开SMART技术。

smartctl -t short <device>    后台检测硬盘,消耗时间短

smartctl -t long <device>      后台检测硬盘,消耗时间长

smartctl -C -t short <device> 前台检测硬盘,消耗时间短

smartctl -C -t long <device>  前台检测硬盘,消耗时间长

smartctl -X <device>  中断后台检测硬盘。

smartctl -l selftest <device>  显示硬盘检测日志。

smartctl -l error <device> 显示硬盘错误汇总。

相关命令

hdparmsmartctl

实例

# smartctl -i /dev/sda 
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce AllenHome page is http://smartmontools.sourceforge.net/ START OF INFORMATION SECTIONModel Family:     Western Digital Caviar Second Generation Serial ATA familyDevice Model:     WDC WD3200JS-55PDB0Serial Number:    WD-WCAPD1876075Firmware Version: 21.00M21User Capacity:    320,072,933,376 bytesDevice is:        In smartctl database [for details use: -P show]ATA Version is:   7ATA Standard is:  Exact ATA specification draft version not indicatedLocal Time is:    Mon Dec 19 17:21:12 2011 CSTSMART support is: Available - device has SMART capability.SMART support is: Enabled

检查一下硬盘是否具有 SMART 特性

# smartctl -H /dev/sda 
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce AllenHome page is http://smartmontools.sourceforge.net/START OF READ SMART DATA SECTION SMART overall-health self-assessment test result: PASSED

查看硬盘健康状态

Note:结果是 PASSED 并不意味着硬盘100%安全,如果结果是Failure一般都有问题,您需要备份数据或更新硬盘。

# smartctl -t short /dev/sda 
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce AllenHome page is http://smartmontools.sourceforge.net/ START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION Sending command: "Execute SMART Short self-test routine immediately in off-line mode".Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.Testing has begun.Please wait 2 minutes for test to complete.Test will complete after Mon Dec 19 17:33:51 2011Use smartctl -X to abort test.

快速检测硬盘。

# smartctl -l selftest /dev/sda

查看硬盘测试结果

#smartctl -l error /dev/sda
-a 显示设备所有的SMART信息。

  -l error 列出硬盘错误日志。如果显示没有错误最好,如果显示了大量的错误信息,那就该着手准备替换硬盘了。

  -l selftest 列出自行测试结果。

 
0 0
原创粉丝点击