例子
1 2 3
| modprobe rbd echo "192.168.1.234 name=admin,secret=AQAHzRBX77ORERAAqfW0YAqq8+ETXMqWtPKwkQ== rbd testrbd" > /sys/bus/rbd/add echo 1 > /sys/bus/rbd/remove
|
如果你在执行echo
时候提示参数错误,请现查看modinfo rbd
看看里面的single_major
默认值是否为false
eg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| $ modinfo rbd filename: /lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/block/rbd.ko.xz license: GPL description: RADOS Block Device (RBD) driver author: Jeff Garzik <jeff@garzik.org> author: Yehuda Sadeh <yehuda@hq.newdream.net> author: Sage Weil <sage@newdream.net> author: Alex Elder <elder@inktank.com> rhelversion: 7.4 srcversion: B41E51769EC95E3DBDB16AB depends: libceph intree: Y vermagic: 3.10.0-693.el7.x86_64 SMP mod_unload modversions signer: CentOS Linux kernel signing key sig_key: DA:18:7D:CA:7D:BE:53:AB:05:BD:13:BD:0C:4E:21:F4:22:B6:A4:9C sig_hashalgo: sha256 parm: single_major:Use a single major number for all rbd devices (default: false) (bool)
|
如果single_major
默认值为ture
,那么在加载rbd模块时,需要将single_major
设置成false
eg:
1
| modprobe rbd single_major=0
|
然后在重新执行echo
。
解释
- 192.168.1.234 为 Monitor 地址
- name,制定使用的用户,可通过“ceph auth list” 查看
- secret,name制定用户所对应的 key 值
- rbd,制定需要映射的块设备(该快设备必须是已经创建好的)
- 使用客户端内核必须支持rbd.ko这个内核模块
- 1, 设备ID,用于去映射
参考&鸣谢