久しぶりにxfsを壊した。
DRBDを入れている環境で、ちょっと無茶な検証テストをしたら、HeartbeatでPrimaryに昇格(切り替わり)できなくなって、ちょっと調べてみたらマウントできなくなっていた。久しぶりにやったのでメモ。
# mount /dev/drbd0 /data mount: 構造体を内容消去する必要があります
こんな感じで。壊れた・・・。
mount: Structure needs cleaning
英語だと、こんな感じのメッセージじゃろ。
# xfs_check /dev/drbd0 ERROR: The filesystem has valuable metadata changes in a log which needs to be replayed. Mount the filesystem to replay the log, and unmount it before re-running xfs_check. If you are unable to mount the filesystem, then use the xfs_repair -L option to destroy the log and attempt a repair. Note that destroying the log may cause corruption -- please attempt a mount of the filesystem before doing this.
お約束のチェック。で、エラー。アンマウントしろとのことだが、そもそもマウントはできていないので、その場合は "xfs_repair -L" を実行せよと言っている。ただしデータが破損してしまうかもしれない可能性があると警告で出ているので、必要に応じてバックアップしておいた方が良いと思う。(ddとかで)
今回は検証環境だったので、遠慮なくリペアしてみる。
# xfs_repair -L /dev/drbd0
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
ALERT: The filesystem has valuable metadata changes in a log which is being
destroyed because the -L option was used.
- scan filesystem freespace and inode maps...
sb_ifree 61, counted 59
sb_fdblocks 156227448, counted 156227447
- found root inode chunk
Phase 3 - for each AG...
- scan and clear agi unlinked lists...
- process known inodes and perform inode discovery...
- agno = 0
- agno = 1
- agno = 2
- agno = 3
- agno = 4
- agno = 5
- agno = 6
- agno = 7
- agno = 8
- agno = 9
- agno = 10
- agno = 11
- agno = 12
- agno = 13
- agno = 14
- agno = 15
- agno = 16
- agno = 17
- agno = 18
- agno = 19
- agno = 20
- agno = 21
- agno = 22
- agno = 23
- agno = 24
- agno = 25
- agno = 26
- agno = 27
- agno = 28
- agno = 29
- agno = 30
- agno = 31
- process newly discovered inodes...
Phase 4 - check for duplicate blocks...
- setting up duplicate extent list...
- check for inodes claiming duplicate blocks...
- agno = 0
- agno = 3
- agno = 9
- agno = 10
- agno = 11
- agno = 12
- agno = 15
- agno = 16
- agno = 17
- agno = 18
- agno = 19
- agno = 22
- agno = 1
- agno = 4
- agno = 21
- agno = 5
- agno = 7
- agno = 6
- agno = 2
- agno = 8
- agno = 14
- agno = 27
- agno = 28
- agno = 29
- agno = 30
- agno = 31
- agno = 26
- agno = 20
- agno = 23
- agno = 24
- agno = 13
- agno = 25
Phase 5 - rebuild AG headers and trees...
- reset superblock...
Phase 6 - check inode connectivity...
- resetting contents of realtime bitmap and summary inodes
- traversing filesystem ...
- traversal finished ...
- moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done無事終了。
# mount /dev/drbd0 /data #
からの無事マウントできた。中を見る限り、データの異常は確認できなかった。
めでたしめでたし。=͟͟͞͞(๑•̀=͟͟͞͞(๑•̀д•́=͟͟͞͞(๑•̀д•́๑)=͟͟͞͞(๑•̀д•́

Linuxサーバ Hacks 2 ―コネクティング、モニタリング、トラブルシューティング
- 作者: Bill von Hagen,Brian K. Jones,菅野良二
- 出版社/メーカー: オライリー・ジャパン
- 発売日: 2006/10/24
- メディア: 単行本(ソフトカバー)
- 購入: 3人 クリック: 26回
- この商品を含むブログ (31件) を見る