AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 506587
Accepted
quanta
quanta
Asked: 2013-05-10 22:14:56 +0800 CST2013-05-10 22:14:56 +0800 CST 2013-05-10 22:14:56 +0800 CST

如何使用 fstab 自动挂载 ceph-fuse?

  • 772
# 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

我做错什么了吗?

centos6
  • 3 3 个回答
  • 4054 Views

3 个回答

  • Voted
  1. quanta
    2013-05-10T22:14:56+08:002013-05-10T22:14:56+08:00

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

    /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
    

    验证挂载点已启动并正在运行:

    # 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

    • 0
  2. Best Answer
    quanta
    2013-05-12T23:08:01+08:002013-05-12T23:08:01+08:00

    哦,看来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可以指定为文件系统类型:

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

    更新 2013 年 5 月 12 日星期日 13:43:09 ICT

    我想我找到了这个问题的根本原因。

    从挂载手册页:

    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,它将使用通常的参数运行,并且如果您从 EPEL 存储库/sbin/mount.fuse.ceph安装,则此帮助程序不存在: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和目标是/usr/sbin/mount.fuse.ceph:

    ln -s /usr/sbin/mount.fuse.ceph /sbin/mount.fuse.ceph
    
    • 0
  3. Onlyjob
    2014-01-13T00:51:53+08:002014-01-13T00:51:53+08:00

    在Debian上,以下内容适用于 ceph-fuse_0.72.2-1:

    /等/fstab:

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

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve