2013-06-14 23:56:58 +00:00
|
|
|
|
=======================
|
|
|
|
|
Block Device Commands
|
|
|
|
|
=======================
|
|
|
|
|
|
|
|
|
|
.. index:: Ceph Block Device; image management
|
2012-09-18 18:41:32 +00:00
|
|
|
|
|
2012-05-31 22:35:33 +00:00
|
|
|
|
The ``rbd`` command enables you to create, list, introspect and remove block
|
|
|
|
|
device images. You can also use it to clone images, create snapshots,
|
|
|
|
|
rollback an image to a snapshot, view a snapshot, etc. For details on using
|
|
|
|
|
the ``rbd`` command, see `RBD – Manage RADOS Block Device (RBD) Images`_ for
|
|
|
|
|
details.
|
|
|
|
|
|
2013-06-14 23:56:58 +00:00
|
|
|
|
.. important:: To use Ceph Block Device commands, you must have access to
|
|
|
|
|
a running Ceph cluster.
|
|
|
|
|
|
2012-05-31 22:35:33 +00:00
|
|
|
|
|
|
|
|
|
Creating a Block Device Image
|
2012-09-18 18:41:32 +00:00
|
|
|
|
=============================
|
|
|
|
|
|
2013-06-14 23:56:58 +00:00
|
|
|
|
Before you can add a block device to a node, you must create an image for it in
|
|
|
|
|
the :term:`Ceph Storage Cluster` first. To create a block device image, execute
|
|
|
|
|
the following::
|
2012-05-31 22:35:33 +00:00
|
|
|
|
|
2013-01-28 18:13:56 +00:00
|
|
|
|
rbd create {image-name} --size {megabytes} --pool {pool-name}
|
2012-05-31 22:35:33 +00:00
|
|
|
|
|
|
|
|
|
For example, to create a 1GB image named ``foo`` that stores information in a
|
|
|
|
|
pool named ``swimmingpool``, execute the following::
|
|
|
|
|
|
|
|
|
|
rbd create foo --size 1024
|
2013-01-28 18:13:56 +00:00
|
|
|
|
rbd create bar --size 1024 --pool swimmingpool
|
2012-05-31 22:35:33 +00:00
|
|
|
|
|
|
|
|
|
.. note:: You must create a pool first before you can specify it as a
|
|
|
|
|
source. See `Storage Pools`_ for details.
|
|
|
|
|
|
|
|
|
|
Listing Block Device Images
|
2012-09-18 18:41:32 +00:00
|
|
|
|
===========================
|
|
|
|
|
|
2013-06-14 23:56:58 +00:00
|
|
|
|
To list block devices in the ``rbd`` pool, execute the following
|
|
|
|
|
(i.e., ``rbd`` is the default pool name)::
|
2012-05-31 22:35:33 +00:00
|
|
|
|
|
|
|
|
|
rbd ls
|
|
|
|
|
|
|
|
|
|
To list block devices in a particular pool, execute the following,
|
|
|
|
|
but replace ``{poolname}`` with the name of the pool::
|
|
|
|
|
|
|
|
|
|
rbd ls {poolname}
|
|
|
|
|
|
|
|
|
|
For example::
|
|
|
|
|
|
|
|
|
|
rbd ls swimmingpool
|
|
|
|
|
|
|
|
|
|
Retrieving Image Information
|
2012-09-18 18:41:32 +00:00
|
|
|
|
============================
|
|
|
|
|
|
2012-05-31 22:35:33 +00:00
|
|
|
|
To retrieve information from a particular image, execute the following,
|
|
|
|
|
but replace ``{image-name}`` with the name for the image::
|
|
|
|
|
|
|
|
|
|
rbd --image {image-name} info
|
|
|
|
|
|
|
|
|
|
For example::
|
|
|
|
|
|
|
|
|
|
rbd --image foo info
|
|
|
|
|
|
|
|
|
|
To retrieve information from an image within a pool, execute the following,
|
|
|
|
|
but replace ``{image-name}`` with the name of the image and replace ``{pool-name}``
|
|
|
|
|
with the name of the pool::
|
|
|
|
|
|
|
|
|
|
rbd --image {image-name} -p {pool-name} info
|
|
|
|
|
|
|
|
|
|
For example::
|
|
|
|
|
|
|
|
|
|
rbd --image bar -p swimmingpool info
|
|
|
|
|
|
|
|
|
|
Resizing a Block Device Image
|
2012-09-18 18:41:32 +00:00
|
|
|
|
=============================
|
|
|
|
|
|
2013-06-14 23:56:58 +00:00
|
|
|
|
:term:`Ceph Block Device` images are thin provisioned. They don't actually use
|
|
|
|
|
any physical storage until you begin saving data to them. However, they do have
|
|
|
|
|
a maximum capacity that you set with the ``--size`` option. If you want to
|
|
|
|
|
increase (or decrease) the maximum size of a Ceph Block Device image, execute
|
|
|
|
|
the following::
|
2012-05-31 22:35:33 +00:00
|
|
|
|
|
|
|
|
|
rbd resize --image foo --size 2048
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Removing a Block Device Image
|
2012-09-18 18:41:32 +00:00
|
|
|
|
=============================
|
|
|
|
|
|
2012-05-31 22:35:33 +00:00
|
|
|
|
To remove a block device, execute the following, but replace ``{image-name}``
|
|
|
|
|
with the name of the image you want to remove::
|
|
|
|
|
|
|
|
|
|
rbd rm {image-name}
|
|
|
|
|
|
|
|
|
|
For example::
|
|
|
|
|
|
|
|
|
|
rbd rm foo
|
|
|
|
|
|
|
|
|
|
To remove a block device from a pool, execute the following, but replace
|
|
|
|
|
``{image-name}`` with the name of the image to remove and replace
|
|
|
|
|
``{pool-name}`` with the name of the pool::
|
|
|
|
|
|
|
|
|
|
rbd rm {image-name} -p {pool-name}
|
|
|
|
|
|
|
|
|
|
For example::
|
|
|
|
|
|
|
|
|
|
rbd rm bar -p swimmingpool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-03 20:22:37 +00:00
|
|
|
|
.. _Storage Pools: ../../rados/operations/pools
|
2013-01-28 18:13:56 +00:00
|
|
|
|
.. _RBD – Manage RADOS Block Device (RBD) Images: ../../man/8/rbd/
|