メンテナンス・トラブルシュート - ハードウェア - fsck
1. fsck ハードディスクに不良セクタが発生した等で、マシンが停止することがあります。 そういうときは、「fsck」というコマンドを使用します。 「fsck」は本来、シングルユーザモードで実行するものです。 システムを再起動、または停止から起動するときに この画面で 2
Enter
「fsck」と入力して Enter 「USE JOURNAL? [yn]」と聞かれた時点で n、Enter(今は JOURNAL を使用していないのではないのか?)
異常が発生していない場合はほぼ下のような表示で終了します。
あとは # shudown -r now で再起動して通常の起動をすればマルチユーザでの運用状態に戻ります。 異常が発生していてそれらを修復する場合は、すべて問いかけに y と答えるので「-y」というオプションを使用するのですが・・・。 最初の「USE JOURNAL? [yn]」だけ n と答えるにはどうすりゃいいんだろう? 2. マルチユーザモードで fsck しちゃうと マルチユーザモードで、「fsck」を走らせることも可能ですが、まんま走らせると。 $ fsck ** /dev/ada0s1a (NO WRITE) USE JOURNAL? no ** Skipping journal, falling through to full fsck SETTING DIRTY FLAG IN READ_ONLY MODE UNEXPECTED SOFT UPDATE INCONSISTENCY ** Last Mounted on / ** Root file system ** Phase 1 - Check Blocks and Sizes INCORRECT BLOCK COUNT I=18299674 (40 should be 0) CORRECT? no INCORRECT BLOCK COUNT I=18299679 (8 should be 0) CORRECT? no INCORRECT BLOCK COUNT I=18299680 (40 should be 0) CORRECT? no INCORRECT BLOCK COUNT I=18299683 (8 should be 0) CORRECT? no ** Phase 2 - Check Pathnames UNALLOCATED I=2728718 OWNER=root MODE=100600 SIZE=31759 MTIME=May 7 11:40 2018 FILE=/root/.history UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18218688 OWNER=operator MODE=100400 SIZE=4096 MTIME=May 7 11:44 2018 FILE=/var/db/entropy/saved-entropy.1 UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18299662 OWNER=postgres MODE=100600 SIZE=18595 MTIME=May 7 11:48 2018 FILE=/var/db/postgres/data96/pg_stat_tmp/db_1.stat UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18459003 OWNER=root MODE=100644 SIZE=59887 MTIME=May 7 11:45 2018 FILE=/var/log/webmin/modules/package-updates/current.cache UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18459009 OWNER=root MODE=100644 SIZE=977 MTIME=May 7 11:45 2018 FILE=/var/log/webmin/modules/system-status/info UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18459012 OWNER=root MODE=100644 SIZE=41 MTIME=May 7 11:45 2018 FILE=/var/log/webmin/modules/system-status/history/maxes UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts LINK COUNT FILE I=2728728 OWNER=root MODE=0 SIZE=0 MTIME=May 7 11:41 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18299665 OWNER=postgres MODE=0 SIZE=0 MTIME=May 7 11:48 2018 COUNT 0 SHOULD BE -1 ADJUST? no UNREF FILE I=18299670 OWNER=postgres MODE=100600 SIZE=0 MTIME=May 7 11:41 2018 RECONNECT? no CLEAR? no LINK COUNT FILE I=18299674 OWNER=postgres MODE=0 SIZE=0 MTIME=May 7 11:49 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18299680 OWNER=postgres MODE=0 SIZE=0 MTIME=May 7 11:48 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18299683 OWNER=postgres MODE=0 SIZE=0 MTIME=May 7 11:48 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18459008 OWNER=root MODE=0 SIZE=0 MTIME=May 7 11:46 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18459010 OWNER=root MODE=0 SIZE=0 MTIME=May 7 11:46 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18459011 OWNER=root MODE=0 SIZE=0 MTIME=May 7 11:46 2018 COUNT 0 SHOULD BE -1 ADJUST? no UNREF FILE I=18539139 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no UNREF FILE I=18539142 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no UNREF FILE I=18539143 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no UNREF FILE I=18539146 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no UNREF FILE I=18539147 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no ** Phase 5 - Check Cyl groups FREE BLK COUNT(S) WRONG IN SUPERBLK SALVAGE? no SUMMARY INFORMATION BAD SALVAGE? no BLK(S) MISSING IN BIT MAPS SALVAGE? no 428966 files, 2488797 used, 37117415 free (47295 frags, 4633765 blocks, 0.1% fragmentation) てな感じでやたらめったらエラーみたいな表示になるし、そもそも [yn] の問いかけをきいてこないまま [no] の状態で進んでいってしまいます。 これは、ファイルシステムがマウントされた状態でディスクチェックしているその状態で、「WRITE」が発生しているので、チェックしているそばから書き換えられて、異常と判断されてしまうのです。
# shudown -r now
$ fsck ** /dev/ada0s1a (NO WRITE) USE JOURNAL? no ** Skipping journal, falling through to full fsck SETTING DIRTY FLAG IN READ_ONLY MODE UNEXPECTED SOFT UPDATE INCONSISTENCY ** Last Mounted on / ** Root file system ** Phase 1 - Check Blocks and Sizes INCORRECT BLOCK COUNT I=18299674 (40 should be 0) CORRECT? no INCORRECT BLOCK COUNT I=18299679 (8 should be 0) CORRECT? no INCORRECT BLOCK COUNT I=18299680 (40 should be 0) CORRECT? no INCORRECT BLOCK COUNT I=18299683 (8 should be 0) CORRECT? no ** Phase 2 - Check Pathnames UNALLOCATED I=2728718 OWNER=root MODE=100600 SIZE=31759 MTIME=May 7 11:40 2018 FILE=/root/.history UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18218688 OWNER=operator MODE=100400 SIZE=4096 MTIME=May 7 11:44 2018 FILE=/var/db/entropy/saved-entropy.1 UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18299662 OWNER=postgres MODE=100600 SIZE=18595 MTIME=May 7 11:48 2018 FILE=/var/db/postgres/data96/pg_stat_tmp/db_1.stat UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18459003 OWNER=root MODE=100644 SIZE=59887 MTIME=May 7 11:45 2018 FILE=/var/log/webmin/modules/package-updates/current.cache UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18459009 OWNER=root MODE=100644 SIZE=977 MTIME=May 7 11:45 2018 FILE=/var/log/webmin/modules/system-status/info UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=18459012 OWNER=root MODE=100644 SIZE=41 MTIME=May 7 11:45 2018 FILE=/var/log/webmin/modules/system-status/history/maxes UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts LINK COUNT FILE I=2728728 OWNER=root MODE=0 SIZE=0 MTIME=May 7 11:41 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18299665 OWNER=postgres MODE=0 SIZE=0 MTIME=May 7 11:48 2018 COUNT 0 SHOULD BE -1 ADJUST? no UNREF FILE I=18299670 OWNER=postgres MODE=100600 SIZE=0 MTIME=May 7 11:41 2018 RECONNECT? no CLEAR? no LINK COUNT FILE I=18299674 OWNER=postgres MODE=0 SIZE=0 MTIME=May 7 11:49 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18299680 OWNER=postgres MODE=0 SIZE=0 MTIME=May 7 11:48 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18299683 OWNER=postgres MODE=0 SIZE=0 MTIME=May 7 11:48 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18459008 OWNER=root MODE=0 SIZE=0 MTIME=May 7 11:46 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18459010 OWNER=root MODE=0 SIZE=0 MTIME=May 7 11:46 2018 COUNT 0 SHOULD BE -1 ADJUST? no LINK COUNT FILE I=18459011 OWNER=root MODE=0 SIZE=0 MTIME=May 7 11:46 2018 COUNT 0 SHOULD BE -1 ADJUST? no UNREF FILE I=18539139 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no UNREF FILE I=18539142 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no UNREF FILE I=18539143 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no UNREF FILE I=18539146 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no UNREF FILE I=18539147 OWNER=mysql MODE=100600 SIZE=0 MTIME=May 7 11:36 2018 CLEAR? no ** Phase 5 - Check Cyl groups FREE BLK COUNT(S) WRONG IN SUPERBLK SALVAGE? no SUMMARY INFORMATION BAD SALVAGE? no BLK(S) MISSING IN BIT MAPS SALVAGE? no 428966 files, 2488797 used, 37117415 free (47295 frags, 4633765 blocks, 0.1% fragmentation)