ファイルサーバHDD障害対応2

syslogが見られないことにはどうにもならないので正常にマウントできているHDDに移動させてみます。

移動させたときの投稿を見ながら思い出してみます。
省エネファイルサーバ構築 33 CentOS 5.6 ログ出力先をHDDに移動

今残っているログのコピー

# cp -rp /var/storage/00/main/var.log /var/storage/00/mirror/
cp: reading `/var/storage/00/main/var.log/messages.1': 入力/出力エラーです
cp: reading `/var/storage/00/main/var.log/cron.2': 入力/出力エラーです

なんかエラー。
でもどうでもいいログなので無視します。

今のシンボリックリンクを削除して

# rm /var/log
rm: remove シンボリックリンク `/var/log'? y

リンクをはりなおします

# ln -s /var/storage/00/mirror/var.log /var/log

では再起動してみます

#reboot

でsyslogを見てみるとこんなものが

Dec 11 19:50:53 localhost kernel: EXT3-fs warning (device sdb1): ext3_clear_journal_err: Filesystem error recorded from previous mount: IO failure
Dec 11 19:50:53 localhost kernel: EXT3-fs warning (device sdb1): ext3_clear_journal_err: Marking fs in need of filesystem check.
Dec 11 19:50:53 localhost kernel: EXT3-fs warning: mounting fs with errors, running e2fsck is recommended
Dec 11 19:50:53 localhost kernel: EXT3 FS on sdb1, internal journal
Dec 11 19:50:53 localhost kernel: EXT3-fs: recovery complete.
Dec 11 19:50:53 localhost kernel: EXT3-fs: mounted filesystem with ordered data mode.
Dec 11 19:50:53 localhost kernel: kjournald starting. Commit interval 5 seconds
Dec 11 19:50:53 localhost kernel: EXT3-fs warning: checktime reached, running e2fsck is recommended
Dec 11 19:50:53 localhost kernel: ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
Dec 11 19:50:53 localhost kernel: ata1.00: BMDMA stat 0x64
Dec 11 19:50:53 localhost kernel: ata1.00: cmd 25/00:08:47:00:cc/00:00:77:00:00/e0 tag 0 dma 4096 in
Dec 11 19:50:53 localhost kernel: res 51/40:00:48:00:cc/40:00:77:00:00/e0 Emask 0x9 (media error)
Dec 11 19:50:53 localhost kernel: ata1.00: status: { DRDY ERR }
Dec 11 19:50:53 localhost kernel: ata1.00: error: { UNC }
Dec 11 19:50:53 localhost kernel: ata1.00: configured for UDMA/133
Dec 11 19:50:53 localhost kernel: ata1: EH complete
Dec 11 19:50:53 localhost kernel: ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
Dec 11 19:50:53 localhost kernel: ata1.00: BMDMA stat 0x64
Dec 11 19:50:53 localhost kernel: ata1.00: cmd 25/00:08:47:00:cc/00:00:77:00:00/e0 tag 0 dma 4096 in
Dec 11 19:50:53 localhost kernel: res 51/40:00:48:00:cc/40:00:77:00:00/e0 Emask 0x9 (media error)
Dec 11 19:50:53 localhost kernel: ata1.00: status: { DRDY ERR }
Dec 11 19:50:53 localhost kernel: ata1.00: error: { UNC }
Dec 11 19:50:53 localhost kernel: ata1.00: configured for UDMA/133
Dec 11 19:50:53 localhost kernel: ata1: EH complete
Dec 11 19:50:53 localhost kernel: ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
Dec 11 19:50:53 localhost kernel: ata1.00: BMDMA stat 0x64
Dec 11 19:50:53 localhost kernel: ata1.00: cmd 25/00:08:47:00:cc/00:00:77:00:00/e0 tag 0 dma 4096 in
Dec 11 19:50:53 localhost kernel: res 51/40:00:48:00:cc/40:00:77:00:00/e0 Emask 0x9 (media error)
Dec 11 19:50:53 localhost kernel: ata1.00: status: { DRDY ERR }
Dec 11 19:50:53 localhost kernel: ata1.00: error: { UNC }
Dec 11 19:50:53 localhost kernel: ata1.00: configured for UDMA/133
Dec 11 19:50:53 localhost kernel: ata1: EH complete
Dec 11 19:50:53 localhost kernel: ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
Dec 11 19:50:53 localhost kernel: ata1.00: BMDMA stat 0x64
Dec 11 19:50:53 localhost kernel: ata1.00: cmd 25/00:08:47:00:cc/00:00:77:00:00/e0 tag 0 dma 4096 in
Dec 11 19:50:53 localhost kernel: res 51/40:00:48:00:cc/40:00:77:00:00/e0 Emask 0x9 (media error)
Dec 11 19:50:53 localhost kernel: ata1.00: status: { DRDY ERR }
Dec 11 19:50:53 localhost kernel: ata1.00: error: { UNC }
Dec 11 19:50:53 localhost kernel: ata1.00: configured for UDMA/133
Dec 11 19:50:53 localhost kernel: ata1: EH complete
Dec 11 19:50:53 localhost kernel: ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
Dec 11 19:50:53 localhost kernel: ata1.00: BMDMA stat 0x64
Dec 11 19:50:53 localhost kernel: ata1.00: cmd 25/00:08:47:00:cc/00:00:77:00:00/e0 tag 0 dma 4096 in
Dec 11 19:50:53 localhost kernel: res 51/40:00:48:00:cc/40:00:77:00:00/e0 Emask 0x9 (media error)
Dec 11 19:50:53 localhost kernel: ata1.00: status: { DRDY ERR }
Dec 11 19:50:53 localhost kernel: ata1.00: error: { UNC }
Dec 11 19:50:53 localhost kernel: ata1.00: configured for UDMA/133
Dec 11 19:50:53 localhost kernel: ata1: EH complete
Dec 11 19:50:53 localhost kernel: ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
Dec 11 19:50:53 localhost kernel: ata1.00: BMDMA stat 0x64
Dec 11 19:50:53 localhost kernel: ata1.00: cmd 25/00:08:47:00:cc/00:00:77:00:00/e0 tag 0 dma 4096 in
Dec 11 19:50:53 localhost kernel: res 51/40:00:48:00:cc/40:00:77:00:00/e0 Emask 0x9 (media error)
Dec 11 19:50:53 localhost kernel: ata1.00: status: { DRDY ERR }
Dec 11 19:50:53 localhost kernel: ata1.00: error: { UNC }
Dec 11 19:50:53 localhost kernel: ata1.00: configured for UDMA/133
Dec 11 19:50:53 localhost kernel: sd 1:0:0:0: SCSI error: return code = 0x08000002
Dec 11 19:50:53 localhost kernel: sdb: Current [descriptor]: sense key: Medium Error
Dec 11 19:50:53 localhost kernel: Add. Sense: Unrecovered read error - auto reallocate failed
Dec 11 19:50:53 localhost kernel:
Dec 11 19:50:53 localhost kernel: Descriptor sense data with sense descriptors (in hex):
Dec 11 19:50:53 localhost kernel: 72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
Dec 11 19:50:53 localhost kernel: 77 cc 00 48
Dec 11 19:50:53 localhost kernel: end_request: I/O error, dev sdb, sector 2009858120
Dec 11 19:50:53 localhost kernel: EXT3-fs error (device sdb1): read_inode_bitmap: <6>ata1: EH complete
Dec 11 19:50:53 localhost kernel: Cannot read inode bitmap - block_group = 7667, inode_bitmap = 251232257
Dec 11 19:50:53 localhost kernel: Aborting journal on device sdb1.
Dec 11 19:50:53 localhost kernel: SCSI device sdb: 2930277168 512-byte hdwr sectors (1500302 MB)
Dec 11 19:50:53 localhost kernel: sdb: Write Protect is off
Dec 11 19:50:53 localhost kernel: SCSI device sdb: drive cache: write back
Dec 11 19:50:53 localhost kernel: SCSI device sdb: 2930277168 512-byte hdwr sectors (1500302 MB)
Dec 11 19:50:53 localhost kernel: sdb: Write Protect is off
Dec 11 19:50:53 localhost kernel: SCSI device sdb: drive cache: write back
Dec 11 19:50:53 localhost kernel: EXT3-fs error (device sdb1) in ext3_delete_inode: IO failure
Dec 11 19:50:53 localhost kernel: __journal_remove_journal_head: freeing b_committed_data
Dec 11 19:50:53 localhost kernel: ext3_abort called.
Dec 11 19:50:53 localhost kernel: EXT3-fs error (device sdb1): ext3_journal_start_sb: Detected aborted journal
Dec 11 19:50:53 localhost kernel: Remounting filesystem read-only
Dec 11 19:50:53 localhost kernel: Adding 522104k swap on /dev/sda2. Priority:-1 extents:1 across:522104k

sdbでエラーがでまくってます。

しょうがないのでfsckしてみます。
ところでfsckとe2fsckってどっち使えばいいの??とおもってググってみたらどっち実行しても結果は同じでした。

fsckとe2fsckの違いって? | OpenGroove

ファイルシステムの種別に応じて実行すべきfsckプログラムが選択され、ext2/ext3であればe2fsckが実行され、ReiserFSであれば reiserfsckが実行される・・・とのこと。

では実行します。

# fsck -n /dev/sdb1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
Warning! /dev/sdb1 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
1500GB_main contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Error reading block 251232259 (Attempt to read block from filesystem resulted in short read) while doing inode scan. Ignore error? no

Error while scanning inodes (125616128): Can't read next inode
e2fsck: aborted

iノードが読み取れないとか言ってます。
物理的な故障ではなさそうなので修復してみることにします。

その前にtmpディレクトリも移動させます。

こっちの投稿に書いてあります。
省エネファイルサーバ構築 34 CentOS 5.6 /tmpディレクトリなどをHDDに移動

# ls -la /var/storage/00/main/tmp/var.tmp/
合計 8
drwxr-xr-x 2 root root 4096 11月 12 10:49 .
drwxr-xr-x 4 root root 4096 8月 17 01:52 ..

こっちは空なのでリンク作り直せばOKです。

削除して

# rm /var/tmp
rm: remove シンボリックリンク `/var/tmp'? y

