In this post, we describe how to mount a subdirectory of CephFS on a machine running CentOS 7, particularly how to mount a subdirectory of our Luminous Ceph filesystem on the 4-GPU workstation Hydra. For demonstration purpose, we’ll restrict Hydra to mounting only the hydra directory of the CephFS, omitting the root directory. When you are given access to the CephFS, you’ll have your own Ceph Client username, which may be different from your UNIX username. In order to mount your own directory of the CephFS on your own machine, you should replace all occurrence of hydra in the commands below with your own Ceph Client username.
Save user hydra’s key to a file ceph.client.hydra.keyring, in the keyring format:
Verify user hydra’s capabilities:
Make a directory hydra on the CephFS:
Restrict CephFS Client Capabilities
Let’s try to restrict Ceph Client hydra’s capabilities to only able to mount and work within the directory /hydra of the Ceph filesystem, following instructions in the official Ceph documentation:
Arghhh!! As it turns out, the capacities specified by ceph auth and those by ceph fs authorize must exactly match!
Let’s modify Ceph Client hydra’s capabilities and try again:
and it works!
Similarly, we’ve added a Ceph Client hb, for mounting the CephFS on the hummingbird cluster:
Install ceph-fuse on CentOS 7 Client
We will not use the kernel CephFS driver, but ceph-fuse, to mount CephFS on Hydra. Although the EPEL repo provide a ceph-fuse package, it is very outdated:
Ceph v0.80 is codenamed Emperor, which was released in November 2013! So we won’t use ceph-fuse from the EPEL repo.
3) Another option to automate mounting of the subdirectory /hydra of the CephFS is to use systemd. To take this route, we first need to modify the unit file /usr/lib/systemd/system/ceph-fuse@.service:
Note that we’ve add the flags -n client.hydra -r /hydra to ceph-fuse in the ExecStart line of the unit file.
Reload systemd manager configuration (because we’ve made changes to the unit file for ceph-fuse@.service):
Start the ceph-fuse service to mount the subdirectory /hydra of the CephFS, at the mountpoint /mnt/pulpos:
To create a persistent mount point:
NOTE here the command must be systemctl enable ceph-fuse@-mnt-pulpos. If we run systemctl enable ceph-fuse@/mnt/pulpos instead, we’ll get an error “Failed to execute operation: Unit name pulpos is not valid.” However, when starting the service, we can run either systemctl start ceph-fuse@/mnt/pulpos or systemctl start ceph-fuse@-mnt-pulpos!
Lastly, we note the same bug in current version of Luminous (v12.2.1): when CephFS is mounted using ceph-fuse, the mount point doesn’t show up in the output of df; and although we can list the mount point specifically with df -h /mnt/pulpos, the size of the filesystem is reported as 0!