背景:
挂盘脚本执行失败,底层系统报错为mount: wrong fs type, bad option, bad superblock on /mnt,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog - try
dmesg | tail or so
下面介绍下排查流程:
出现这种问题应该先尝试从日志入手,输入:
sudo dmesg | tail
[ 994.342353] XFS (dm-4): unknown mount option [nobarrier].
[ 1018.174020] XFS (dm-4): unknown mount option [nobarrier].
[ 1051.207481] XFS (dm-4): unknown mount option [nobarrier].
[ 1107.472248] XFS (dm-4): unknown mount option [nobarrier].
[ 1971.262372] XFS (dm-4): unknown mount option [nobarrier].
[ 2649.732824] XFS (dm-4): unknown mount option [nobarrier].
[ 2675.778700] XFS (dm-4): unknown mount option [nobarrier].
[ 4727.187483] XFS (dm-4): unknown mount option [nobarrier].
[ 4923.508659] XFS (dm-4): Mounting V5 Filesystem
根据网上查询得知xfs: remove deprecated barrier/nobarrier mount options,高版本内核4.15之后,取消了两个相关参数(barrier/nobarrier),将其去掉后挂载正常了。
顺便介绍下:dmesg(display message)命令用于显示开机信息。kernel 会将开机信息存储在 ring buffer 中。若是开机时来不及查看信息,可利用 dmesg 来查看。开机信息亦保存在/var/log/dmesg中。可以使用如‘more’。 ‘tail’, ‘less’或者‘grep’文字处理工具来处理‘dmesg’命令的输出。由于dmesg日志的输出不适合在一页中完全显示,因此使用管道(pipe)将其输出送到more或者less命令单页显示。
下面是正常的挂在流程
1、安装nfs
yum install nfs-utils
2、运行fdisk -l命令查看实例上的数据盘,发现/dev/vdc未被使用
Disk /dev/sdc: 480.1 GB, 480070426624 bytes, 937637552 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk label type: gpt
Disk identifier: FC80C5AD-AC49-40AA-B40F-0345F13302E8
# Start End Size Type Name
1 2048 4196351 2G EFI System EFI System Partition
2 4196352 8390655 2G Microsoft basic
3 8390656 218105855 100G Microsoft basic
4 218105856 937635839 343.1G Microsoft basic
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
3、创建ext4文件系统
[root@localhost ~]# mkfs -t ext4 /dev/vdb1
4、运行mount /dev/vdb1 /mnt命令挂载文件系统
[root@localhost ~]# mount /dev/vdb1 /mnt
5、添加完成后,执行mount -a 即可生效