<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>深度VPS &#187; smartd</title>
	<atom:link href="http://www.deepvps.com/tag/smartd/feed" rel="self" type="application/rss+xml" />
	<link>http://www.deepvps.com</link>
	<description>专注VPS技术，关注前端技术</description>
	<lastBuildDate>Sat, 04 Feb 2023 14:00:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux 下用 smartd 监测硬盘状况</title>
		<link>http://www.deepvps.com/monitoring-hard-disk-health-with-smartd-under-linux.html</link>
		<comments>http://www.deepvps.com/monitoring-hard-disk-health-with-smartd-under-linux.html#comments</comments>
		<pubDate>Thu, 05 Aug 2010 15:28:01 +0000</pubDate>
		<dc:creator>deepvps</dc:creator>
				<category><![CDATA[网络杂谈]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[smartd]]></category>
		<category><![CDATA[监测]]></category>
		<category><![CDATA[硬盘状况]]></category>

		<guid isPermaLink="false">http://www.deepvps.com/?p=489</guid>
		<description><![CDATA[和处理器、内存比较，硬盘是服务器上最慢的子系统、是最容易出现性能瓶颈的地方，也是最脆弱的部分。因为硬盘离处理器距离最远而且访问硬盘要涉及到一些机械操作，比如转轴、寻轨等，而机械是容易出故障的。作为 VPS 服务商和系统管理员来说，最害怕的就是硬盘出毛病，所以监测硬盘的健康状况、提前预警是件很重要的事情。我们 PC 服务器上差不多1.5年都会有硬盘坏掉，坏掉前一点征兆都没有，SUN 服务器上的情况要好得到，很多 SATA/SCSI 硬盘运行了5年都没问题，看样子品牌服务器还是贵得有理由的。deepvps 前段时间看过 Google 发表的一篇论文：Failure Trends in a Large Disk Drive Population 也证实了我们的经历，结论是所有坏掉的硬盘中只有60％可以被 S.M.A.R.T. 检测到，也就是说 S.M.A.R.T. 的测试结果只有60％是正确的，所以我们还不能完全依赖 S.M.A.R.T. 的监测结果。
目前市面上所有的硬盘都具有 S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) 特性，smartmontools 就是利用这一特性监测硬盘的软件包，包含 smartctl 和 smartd 两个程序，前者是前台命令行工具、后者是后台运行程序，smartmontools
安装 smartmontools
在 CentOS/Fedora 下安装：
# yum install kernel-utils
在 Debian/Ubuntu 下安装：
# apt-get install smartmontools
使用 smartmontools
在使用 smartmontools 测试之前先检查一下硬盘是否具有 SMART 特性：
# smartctl -i [...]]]></description>
			<content:encoded><![CDATA[<p>和处理器、内存比较，硬盘是服务器上最慢的子系统、是最容易出现性能瓶颈的地方，也是最脆弱的部分。因为硬盘离处理器距离最远而且访问硬盘要涉及到一些机械操作，比如转轴、寻轨等，而机械是容易出故障的。作为 VPS 服务商和系统管理员来说，最害怕的就是硬盘出毛病，所以监测硬盘的健康状况、提前预警是件很重要的事情。我们 PC 服务器上差不多1.5年都会有硬盘坏掉，坏掉前一点征兆都没有，SUN 服务器上的情况要好得到，很多 SATA/SCSI 硬盘运行了5年都没问题，看样子品牌服务器还是贵得有理由的。deepvps 前段时间看过 Google 发表的一篇论文：<a href="http://labs.google.com/papers/disk_failures.pdf" target="_blank">Failure Trends in a Large Disk Drive Population</a> 也证实了我们的经历，结论是所有坏掉的硬盘中只有60％可以被 S.M.A.R.T. 检测到，也就是说 S.M.A.R.T. 的测试结果只有60％是正确的，所以我们还不能完全依赖 S.M.A.R.T. 的监测结果。</p>
<p><span id="more-489"></span>目前市面上所有的硬盘都具有 S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) 特性，<a href="http://sourceforge.net/apps/trac/smartmontools/" target="_blank">smartmontools</a> 就是利用这一特性监测硬盘的软件包，包含 smartctl 和 smartd 两个程序，前者是前台命令行工具、后者是后台运行程序，smartmontools</p>
<h2>安装 smartmontools</h2>
<p>在 CentOS/Fedora 下安装：</p>
<blockquote><p># yum install kernel-utils</p></blockquote>
<p>在 Debian/Ubuntu 下安装：</p>
<blockquote><p># apt-get install smartmontools</p></blockquote>
<h2>使用 smartmontools</h2>
<p>在使用 smartmontools 测试之前先检查一下硬盘是否具有 SMART 特性：</p>
<blockquote><p># smartctl -i /dev/sda</p>
<p>=== START OF INFORMATION SECTION ===<br />
Device Model: SEAGATE ST32500NSSUN250G 0741B58YP8<br />
Serial Number: 5QE58YP8<br />
Firmware Version: 3.AZK<br />
User Capacity: 250,056,000,000 bytes<br />
Device is: Not in smartctl database [for details use: -P showall]<br />
ATA Version is: 7<br />
ATA Standard is: Exact ATA specification draft version not indicated<br />
Local Time is: Thu Jul 22 22:39:07 2010 SAST<br />
SMART support is: Available &#8211; device has SMART capability.<br />
SMART support is: Enabled</p></blockquote>
<p>如果上面 SMART support 是 Disabled 状态的话，需要开启 SMART 的支持：</p>
<blockquote><p># smartctl -s on /dev/sda</p>
<p>=== START OF ENABLE/DISABLE COMMANDS SECTION ===<br />
SMART Enabled.</p></blockquote>
<p>检查硬盘状况，如果下面的结果不是 PASSED 的话你需要立刻警觉起来，马上备份所有数据，硬盘随时都可能出问题（不过值得注意的是就算结果是 PASSED 并不意味着硬盘100％就安全，PASS 不能代表没问题，没 PASS 代表一定有问题）：</p>
<blockquote><p># smartctl -H /dev/sda</p>
<p>=== START OF READ SMART DATA SECTION ===<br />
SMART overall-health self-assessment test result: PASSED</p></blockquote>
<p>做个快速自检：</p>
<blockquote><p># smartctl -t short /dev/sda</p>
<p>=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===<br />
Sending command: &#8220;Execute SMART Short self-test routine immediately in off-line mode&#8221;.<br />
Drive command &#8220;Execute SMART Short self-test routine immediately in off-line mode&#8221; successful.<br />
Testing has begun.<br />
Please wait 1 minutes for test to complete.<br />
Test will complete after Thu Jul 22 22:51:00 2010</p>
<p>Use smartctl -X to abort test.</p></blockquote>
<p>执行上面的自检命令后等待一段时间，可以通过下面命令来看进度和结果：</p>
<blockquote><p># smartctl -l selftest /dev/sda</p>
<p>=== START OF READ SMART DATA SECTION ===<br />
SMART Self-test log structure revision number 1<br />
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error<br />
# 1 Short offline Completed without error 00% 20949 -<br />
# 2 Short offline Completed without error 00% 20947 -</p></blockquote>
<p>要做长时间自检的话（很耗时，建议放在凌晨时间段做）：</p>
<blockquote><p># smartctl -t long /dev/sda</p></blockquote>
<p>查看出错日志：</p>
<blockquote><p># smartctl -l error /dev/sda</p>
<p>=== START OF READ SMART DATA SECTION ===<br />
SMART Error Log Version: 1<br />
No Errors Logged</p></blockquote>
<h2>配置 smartmontools</h2>
<p>在 CentOS/Fedora 下：</p>
<blockquote><p># vi /etc/smartd.conf<br />
# /etc/init.d/smartd restart</p></blockquote>
<p>在 Debian/Ubuntu 下：</p>
<blockquote><p># vi /etc/default/smartmontools<br />
# vi /etc/smartd.conf<br />
# /etc/init.d/smartmontools restart</p></blockquote>
<p>可以通过修改以上的 smartmontools 的配置文件来定期对硬盘做健康检查，就像给人定期体检一样，体检过了并不代表就没病（很多疾病用体检的设备都查不到），所以这也符合 Google 的硬盘报告所说的情况，所有坏掉的硬盘中只有60％可以被 S.M.A.R.T. 检测到（所有生病的人中只有60％能在体检的时候发现）。</p>
<p>转载自：<a href="http://www.vpsee.com/2010/07/monitoring-hard-disk-health-with-smartd-under-linux/" target="_blank">http://www.vpsee.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deepvps.com/monitoring-hard-disk-health-with-smartd-under-linux.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
