<?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>ni kvel &#187; Offline uncorrectable sectors</title>
	<atom:link href="http://orz.miroq.info/archives/tag/offline-uncorrectable-sectors/feed" rel="self" type="application/rss+xml" />
	<link>http://orz.miroq.info</link>
	<description>漠然的な Something を Do しちゃうところ。</description>
	<lastBuildDate>Fri, 29 May 2009 03:56:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>smartd での sector error 復活作業</title>
		<link>http://orz.miroq.info/archives/24</link>
		<comments>http://orz.miroq.info/archives/24#comments</comments>
		<pubDate>Sat, 18 Oct 2008 16:55:27 +0000</pubDate>
		<dc:creator>miroq</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[Offline uncorrectable sectors]]></category>
		<category><![CDATA[S.M.A.R.T]]></category>
		<category><![CDATA[sector]]></category>
		<category><![CDATA[smartd]]></category>

		<guid isPermaLink="false">http://orz.miroq.info/?p=24</guid>
		<description><![CDATA[家鯖で、Sector Read Error がでていて OS が立ち上がらなかったので、新規に Logical Volume 作って、一旦余っている領域から Logical Volume つくって rsync で同期後立ち上げなおした。 で、復旧後、smartd.log を見ると、家鯖の HDD で smard から↓のような悲鳴があがってた。 smartd[2684]: Device: /dev/sda, 1 Currently unreadable (pending) sectors smartd[2684]: Device: /dev/sda, 1 Offline uncorrectable sectors エラー箇所を調べるため、smartctl を実行 # smartctl &#8211;test=short /dev/sda smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen Home page is http://smartmontools.sourceforge.net/ === [...]]]></description>
			<content:encoded><![CDATA[<p>家鯖で、Sector Read Error がでていて OS が立ち上がらなかったので、新規に Logical Volume 作って、一旦余っている領域から Logical Volume つくって rsync で同期後立ち上げなおした。<br />
で、復旧後、smartd.log を見ると、家鯖の HDD で smard から↓のような悲鳴があがってた。</p>
<blockquote><p>smartd[2684]: Device: /dev/sda, 1 Currently unreadable (pending) sectors<br />
smartd[2684]: Device: /dev/sda, 1 Offline uncorrectable sectors</p></blockquote>
<p>エラー箇所を調べるため、smartctl を実行</p>
<blockquote><p># smartctl &#8211;test=short /dev/sda<br />
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen<br />
Home page is http://smartmontools.sourceforge.net/</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 Sun Oct 19 01:30:18 2008
</p></blockquote>
<p>んで、状況をみるために、smartctrl -l /dev/sda をやってみる。</p>
<blockquote><p># smartctl -l /dev/sda<br />
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen<br />
Home page is http://smartmontools.sourceforge.net/</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: read failure       90%       261         98652487
</p></blockquote>
<p>デテキターーーーーーーーーー。<br />
ということで、早速このセクタを直す作業にはいってみる。</p>
<p><span id="more-24"></span></p>
<p>LBA_of_first_error の番地が 98652487 なので、↓の公式を元に dd で Zero を埋める場所（seek する場所）を見つける。</p>
<blockquote><p>  b = (int)((L-S)*512/B)<br />
where:<br />
b = File System block number<br />
B = File system block size in bytes<br />
L = LBA of bad sector<br />
S = Starting sector of partition as shown by fdisk -lu<br />
and (int) denotes the integer part.</p></blockquote>
<p>今回は S の値は無しで B = 4096 L = 98652487 となるので、</p>
<blockquote><p> b = (int)(98652487 * 512 / 4096) = (int)12331560.875 = 12331560<br />
※ 小数点は切り捨て</p></blockquote>
<p>となった。dd にて seek 場所が 12331560 とわかったので、早速 dd</p>
<blockquote><p># dd if=/dev/zero of=/dev/sda bs=4096 count=1 seek=12331560<br />
1+0 records in<br />
1+0 records out<br />
4096 bytes (4.1 kB) copied, 0.000270448 s, 43.8 MB/s</p></blockquote>
<p>そして、正常にもどったかどうかチェック！</p>
<blockquote><p># smartctl &#8211;test=long /dev/sda<br />
# smarctl -l selftest /dev/sda<br />
SMART Self-test log structure revision number 1<br />
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error<br />
# 1  Extended offline    Self-test routine in progress 90%       268         -<br />
# 2  Extended offline    Completed without error       00%       263         -<br />
# 5  Short offline       Completed: read failure       90%       261         98652487
</p></blockquote>
<p>ナオッターーーーーーーーーーーーーーー！！！！<br />
念のため、xfs_repair してあげてから lvm logical volume なので、lvremove を使って使っていた論理ボリューム削除しました。これで再利用できるっ！！１！！</p>
]]></content:encoded>
			<wfw:commentRss>http://orz.miroq.info/archives/24/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
	</channel>
</rss>

