IT猫扑网:您身边最放心的安全下载站! 最新更新|软件分类|软件专题|手机版|论坛转贴|软件发布

您当前所在位置:首页操作系统LINUX → FreeBSD/Linux检测硬盘坏道

FreeBSD/Linux检测硬盘坏道

时间:2015/6/28来源:IT猫扑网作者:网管联盟我要评论(0)

  Linux检测硬盘坏道

  bAdBlocks

  功能说明:检查磁盘装置中损坏的区块。

  语法:badblocks [-svw][-b ][-o ][磁盘装置][磁盘区块数][启始区块]

  补充说明:执行指令时须指定所要检查的磁盘装置,及此装置的磁盘区块数。

  参数:

  -b 指定磁盘的区块大小,单位为字节。

  -o 将检查的结果写入指定的输出文件。

  -s 在检查时显示进度。

  -v 执行时显示详细的信息。

  -w 在检查时,执行写入测试。

  [磁盘装置] 指定要检查的磁盘装置。

  [磁盘区块数] 指定磁盘装置的区块总数。

  [启始区块] 指定要从哪个区块开始检查。

  badblocks 检测磁盘坏块

  1)$badblocks -s //显示进度 -v //显示执行详细情况 /dev/sda1

  2)读写方式检测 未挂载的磁盘设备或分区

  $badblocks -s //显示进度 -w //以写去检测 -v //显示执行详细情况 /dev/sda2

  FreeBsd检测硬盘坏道

  利用硬盘的S.M.A.R.T.功能来做。

  cd /usr/ports/sysutils/smartmontools

  make install

  快速检查硬盘是否有问题

  smartctl -a /dev/ad0

  表面测试

  smartctl -t long /dev/ad0

  好像还有一个badtrk工具

  =========================================================================

  smartctl详解:

  linuxsir.org/bbs/showthread.php?s=&threadid=81020">https://www.linuxsir.org/bbs/showthread.php?s=&threadid=81020

  werix

  监测你的硬盘 - 提前预报系统SMART

  前言:

  大家心理最怕的不是安装某个系统,而是辛辛苦苦安装之后,忽然有一天硬盘坏了,又没有备份(DAT,DLT之类磁带机贵得吓死人)。怎么样才能知道你的硬盘能否过新年呢?(硬盘状态如何?) 特别是如果能够提前预报,告诉大家硬盘快顶不住了,那该多好。

  解决办法:

  SMART

  SMART(SFF-8035i) 是硬盘生产商们建立的一个工业标准,这个标准就是在硬盘上保存一个跟执行情况,可靠程度,读找错误率等属性的表格。所有属性都有一个1byte(大小范围1-253)的标准化值,还包含另一个1byte的关键阶段值,如果属性表格内某个数据接近小于或达到关键阶段值,那么你的硬盘就快跟你永别了,至少也是超过它的设计使用极限了- 该做备份和最坏的打算了。

  SFF-8035i工业标准经过ATA-3,ATA-4到了ATA-5,加入了一个错误信息文件(errorlog) 和一系列硬盘自测SMART命令。SMART适应与IDE和SCSI硬盘。

  我用FreeBSD 5.2和Debian做了实验,都不错,OpenBSD下面可以直接用atactl,大家看看man atactl,或是下面的帖子。其它linux系统没问题,可以看文章最后给出的官方网站去查询一下你的系统。

  1。安装 smartmontools

  FreeBSD:

  #/usr/ports/sysutils/smartmontools

  #make install clean

  #cp /usr/local/etc/rc.d/smartd.sh.sample /usr/local/etc/rc.d/smartd.sh

  #cp /usr/local/etc/smartd.conf.sample /usr/local/etc/smartd.conf

  #chmod 555 /usr/local/etc/rc.d/smartd.sh

  Debian:

  apt-get install smartmontool*

  /etc/smartd.conf

  FreeBSD设置文件/usr/local/etc/smartd.conf

  Debian设置文件 /etc/smartd.conf

  注意:

  千万不要忘了改写设置文件!!!!

  FreeBSD下第一张IDE硬盘是ad0,SCSI硬盘是da0

  Debian下第一张IDE硬盘是/dev/hda,SCSI硬盘是/dev/sda

  下面我用FreeBSD做例子,我的硬盘是IDE,如果你的是SCSI,你就去官方网站启动监护程序:

  /usr/local/etc/rc.d/smartd.sh start

  首先让我们看一下你的硬盘是否支持SMART:

  bash-2.05b# smartctl -i /dev/ad0

  smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen

  Home page is https://smartmontools.sourceforge.net/

  === START OF INFORMATION SECTION ===

  Device Model: IBM-DJSA-220

  Serial Number: 44K443Z0103

  Firmware Version: JS4OAC3A

  Device is: Not in smartctl database [for details use: -P showall]

  ATA Version is: 5

  ATA Standard is: ATA/ATAPI-5 T13 1321D revision 1

  Local Time is: Mon Dec 22 21:04:38 2003 CET

  SMART support is: Available - device has SMART capability.

  SMART support is: enable

  The SMART RETURN STATUS return value (smartmontools -H option/Directive)

  can not be retrieved with this version of ATAng, please do not rely on this value

  看看我的盘健康测试,如果你的self-assessment test result是FAILING,那就是说它要完蛋了,马上备份!!!

  bash-2.05b# smartctl -Hc /dev/ad0

  smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen

  Home page is https://smartmontools.sourceforge.net/

  The SMART RETURN STATUS return value (smartmontools -H option/Directive)

  can not be retrieved with this version of ATAng, please do not rely on

  this value

