rbd: image foo: image uses unsupported features: 0x38

来源:互联网 发布:微信打开淘宝客户端 编辑:程序博客网 时间:2024/06/10 20:56
# rbd create foo -s 1024# rbd list

foo
我们在rbd pool中(在上述命令中未指定pool name,默认image建立在rbd pool中)创建一个大小为1024Mi的ceph image foo,rbd list命令的输出告诉我们foo image创建成功。接下来,我们尝试将foo image映射到内核,并格式化该image:

root@ceph-1:~# rbd map foorbd: sysfs write failedRBD image feature set mismatch. You can disable features unsupported by the kernel with "rbd feature disable".In some cases useful info is found in syslog - try "dmesg | tail" or so.rbd: map failed: (6) No such device or address

map操作报错。通过 “dmesg | tail”可以看到如下报错
rbd: image foo: image uses unsupported features: 0x38

ceph新版中在map image时,给image默认加上了许多feature,通过rbd info可以查看到:

# rbd info foo
rbd image 'foo':    size 1024 MB in 256 objects    order 22 (4096 kB objects)    block_name_prefix: rbd_data.10612ae7234b    format: 2    features: layering, exclusive-lock, object-map, fast-diff, deep-flatten    flags:layering: 支持分层striping: 支持条带化 v2exclusive-lock: 支持独占锁object-map: 支持对象映射(依赖 exclusive-lock )fast-diff: 快速计算差异(依赖 object-map )deep-flatten: 支持快照扁平化操作journaling: 支持记录 IO 操作(依赖独占锁)

可以看到foo image拥有: layering, exclusive-lock, object-map, fast-diff, deep-flatten。不过遗憾的是CentOS的3.10内核仅支持其中的layering feature,其他feature概不支持。我们需要手动disable这些features:

# rbd feature disable foo exclusive-lock, object-map, fast-diff, deep-flatten
root@ceph-1:/var/log/ceph# rbd info foorbd image 'foo':    size 1024 MB in 256 objects    order 22 (4096 kB objects)    block_name_prefix: rbd_data.10612ae7234b    format: 2    features: layering    flags:

不过每次这么来disable可是十分麻烦的,一劳永逸的方法是在各个cluster node的/etc/ceph/ceph.conf中加上这样一行配置:

rbd_default_features = 1 #仅是layering对应的bit码所对应的整数值

设置完后,通过下面命令查看配置变化:

# ceph --show-config|grep rbd|grep featuresrbd_default_features = 1

在单个创建rbd的时候我们也可以通过修改format的版本来实现挂载,这里把format指定为1之后其实上面的rbd的很多功能都已经去掉了:

rbd create foo --size 10G --image-format 1 --image-feature  layering

我们再来map一下foo这个image:

# rbd map foo/dev/rbd0# ls -l /dev/rbd0

map后,我们就可以像格式化一个空image那样对其进行格式化了,这里格成ext4文件系统(格式化这一步大可不必,在后续小节中你会看到):

# mkfs.ext4 /dev/rbd0mke2fs 1.42.9 (4-Feb-2014)`这里写代码片`Discarding device blocks: doneFilesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=1024 blocks, Stripe width=1024 blocks65536 inodes, 262144 blocks13107 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=2684354568 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:    32768, 98304, 163840, 229376Allocating group tables: doneWriting inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: done
0 0