Block Device Quick Start

To use this guide, you must have executed the procedures in the StorageCluster Quick Start guide first. Ensure your Ceph Storage Cluster isin an active + clean state before working with the Ceph BlockDevice.

Note

The Ceph Block Device is also known as RBD or RADOSBlock Device.

Block Device Quick Start - 图1

You may use a virtual machine for your ceph-client node, but do notexecute the following procedures on the same physical node as your CephStorage Cluster nodes (unless you use a VM). See FAQ for details.

Install Ceph

  • Verify that you have an appropriate version of the Linux kernel.See OS Recommendations for details.
  1. lsb_release -a
  2. uname -r
  • On the admin node, use ceph-deploy to install Ceph on yourceph-client node.
  1. ceph-deploy install ceph-client
  • On the admin node, use ceph-deploy to copy the Ceph configuration fileand the ceph.client.admin.keyring to the ceph-client.
  1. ceph-deploy admin ceph-client

The ceph-deploy utility copies the keyring to the /etc/cephdirectory. Ensure that the keyring file has appropriate read permissions(e.g., sudo chmod +r /etc/ceph/ceph.client.admin.keyring).

Create a Block Device Pool

  • On the admin node, use the ceph tool to create a pool(we recommend the name ‘rbd’).

  • On the admin node, use the rbd tool to initialize the pool for use by RBD:

  1. rbd pool init <pool-name>

Configure a Block Device

  • On the ceph-client node, create a block device image.
  1. rbd create foo --size 4096 --image-feature layering [-m {mon-IP}] [-k /path/to/ceph.client.admin.keyring] [-p {pool-name}]
  • On the ceph-client node, map the image to a block device.
  1. sudo rbd map foo --name client.admin [-m {mon-IP}] [-k /path/to/ceph.client.admin.keyring] [-p {pool-name}]
  • Use the block device by creating a file system on the ceph-clientnode.
  1. sudo mkfs.ext4 -m0 /dev/rbd/{pool-name}/foo
  2.  
  3. This may take a few moments.
  • Mount the file system on the ceph-client node.
  1. sudo mkdir /mnt/ceph-block-device
  2. sudo mount /dev/rbd/{pool-name}/foo /mnt/ceph-block-device
  3. cd /mnt/ceph-block-device
  • Optionally configure the block device to be automatically mapped and mountedat boot (and unmounted/unmapped at shutdown) - see the rbdmap manpage.

See block devices for additional details.