#p#副标题#e#

  === START OF READ SMART DATA SECTION ===

  SMART overall-health self-assessment test result: PASSED

  General SMART Values:

  Offline data collection status: (0x00) Offline data collection activity

  was

  never started.

  Auto Offline Data Collection: Disabled.

  Self-test execution status: ( 0) The previous self-test routine completed

  without error or no self-test has

  ever

  been run.

  Total time to complete Offline

  data collection: ( 650) seconds.

  Offline data collection

  capabilities: (0x1b) SMART execute Offline immediate.

  Auto Offline data collection on/off

  support.

  Suspend Offline collection upon

  new

  command.

  Offline surface scan supported.

  Self-test supported.

  No Conveyance Self-test supported.

  No Selective Self-test supported.

  SMART capabilities: (0x0003) Saves SMART data before entering

  power-saving mode.

  Supports SMART auto save timer.

  Error logging capability: (0x01) Error logging supported.

  No General Purpose Logging support.

  Short self-test routine

  recommended polling time: ( 2) minutes.

  Extended self-test routine

  recommended polling time: ( 29) minutes.

  下面表格给出的属性信息根据你的硬盘厂商不同而不同,最 重要的是明白每个纵行的意义:如果有一个标准值(VALUE)小于或等於关键值(THRESH)时,WHEN_FAILED 行会给出信息,我的WHEN_FAILED纵行是空行,说明没事儿。如果WHEN_FAILED报错,硬盘有问题了。。。。WORST 是标准值(VALUE)的最小值。

  bash-2.05b# smartctl -A /dev/ad0

  smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen

  Home page is https://smartmontools.sourceforge.net/

  The SMART RETURN STATUS return value (smartmontools -H option/Directive)

  can not be retrieved with this version of ATAng, please do not rely on

  this value

  === START OF READ SMART DATA SECTION ===

  SMART Attributes Data Structure revision number: 16

  Vendor Specific SMART Attributes with Thresholds:

  ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED

  WHEN_FAILED RAW_VALUE

  1 Raw_Read_Error_Rate 0x000b 100 100 062 Pre-fail Always

  - 0

  2 Throughput_Performance 0x0005 100 100 040 Pre-fail Offline

  - 0

  3 Spin_Up_Time 0x0007 113 113 033 Pre-fail Always

  - 1

  4 Start_Stop_Count 0x0012 100 100 000 Old_age Always

  - 985

  5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always

  - 0

  7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always

  - 0

  8 Seek_Time_Performance 0x0005 100 100 040 Pre-fail Offline

  - 0

  9 Power_On_Hours 0x0012 097 097 000 Old_age Always

  - 1642

  1

关键词标签:FreeBSD,Linux检测硬盘

相关阅读

文章评论
发表评论

热门文章 安装红帽子RedHat Linux9.0操作系统教程安装红帽子RedHat Linux9.0操作系统教程使用screen管理你的远程会话使用screen管理你的远程会话GNU/Linux安装vmwareGNU/Linux安装vmware如何登录linux vps图形界面 Linux远程桌面连如何登录linux vps图形界面 Linux远程桌面连

相关下载

人气排行 Linux下获取CPUID、硬盘序列号与MAC地址linux tc实现ip流量限制dmidecode命令查看内存型号linux下解压rar文件安装红帽子RedHat Linux9.0操作系统教程Ubuntu linux 关机、重启、注销 命令lcx.exe、nc.exe、sc.exe入侵中的使用方法查看linux服务器硬盘IO读写负载