Did you know  45Drives offers free  public and private  webinars ? Click here to learn more  & register! Build & Price

KB450228 – Mounting CephFS

You are here:

Scope/Description

  • This guide will show you how to mount the CephFS filesystem on a Linux client using a kernel driver mount and secret file.

Prerequisites

Steps

Ceph-Common Package Installation

  • The only package required on the client is ceph-common package and its dependencies.
  • First, we’ll have to enable the Ceph repositories on our client machines.

CentOS 7

root@centos7-45drives:~# cat <<EOF >> /etc/yum.repos.d/ceph_stable.repo 
[ceph_stable] 
baseurl=http://download.ceph.com/rpm-octopus/el7/\$basearch 
gpgcheck=1 
gpgkey=https://download.ceph.com/keys/release.asc 
name=Ceph Stable \$basearch repo 
priority=2
[ceph_stable_noarch]
baseurl=http://download.ceph.com/rpm-octopus/el7/noarch
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc
name=Ceph Stable noarch repo
priority=2
EOF
  • Now we can install the ceph-common package.
root@centos7-45drives:~# yum install ceph-common

Ubuntu 20.04

  • Get the release key
root@ubuntu-45drives:~# wget -q -O- 'https://download.ceph.com/keys/release.asc' | sudo apt-key add -
  • Add the ceph repository
root@ubuntu-45drives:~# apt-add-repository 'deb https://download.ceph.com/debian-octopus/ focal main'
  • Update the system to get the new repo.
root@ubuntu-45drives:~# apt update 
if the update fails try the flag "--allow-unverified"
root@ubuntu-45drives:~# apt upgrade
  • Now we can install the ceph-common package.
root@ubuntu-45drives:~# apt install ceph-common

Rocky8

root@centos7-45drives:~# cat <<EOF >> /etc/yum.repos.d/ceph_stable.repo 
[ceph_stable] 
baseurl=http://download.ceph.com/rpm-octopus/el8/\$basearch 
gpgcheck=1 
gpgkey=https://download.ceph.com/keys/release.asc 
name=Ceph Stable \$basearch repo 
priority=2
[ceph_stable_noarch]
baseurl=http://download.ceph.com/rpm-octopus/el8/noarch
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc
name=Ceph Stable noarch repo
priority=2
EOF
  • Now we can install the ceph-common package.
root@centos8-45drives:~# dnf install ceph-common

Creating CephFS mount point on client

  • First, create a directory to mount CephFS.
root@client-45drives:~# mkdir /mnt/mycephfsmount

Mounting CephFS on client

Below is an example using the admin keyring. It is recommended to use a keyring created that will only grant CephFS access. The admin keyring will give the client full administrative access into the cluster.
  • First we need to make and copy the admin.secret file to use for authentication on the client. on a ceph monitor run the following
root@ceph:~# cd /etc/ceph 
root@ceph:~# ceph auth get-key client.admin > admin.secret
root@ceph:~# scp admin.secret user@(clientip):/etc/ceph/
  • Next, we mount the filesystem to that directory using the following command.
root@client-45drives:~# mount -t ceph {ip-address-of-ceph-monitor}:/ /mnt/mycephfsmount -o name=admin,secretfile=/etc/ceph/admin.secret

  • For example, if our Ceph Monitors were 10.0.0.1, 10.0.0.2, and 10.0.0.3, we would mount CephFS similar to the following.
root@client-45drives:~# mount -t ceph 10.0.0.1,10.0.0.2,10.0.0.3:/ /mnt/mycephfsmount -o name=admin,secretfile=/etc/ceph/admin.secret

Configuring CephFS in /etc/fstab

  • Next, we’ll have to configure our CephFS mount to automatically remount on reboot by editing the /etc/fstab file.
root@client-45drives:~# vim /etc/fstab
  • We can add the following to our fstab file to ensure it will remount on reboot.
CEPH-MON-IP(s):/     /mnt/mycephfsmount   ceph    name=admin,secretfile=/etc/ceph/admin.secret	noatime,_netdev 0 0
10.0.0.1,10.0.0.2,10.0.0.3:/ /mnt/mycephfsmount ceph name=admin,secretfile=/etc/ceph/admin.secret,noatime,_netdev 0 0

Verification

  • If we run df -h we should now see CephFS mounted and the available storage for the mount.
root@client-45drives:~# df -h

Further Reading

Was this article helpful?
Dislike 0
Views: 5943
Unboxing Racking Storage Drives Cable Setup Power UPS Sizing Remote Access