How to mount ceph-fuse automatically with fstab

automountcentos6cephfstab

# 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.

Manually mounting from the command line is working fine:

# 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

But I want to do it automatically on startup. Google pointed me to this page.

/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

So I tried to add the following to /etc/fstab:

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

but mount -a give me:

# mount -a
unrecognized command

because as far as I understand, actually, the above entry will be run as below:

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

Did I do something wrong?

Best Answer

I think the correct syntax should be:

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

then it will be run as:

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

Verify mount point is up and running:

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

Reference: http://tracker.ceph.com/issues/3229