Mounting a RBD on a client machine

From T2B Wiki
Jump to navigation Jump to search

This page describes one the very basic way to use a Ceph storage: you create a RBD pool in which you can create images, and these images can then be mounted on a client machine.

Creation of RBD pool

# ceph osd pool create test1
# ceph osd pool application enable test1 rbd

Creation of a user with rights on the pool

# ceph auth add client.toto mon 'profile rbd' osd 'profile rbd pool=test1' mgr 'profile rbd'

Configuration of the client machine

  • add the repo Ceph Octopus x86_64
  • install the package ceph-common
  • create files /etc/ceph/ceph.conf and /etc/ceph/ceph.keyring

You'll need to issue the following commands on the cephadm machine to get the content of these files:

# ceph config generate-minimal-conf
# ceph auth get client.toto

Mount the block device on the client

  • create an image:
# rbd -n client.toto -p test1 create foo --size 1024 --image-feature layering
  • map the image on a local device:
# rbd -n client.toto map foo  -p test1

As a result of the previous command, you've got the name of the device.

  • format the device:
# mkfs.ext4 -m0 /dev/rbd/test1/foo
  • mount the device:
# mkdir /mnt/cephmount
# mount /dev/rbd/test1/foo /mnt/ceph