LoginSignup
3
1

More than 5 years have passed since last update.

[xfs] ファイルシステムをrepairした後にUUIDが重複してマウントできない

Last updated at Posted at 2018-08-03

構成

  • RAID6構成の"ファイルサーバ"をiSCSIでマウント
  • xfsでフォーマット
  • マウント先のマシンはCentOS6

発生した事件

  • "ファイルサーバ"のHDDのうち1台が故障してRAIDのHealthがDegradedに
  • rebuildする前に最低限のデータを引き出そうとしてもファイルシステムが壊れている
% ls /mnt/"ファイルサーバ"
ls: cannot open directory .: Input/output error

% dmsg | tail
XFS(sdc1): xfs_log_force: error 5 returned.
がたくさんでてくる。

作業ログ

ファイルシステムの(強制)アンマウント

% sudo umount /mnt/"ファイルサーバ"
umount: /mnt/"ファイルサーバ": device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

しょうがないので強制的にアンマウントを実行

% sudo umount -l /mnt/"ファイルサーバ"

ファイルサーバの再起動

% sudo iscsiadm -m node --targetname "ファイルサーバのIQN" --logout
が反応しなかったので"ファイルサーバ"を再起動

再接続
% sudo iscsiadm -m discovery -t sendtargets -p "ファイルサーバのIP"
% sudo iscsiadm -m node --targetname "ファイルサーバのIQN" --login
% sudo iscsiadm -m session -P 3
(省略)
    Attached scsi disk sdd      State: running

/dev/sddとして認識されている。

ファイルシステム修復

% sudo xfs_check /dev/sdd1                                                                                         
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.

% sudo xfs_repair -L /dev/sdd1
(省略)
done.

それでもマウントできない

% sudo mount /dev/sdd1 /mnt/"ファイルサーバ"
mount: wrong fs type, bad option, bad superblock on /dev/sdd1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

% dmseg| tail
XFS (sdc1): xfs_log_force: error 5 returned.
XFS (sdd1): Filesystem has duplicate UUID a8d4d36b-c7ce-41ba-bf1f-f919cd38f253 - can't mount

強制的にアンマウントしたせいでsdc1のerrorが消えていない。そしてUUIDが重複しているのが原因のよう。
再起動したらsdc1は消えてくれそうだが本体は迂闊に停止できない。

UUIDを作り直す

% sudo xfs_admin -U generate /dev/sdd1
Clearing log and setting UUID
writing all SBs
new UUID = bc4e7800-0309-4b7c-91c2-1cd255210ad6

再マウント

今度こそマウントに成功。
データを取り出す。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1