サーバマシンのrootから以下のメールが来た。
しかし、その後の
とりあえず、FreeBSDの場合は fdisk -luとかでは情報が出ないので、disklabelで見てみる。
しかし、稼働中のシステムの一部にddで0を書きこむなんて怖くてできないので、代わりのHDDを買ってきてシステムを移行してから試すことにしよう。
ちなみに、前回HDDを交換したのは2009年の3月のようだ。2年半とするとちょっと寿命が短いなあ。
こう言ったメンテナンスとか、毎月の電気代、UPSのバッテリー代などを考えると、自宅サーバを続けるよりもVPSに移行した方が良いんじゃないかと最近考える。
ちょっと調べてみたけど、メジャーなところではさくらのVPSかDTIのServersManと言うのがあるらしい。
さくらの方はFreeBSDが選べるけど、HDDが少なくてIPv4のみ。DTIの方は10G/100円でHDDが追加できて、IPv6もついてくる。ただし、ドメインをDTIでやっていないと逆引きの設定ができないのと、FreeBSDが選べない。
とりあえずDTIの方は最低契約期間の縛りがなくて、最大2ヶ月無料なので、一度どんなもんか見てみても良いかも知れない。
Subject: SMART error (CurrentPendingSector) detected on host: sv.wizard-limit.net This email was generated by the smartd daemon running on: host name: sv.wizard-limit.net DNS domain: wizard-limit.net NIS domain: The following warning/error was logged by the smartd daemon: Device: /dev/ad4, 1 Currently unreadable (pending) sectors For details see host's SYSLOG (default: /var/log/messages). You can also use the smartctl utility for further investigation. No additional email messages about this problem will be sent.何事かと思って /var/log/messagesを見ると、
Aug 1 08:21:28 sv smartd[1729]: Device: /dev/ad4, 1 Currently unreadable (pending) sectors Aug 1 08:51:28 sv smartd[1729]: Device: /dev/ad4, 1 Currently unreadable (pending) sectors Aug 1 09:21:28 sv smartd[1729]: Device: /dev/ad4, 1 Currently unreadable (pending) sectors Aug 1 09:51:28 sv smartd[1729]: Device: /dev/ad4, 1 Currently unreadable (pending) sectors Aug 1 10:21:28 sv smartd[1729]: Device: /dev/ad4, 1 Currently unreadable (pending) sectors Aug 1 10:51:28 sv smartd[1729]: Device: /dev/ad4, 1 Currently unreadable (pending) sectors Aug 1 11:21:28 sv smartd[1729]: Device: /dev/ad4, 1 Currently unreadable (pending) sectors Aug 1 11:51:28 sv smartd[1729]: Device: /dev/ad4, 1 Currently unreadable (pending) sectorsと30分毎にエラーが出ている。エラーメッセージでぐぐると、smartd での sector error 復活作業 | ni kvelとかホームメイト21 - Fedoraの不良セクターの修復と言うページを発見。
# smartctl -t short /dev/ad4 smartctl 5.39 2009-12-09 r2995 [FreeBSD 8.2-STABLE i386] (local build) Copyright (C) 2002-9 by Bruce Allen, 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 Wed Aug 3 04:28:25 2011 Use smartctl -X to abort test. ・・・2分待つ # smartctl -l selftest /dev/ad4 SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Short offline Completed: read failure 20% 20573 424257195ここまでは見つけたサイトと一緒。うちの場合は、424257195にエラーセクタがあると言うことなんだろう。
しかし、その後の
の計算式の意味がわからないのと、なんでddで/dev/zeroを書くと修復になるのかがわからなかった。恐らく、read errorが出るところに書きこむことで、不良セクタとしてマークして代替セクタを割り当ててくれる的な話か?b = (int)((L-S)*512/B) where: b = File System block number B = File system block size in bytes L = LBA of bad sector S = Starting sector of partition as shown by fdisk -lu
とりあえず、FreeBSDの場合は fdisk -luとかでは情報が出ないので、disklabelで見てみる。
# disklabel -A /dev/ad4s1 # /dev/ad4s1: type: ESDI disk: ad4s1 label: flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 255 sectors/cylinder: 16065 cylinders: 60801 sectors/unit: 976773168 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # milliseconds track-to-track seek: 0 # milliseconds drivedata: 0 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 1048576 0 4.2BSD 2048 16384 8 b: 4194304 1048576 swap c: 976768002 0 unused 0 0 # "raw" part, don't edit d: 268435456 5242880 4.2BSD 2048 16384 28552 e: 703089666 273678336 4.2BSD 2048 16384 28552 disklabel: partition c doesn't cover the whole unit! disklabel: An incorrect partition c may cause problems for standard system utilitiesたぶん、上の式に出てくる512と言うのはdisklabel -Aで出てきた bytes/sector なんだろう。そして、B が bsize で16384、Sは/dev/ad4s1cを指定するならば0で良いと思われる。すると、b = (424257195 - 0) * 512 / 16384 = 13258037?
しかし、稼働中のシステムの一部にddで0を書きこむなんて怖くてできないので、代わりのHDDを買ってきてシステムを移行してから試すことにしよう。
ちなみに、前回HDDを交換したのは2009年の3月のようだ。2年半とするとちょっと寿命が短いなあ。
こう言ったメンテナンスとか、毎月の電気代、UPSのバッテリー代などを考えると、自宅サーバを続けるよりもVPSに移行した方が良いんじゃないかと最近考える。
ちょっと調べてみたけど、メジャーなところではさくらのVPSかDTIのServersManと言うのがあるらしい。
さくらの方はFreeBSDが選べるけど、HDDが少なくてIPv4のみ。DTIの方は10G/100円でHDDが追加できて、IPv6もついてくる。ただし、ドメインをDTIでやっていないと逆引きの設定ができないのと、FreeBSDが選べない。
とりあえずDTIの方は最低契約期間の縛りがなくて、最大2ヶ月無料なので、一度どんなもんか見てみても良いかも知れない。