作り直します

# ln -s /var/storage/00/mirror/tmp/var.tmp /var/tmp

確認します

# cd /var/tmp
-bash: cd: /var/tmp: そのようなファイルやディレクトリはありません

ディレクトリがない!
mirrorの方につくってなかったからですね。

# mkdir -p /var/storage/00/mirror/tmp/var.tmp
# mkdir -p /var/storage/00/mirror/tmp/tmp

作り終わったら確認。

# cd tmp
# ls -la
合計 8
drwxr-xr-x 2 root root 4096 12月 12 04:39 .
drwxr-xr-x 3 root root 4096 12月 12 04:39 ..

権限を777に変更します。

# chmod 777 .
# ls -la
合計 8
drwxrwxrwx 2 root root 4096 12月 12 04:39 .
drwxr-xr-x 3 root root 4096 12月 12 04:39 ..

これでOK。
/tmpも同様に。

# ls -la /tmp/
合計 20
drwxr-xr-x 3 root root 4096 12月 11 19:50 .
drwxr-xr-x 4 root root 4096 8月 17 01:52 ..
drwxrwxrwt 2 root root 4096 8月 16 06:55 .ICE-unix
drwxr-xr-x 2 root root 4096 11月 12 10:32 .webmin

こっちはなにかいます。
コピーしておきましょう。

