linux硬盘检测工具

From : http://hi.baidu.com/dog_freedom/blog/item/94744f1337026c59f819b843.html

Smartmontools for SCSI硬盘: http://smartmontools.sourceforge.net/smartmontools_scsi.html

smartctl命令参数列表:

The following options are currently available for SCSI disks and tape drives unless otherwise noted:

  • -a | --all : equivalent to the combination -i -H -A -l error -l selftest options invoked in that order.

  • -A | --attributes : outputs the current device temperature, trip temperature, the number of elements in the grown defect list (GLIST) and data from the start-stop log page. Outputs some vendor specific information if available.

  • -C | --captive : used in conjunction with -t short or -t long options to do short or long self tests in the foreground. [Has no effect on tape drives.]

  • -d TYPE | --device=TYPE where TYPE is "ata", "scsi", "sat", "marvell", "3ware,N", "hpt,L/N[,M]" or "cciss,N". Overrides utility's guess about the class of the device which is based on the form of the nominated device's name.

  • -h | --help : outputs lengthy usage message and exits without any other action.

  • -H | --health : outputs single device health metric determined by the device manufacturer. This will be "OK" or a failure message.

  • -i | --info : outputs device identification information (derived from a SCSI INQUIRY command) and whether the device supports SMART (and temperature warnings) and if those facilities are currently enabled. The type of transport (e.g. FC or SAS) is also reported, if available. Some users have reported disks that report the wrong transport.

  • -l TYPE | --log=TYPE where TYPE is either "background", "selftest" or "error". Decodes are outputs the requested log. Note that --all does not include --log=background .

  • -q TYPE | --quietmode=TYPE where TYPE is either "silent" or "errorsonly". When the type is silent then nothing is output to the console but the exit status is set (so it is suitable for scripts). For "errorsonly" only errors are output to the console. The exit status is always set. [See the smartctl man page.]

  • -r TYPE | --report=TYPE where TYPE is either "ioctl[,<n>]" or "scsiioctl[,<n>]". Turns on low level debugging of issued commands and responses. These commands are issued through a system command called an "ioctl" in Unix. The debug can be for all issued commands (i.e. "ioctl") or only SCSI commands ("scsiioctl"). Optionally the TYPE can have a comma and a number post pended to increase the volume of debug. See this section for more details.

  • -s VALUE | --smart=VALUE where VALUE is either "on" or "off". Enables or disables SMART monitoring (and temperature warnings).

  • -S VALUE | --saveauto=VALUE where VALUE is either "on" or "off". Controls whether the error log values are preserved across device power cycles.

  • -t TEST | --test=TEST where TEST is either "offline", "short" or "long". Despite its name "offline" is a short foreground test that all SCSI devices should support. A "short" self test is typically 2 minutes or less. A "long" self test will be considerably longer than 2 minutes, depending on the size of the media. The estimated time that a "long" self test will take is printed after the "selftest" log (i.e. with '-l selftest' or '-a')

  • -V | --version : outputs the smartctl version number (including the cvs version of all its source files) and build information then exits without any other action.

  • -X | --abort : will terminate a background short or long self test. Usually the self test log notes that a self test has been aborted. [Has no effect on tape drives.]

简单用法:
1、smartctl -a <device>          检查该设备是否已经打开SMART技术。
2、smartctl -s on <device>    如果没有打开SMART技术,使用该命令打开SMART技术。
3、smartctl -t short <device>     后台检测硬盘,消耗时间短;
      smartctl -t long <device>      后台检测硬盘,消耗时间长;
      smartctl -C -t short <device> 前台检测硬盘,消耗时间短;
      smartctl -C -t long <device> 前台检测硬盘,消耗时间长。
其实就是利用硬盘SMART的自检程序。
4、smartctl -X <device> 中断后台检测硬盘。
5、smartctl -l selftest <device> 显示硬盘检测日志。
6、smartctl -l error <device> 显示硬盘错误汇总。

 

 

让S.M.A.R.T为电脑硬盘站岗放哨

看了“Monitoring Hard Drive Health on Linux with smartmontools”一文(中文意思“在 linux用smartmontools监视硬盘驱动健康”),总算知道了一点有关S.M.A.R.T的皮毛。原文出处:http://blog.shadypixel.com/monit ... with-smartmontools/,英文,有理解欠妥或不正确的地方,请朋友们指正。

看来debian安装时,smartmontools 已经存在了,怎样启动,前面已提到,就不重复了。谢谢各位朋友鼓励。问题是启动以后怎么办,最后要达到什么结果,就是以下需要探讨的。我已经根据文章提示做过一遍,所以是安全的。

文章用的是sudo命令,所以,建议先检查一下sudo装了没有,如果没装,就进入以下这一步。

Root用户下输入命令:
apt-get install sudo

设置sudoers:
chmod +w /etc/sudoers
vim /etc/sudoers
添加一行 username ALL=(ALL) ALL
其中username是用户名,保存退出。
(编辑时点键盘上插入键,即可输入文字。编辑后点Esc键,再输入:wq即可保存退出。)
更改sudoers文件权限 chmod 0440 /etc/sudoers

输入命令:
$ sudo smartctl -i /dev/sda

出现以下结果:

=== START OF INFORMATION SECTION ===
Model Family: SAMSUNG SpinPoint T133 series
Device Model: SAMSUNG HD300LJ
Serial Number: S0D7J1UL303628
Firmware Version: ZT100-12
User Capacity: 300,067,970,560 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: ATA/ATAPI-7 T13 1532D revision 4a
Local Time is: Fri Jan 2 03:08:20 2009 EST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
说明SMART已经处于支持状态。

输入命令:
$ sudo smartctl -s on -o on -S on /dev/sda

出现以下结果:

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.
SMART Attribute Autosave Enabled.
SMART Automatic Offline Testing Enabled every four hours.
说明SMART将每四小时自动测试一下。

输入命令:
$ sudo smartctl -H /dev/sda

出现以下结果:

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
说明到目前为此,电脑硬盘驱动处于健康状态。通过检测。

如果没有PASSED(通过),这时所要做的就是尽快备份硬盘里的数据,因为没有多久,硬盘就要坏了。这就是该软件最后要达到的警示目的。后面还有些内容,进一步了解也可以,就不赘言了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值