2012-05-31 22:35:33 +00:00
==============================
RBD Kernel Object Operations
==============================
2012-06-19 17:10:51 +00:00
.. important :: To use kernel object operations, you must have a running Ceph cluster.
2012-07-02 15:35:10 +00:00
Load the Ceph RBD Module
2012-09-18 20:00:07 +00:00
========================
2012-07-02 15:35:10 +00:00
To map an RBD image to a kernel object, first load the Ceph RBD module::
2012-05-31 22:35:33 +00:00
modprobe rbd
2012-07-03 15:46:14 +00:00
Get a List of RBD Images
2012-09-18 20:00:07 +00:00
========================
2012-07-03 15:46:14 +00:00
To mount an RBD image, first return a list of the images. ::
rbd list
2012-09-18 20:00:07 +00:00
Map a Block Device
==================
2012-07-02 15:35:10 +00:00
Use `` rbd `` to map an image name to a kernel object. You must specify the
image name, the pool name, and the client name. If you use `` cephx ``
authentication, you must also specify a secret. ::
2012-08-17 00:10:46 +00:00
sudo rbd map {image-name} --pool {pool-name} --name {client-name}
2012-07-02 15:35:10 +00:00
For example::
2012-08-17 00:10:46 +00:00
sudo rbd map foo --pool rbd myimage --name client.admin
2012-07-02 15:35:10 +00:00
2012-08-17 00:10:46 +00:00
If you use `` cephx `` authentication, you must also specify a secret. It may come from a keyring, a file containing the secret, or be specified explicitly on the command line. ::
2012-07-02 15:35:10 +00:00
2012-08-17 00:10:46 +00:00
sudo rbd map foo --pool rbd myimage --name client.foo --keyring /path/to/keyring
sudo rbd map foo --pool rbd myimage --name client.foo --keyfile /path/to/file
2012-07-02 15:35:10 +00:00
2012-05-31 22:35:33 +00:00
2012-07-03 15:46:14 +00:00
Show Mapped Block Devices
2012-09-18 20:00:07 +00:00
=========================
2012-07-02 15:35:10 +00:00
2012-07-03 15:46:14 +00:00
To show RBD images mapped to kernel block devices with the `` rbd `` command,
specify the `` showmapped `` option. ::
sudo rbd showmapped
2012-07-02 15:35:10 +00:00
2012-05-31 22:35:33 +00:00
2012-07-02 15:35:10 +00:00
Unmapping a Block Device
2012-09-18 20:00:07 +00:00
========================
2012-05-31 22:35:33 +00:00
2012-07-02 15:35:10 +00:00
To unmap an RBD image with the `` rbd `` command, specify the `` rm `` option
and the device name (i.e., by convention the same as the RBD image name). ::
2012-07-02 15:55:36 +00:00
sudo rbd unmap /dev/rbd/{poolname}/{imagename}
2012-07-02 15:35:10 +00:00
For example::
2012-05-31 22:35:33 +00:00
2012-07-02 15:55:36 +00:00
sudo rbd unmap /dev/rbd/rbd/foo