# cp -r /var/storage/00/main/tmp/tmp /var/storage/00/mirror/tmp/
# ls -la /var/storage/00/mirror/tmp/tmp/
合計 16
drwxr-xr-x 4 root root 4096 12月 11 19:50 .
drwxr-xr-x 4 root root 4096 12月 12 04:44 ..
drwxrwxrwt 2 root root 4096 8月 16 06:55 .ICE-unix
drwxr-xr-x 2 root root 4096 11月 12 10:32 .webmin

ではリンクはりなおします

# rm /tmp
rm: remove シンボリックリンク `/tmp'? y
# ln -s /var/storage/00/mirror/tmp/tmp /tmp
# ls -la /tmp/
合計 16
drwxr-xr-x 4 root root 4096 12月 11 19:50 .
drwxr-xr-x 4 root root 4096 12月 12 04:44 ..
drwxrwxrwt 2 root root 4096 8月 16 06:55 .ICE-unix
drwxr-xr-x 2 root root 4096 11月 12 10:32 .webmin
# cd /tmp
# chmod 777 .
# ls -la
合計 16
drwxrwxrwx 4 root root 4096 12月 11 19:50 .
drwxr-xr-x 4 root root 4096 12月 12 04:44 ..
drwxrwxrwt 2 root root 4096 8月 16 06:55 .ICE-unix
drwxr-xr-x 2 root root 4096 11月 12 10:32 .webmin

これでOK。

いったん再起動してからファイルの差分をとってみます。

# reboot

再起動完了。
一応Windowsからsambaサーバにアクセスできるようになりました。
書き忘れてましたが、一度再起動した後はwindowsからアクセスできなくなっていたのでした。

ミラーリングの状況をみるために修復前に差分をとってみます。

# cd /tmp
# ls -laRrt /var/storage/00/main/ > main.txt
# ls -laRrt /var/storage/00/mirror/ > mirror.txt

# ls -laR /var/storage/00/main/ > main.txt
# ls -laR /var/storage/00/mirror/ > mirror.txt
※rtをつけるとファイル名で並ばなくなって不便になるのでこっちでやったほうがいいです(2012/01/31追記)

diffだと見づらいのでwindows上でwinmergeで比較します。

比較前にディレクトリの比較は不要なので削除します。

  • ^d.*\n - ディレクトリ行にマッチする(リスト表示の中)
  • ^合計.*\n - ディレクトリ内のサイズ表示行にマッチする

さらにパスがmainとmirrorで違って全部引っかかるので/mirror/→/main/に置換します。

保存して比較してみます。
すると差分全くなし!!!
完全に一致!!

ミラーリングは完璧っぽいのでfsckで修復してみます。

そのまえにアンマウントを。

# umount /dev/sdb1
umount: /var/storage/00/main: デバイスを使用中です
umount: /var/storage/00/main: デバイスを使用中です

使用中です。sambaを止めましょう。

# service smb stop
SMB サービスを停止中: [ OK ]
NMB サービスを停止中: [ OK ]
# umount /dev/sdb1

アンマウントできたのでいよいよ開始です。

# fsck -fy /dev/sdb1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Error reading block 251232259 (Attempt to read block from filesystem resulted in short read) while doing inode scan. Ignore error? yes
Force rewrite? yes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Error reading block 251232257 (Attempt to read block from filesystem resulted in short read) while reading inode and block bitmaps. Ignore error? yes
Force rewrite? yes
Inode bitmap differences: +125616129 +(125616131--125616134)
Fix? yes

1500GB_main: ***** FILE SYSTEM WAS MODIFIED *****
1500GB_main: 262643/183156736 files (5.2% non-contiguous), 281634400/366284000 blocks

終わったので再度確認

# fsck -n /dev/sdb1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
1500GB_main: clean, 262643/183156736 files, 281634400/366284000 blocks

うまくいってるのかどうかさっぱりわかりませんが時間がないのでファイルを確認したりマウントしたりするのは次回。

コメント