如何使用fstab自动安装ceph-fuse?

# ceph -v ceph version 0.56.3 (6eb7e15a4783b122e9b0c85ea9ba064145958aa5) # repoquery -i ceph Name : ceph Version : 0.56.3 Release : 1.el6 Architecture: x86_64 Size : 26734691 Packager : Fedora Project Group : System Environment/Base URL : http://ceph.com/ Repository : epel Summary : User space components of the Ceph file system Source : ceph-0.56.3-1.el6.src.rpm Description : Ceph is a distributed network file system designed to provide excellent performance, reliability, and scalability. 

从命令行手工安装工作正常:

 # ceph-fuse /mnt/ceph/ ceph-fuse[28617]: starting ceph client ceph-fuse[28617]: starting fuse # df -h Filesystem Size Used Avail Use% Mounted on ceph-fuse 72T 2.9T 70T 4% /mnt/ceph 

但我想在启动时自动执行。 谷歌指向我这个页面。

/usr/sbin/mount.fuse.ceph

 #!/bin/sh # # Helper to mount ceph-fuse from /etc/fstab. To use, add an entry # like: # # # DEVICE PATH TYPE OPTIONS # id=admin /mnt/ceph fuse.ceph defaults 0 0 # id=myuser,conf=/etc/ceph/foo.conf /mnt/ceph2 fuse.ceph defaults 0 0 # # where the device field is a comma-separated list of options to pass on # the command line. The examples above, for example, specify that # ceph-fuse will authenticated as client.admin and client.myuser # (respectively), and the second example also sets the 'conf' option to # '/etc/ceph/foo.conf' via the ceph-fuse command line. Any valid # ceph-fuse can be passed in this way. set -e # convert device string to options cephargs='--'`echo $1 | sed 's/,/ --/g'` # strip out 'noauto' option; libfuse doesn't like it opts=`echo $4 | sed 's/,noauto//' | sed 's/noauto,//'` # go exec ceph-fuse $cephargs $2 $3 $opts 

所以我试图把以下内容添加到/etc/fstab

 id=admin,conf=/etc/ceph/ceph.conf /mnt/ceph fuse.ceph defaults 0 0 

但是mount -a给我:

 # mount -a unrecognized command 

因为据我所知,实际上,上面的条目将按如下方式运行:

 # mount -t fuse.ceph id=admin,conf=/etc/ceph/ceph.conf /mnt/ceph/ unrecognized command 

我做错什么了吗?

我认为正确的语法应该是:

 /usr/sbin/mount.fuse.ceph# /mnt/ceph fuse defaults 0 0 

那么它将运行为:

 # mount -t fuse /usr/sbin/mount.fuse.ceph# /mnt/ceph/ ceph-fuse[14811]: starting ceph client ceph-fuse[14811]: starting fuse 

validation安装点已启动并正在运行:

 # df /mnt/ceph/ Filesystem 1K-blocks Used Available Use% Mounted on ceph-fuse 77189145600 3011411968 74177733632 4% /mnt/ceph 

参考: http : //tracker.ceph.com/issues/3229

哦,从EPEL回购版和官方回购回购版看来有些不同:

 # ceph -v ceph version 0.56.6 (95a0bda7f007a33b0dc7adf4b330778fa1e5d70c) # rpmquery -i ceph Name : ceph Relocations: (not relocatable) Version : 0.56.6 Vendor: (none) Release : 0.el6 Build Date: Sat 04 May 2013 09:29:00 AM ICT Install Date: Fri 10 May 2013 11:39:11 AM ICT Build Host: gitbuilder-centos6-amd64.front.sepia.ceph.com Group : System Environment/Base Source RPM: ceph-0.56.6-0.el6.src.rpm Size : 27854806 License: GPL-2.0 Signature : RSA/SHA1, Sat 04 May 2013 07:25:37 AM ICT, Key ID 7ebfdd5d17ed316d URL : http://ceph.com/ Summary : User space components of the Ceph file system Description : Ceph is a distributed network file system designed to provide excellent performance, reliability, and scalability. 

/etc/fstab

 conf=/etc/ceph/ceph.conf /mnt/ceph fuse.ceph defaults 0 0 

并且fuse.ceph可以被指定为文件系统types:

 # mount -t fuse.ceph conf=/etc/ceph/ceph.conf /mnt/ceph/ ceph-fuse[17665]: starting ceph client ceph-fuse[17665]: starting fuse 

更新太阳5月12日13:43:09 ICT 2013

我想我find了这个问题的根源。

从安装手册页 :

 NOTES The syntax of external mount helpers is: /sbin/mount.<suffix> spec dir [-sfnv] [-o options] [-t type.subtype] where the <type> is filesystem type and -sfnvo options have same meaning like standard mount options. The -t option is used for filesystems with subtypes support (for example /sbin/mount.fuse -t fuse.sshfs). 

因此,如果将type设置为fuse.ceph ,它将使用通常的参数运行/sbin/mount.fuse.ceph ,如果您从EPEL repo安装fuse.ceph ,则该辅助程序不存在:

 # rpm -ql ceph-fuse /usr/bin/ceph-fuse /usr/sbin/mount.fuse.ceph /usr/share/doc/ceph-fuse-0.56.3 /usr/share/doc/ceph-fuse-0.56.3/COPYING /usr/share/man/man8/ceph-fuse.8.gz 

这就是您unrecognized command错误的原因。

快速修复是使用名称/sbin/mount.fuse.ceph创build符号链接,目标是/usr/sbin/mount.fuse.ceph

 ln -s /usr/sbin/mount.fuse.ceph /sbin/mount.fuse.ceph 

在Debian上 ,以下与ceph-fuse_0.72.2-1一起工作:

/ etc / fstab

 mount.fuse.ceph#conf=/etc/ceph/ceph.conf,id=admin /mnt/ceph fuse noatime,allow_other 0 0