1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

EBSをxfsでフォーマットしてEC2にマウントしようとしてmount: wrong fs type, bad option, bad superblock on~~~エラーが出たときの対処

1
Last updated at Posted at 2019-08-15

EBSマウント時のエラー

EC2に追加でEBSをアタッチして、$ mkfs -t xfs /dev/xvdg でフォーマットしてマウントしたかった。

そもそもamazonlinuxにxfsがなかったのでyum install xfsprogsでインストール。

xfsのバージョンはこれ。

$ yum list installed | grep xfs
xfsprogs.x86_64                      4.5.0-18.23.amzn1             @amzn-updates

改めてフォーマットしてマウントしようとしたら、

$ mount /dev/xvdg /data
mount: wrong fs type, bad option, bad superblock on /dev/xvdg,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

と出た。

原因

xfsにはxfsv4とかxfsv5とかバージョンがあるらしく、自分の環境だと $ mkfs -t xfs /dev/xvdgとやるとxfsv5になるようで、amazon linuxのkernelがxfsv5に対応していないと上記のエラーが出るとのことだった。 1

対処

unameコマンドでkernelのバージョンがわかるので、まずはこれを確認。

3系だったら、mkfsコマンドに -m crc=0を付ける。
これでxfsv4でフォーマットされる。

$ uname -r
3.14.48-33.39.amzn1.x86_64
$ mkfs -t xfs -m crc=0 /dev/xvdg

4系だったら、mkfsコマンドに -m crc=1を付ける。(もしくはmオプションを付けない)
これでxfsv5でフォーマットされる。

$ uname -r
4.14.67-66.56.amzn1.x86_64
$ mkfs -t xfs -m crc=1 /dev/xvdg

あとはマウントする。

※3系だったら4系だったらといってますが、厳密にどこからxfsv5に対応してるかは未確認。少なくとも上記2例のバージョンではそれぞれ未対応/対応でした。

おわりに

LVMでやれば必要ないとかなんとか。
mkfsよりそっちのほうがいいんですかね?
ていうかそんな古いカーネルのままにしておくなよって感じですかね?

  1. https://nekomatu.blogspot.com/2016/06/ubuntu-trusty-xfsv5.html

1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?