2011-08-19 23:43:21 +00:00
|
|
|
===============================================
|
|
|
|
rbd -- manage rados block device (RBD) images
|
|
|
|
===============================================
|
|
|
|
|
|
|
|
.. program:: rbd
|
|
|
|
|
|
|
|
Synopsis
|
|
|
|
========
|
|
|
|
|
2011-09-09 23:21:52 +00:00
|
|
|
| **rbd** [ -c *ceph.conf* ] [ -m *monaddr* ] [ -p | --pool *pool* ] [
|
|
|
|
--size *size* ] [ --order *bits* ] [ *command* ... ]
|
|
|
|
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
Description
|
|
|
|
===========
|
|
|
|
|
|
|
|
**rbd** is a utility for manipulating rados block device (RBD) images,
|
|
|
|
used by the Linux rbd driver and the rbd storage driver for Qemu/KVM.
|
|
|
|
RBD images are simple block devices that are striped over objects and
|
|
|
|
stored in a RADOS object store. The size of the objects the image is
|
|
|
|
striped over must be a power of two.
|
|
|
|
|
|
|
|
|
|
|
|
Options
|
|
|
|
=======
|
|
|
|
|
|
|
|
.. option:: -c ceph.conf, --conf ceph.conf
|
|
|
|
|
|
|
|
Use ceph.conf configuration file instead of the default /etc/ceph/ceph.conf to
|
|
|
|
determine monitor addresses during startup.
|
|
|
|
|
|
|
|
.. option:: -m monaddress[:port]
|
|
|
|
|
|
|
|
Connect to specified monitor (instead of looking through ceph.conf).
|
|
|
|
|
|
|
|
.. option:: -p pool, --pool pool
|
|
|
|
|
|
|
|
Interact with the given pool. Required by most commands.
|
|
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
==========
|
|
|
|
|
2012-08-29 17:58:30 +00:00
|
|
|
.. option:: --format format
|
|
|
|
|
|
|
|
Specifies which object layout to use. The default is 1.
|
|
|
|
|
|
|
|
* format 1 - Use the original format for a new rbd image. This format is
|
|
|
|
understood by all versions of librbd and the kernel rbd module, but
|
|
|
|
does not support newer features like cloning.
|
|
|
|
|
|
|
|
* format 2 - Use the second rbd format, which is supported by
|
|
|
|
librbd (but not the kernel rbd module) at this time. This adds
|
|
|
|
support for cloning and is more easily extensible to allow more
|
|
|
|
features in the future.
|
|
|
|
|
2011-08-19 23:43:21 +00:00
|
|
|
.. option:: --size size-in-mb
|
|
|
|
|
|
|
|
Specifies the size (in megabytes) of the new rbd image.
|
|
|
|
|
|
|
|
.. option:: --order bits
|
|
|
|
|
|
|
|
Specifies the object size expressed as a number of bits, such that
|
|
|
|
the object size is ``1 << order``. The default is 22 (4 MB).
|
|
|
|
|
|
|
|
.. option:: --snap snap
|
|
|
|
|
|
|
|
Specifies the snapshot name for the specific operation.
|
|
|
|
|
2012-08-17 00:09:42 +00:00
|
|
|
.. option:: --id username
|
2011-08-19 23:43:21 +00:00
|
|
|
|
2012-08-30 00:30:17 +00:00
|
|
|
Specifies the username (without the ``client.`` prefix) to use with the map command.
|
2011-08-19 23:43:21 +00:00
|
|
|
|
2012-08-17 00:09:42 +00:00
|
|
|
.. option:: --keyfile filename
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
Specifies a file containing the secret to use with the map command.
|
2012-08-30 00:30:17 +00:00
|
|
|
If not specified, ``client.admin`` will be used by default.
|
2012-08-17 00:09:42 +00:00
|
|
|
|
|
|
|
.. option:: --keyring filename
|
|
|
|
|
|
|
|
Specifies a keyring file containing a secret for the specified user
|
|
|
|
to use with the map command. If not specified, the default keyring
|
|
|
|
locations will be searched.
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
Commands
|
|
|
|
========
|
|
|
|
|
2011-09-09 20:41:32 +00:00
|
|
|
.. TODO rst "option" directive seems to require --foo style options, parsing breaks on subcommands.. the args show up as bold too
|
2011-08-19 23:43:21 +00:00
|
|
|
|
2011-09-09 20:40:42 +00:00
|
|
|
:command:`ls` [*pool-name*]
|
2011-08-19 23:43:21 +00:00
|
|
|
Will list all rbd images listed in the rbd_directory object.
|
|
|
|
|
|
|
|
:command:`info` [*image-name*]
|
|
|
|
Will dump information (such as size and order) about a specific rbd image.
|
2012-08-21 01:00:46 +00:00
|
|
|
If image is a clone, information about its parent is also displayed.
|
2012-08-30 00:30:17 +00:00
|
|
|
If a snapshot is specified, whether it is protected is shown as well.
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
:command:`create` [*image-name*]
|
|
|
|
Will create a new rbd image. You must also specify the size via --size.
|
|
|
|
|
2012-07-10 20:09:14 +00:00
|
|
|
:command:`clone` [*parent-snapname*] [*image-name*]
|
|
|
|
Will create a clone (copy-on-write child) of the parent snapshot.
|
2012-08-30 00:30:17 +00:00
|
|
|
Object order will be identical to that of the parent image unless
|
|
|
|
specified. Size will be the same as the parent snapshot.
|
|
|
|
|
2012-08-21 01:00:46 +00:00
|
|
|
The parent snapshot must be protected (see `rbd snap protect`).
|
2012-08-30 00:30:17 +00:00
|
|
|
This requires format 2.
|
2012-08-21 01:00:46 +00:00
|
|
|
|
|
|
|
:command:`flatten` [*image-name*]
|
|
|
|
If image is a clone, copy all shared blocks from the parent snapshot and
|
|
|
|
make the child independent of the parent, severing the link between
|
|
|
|
parent snap and child. The parent snapshot can be unprotected and
|
|
|
|
deleted if it has no further dependent clones.
|
2012-07-10 20:09:14 +00:00
|
|
|
|
2012-08-30 00:30:17 +00:00
|
|
|
This requires format 2.
|
|
|
|
|
2012-08-21 23:07:25 +00:00
|
|
|
:command:`children` [*image-name*]
|
|
|
|
List the clones of the image at the given snapshot. This checks
|
|
|
|
every pool, and outputs the resulting poolname/imagename.
|
|
|
|
|
2012-08-30 00:30:17 +00:00
|
|
|
This requires format 2.
|
|
|
|
|
2011-08-19 23:43:21 +00:00
|
|
|
:command:`resize` [*image-name*]
|
|
|
|
Resizes rbd image. The size parameter also needs to be specified.
|
|
|
|
|
|
|
|
:command:`rm` [*image-name*]
|
2012-01-05 01:07:07 +00:00
|
|
|
Deletes an rbd image (including all data blocks). If the image has
|
|
|
|
snapshots, this fails and nothing is deleted.
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
:command:`export` [*image-name*] [*dest-path*]
|
|
|
|
Exports image to dest path.
|
|
|
|
|
|
|
|
:command:`import` [*path*] [*dest-image*]
|
|
|
|
Creates a new image and imports its data from path.
|
|
|
|
|
|
|
|
:command:`cp` [*src-image*] [*dest-image*]
|
|
|
|
Copies the content of a src-image into the newly created dest-image.
|
2012-08-30 00:30:17 +00:00
|
|
|
dest-image will have the same size, order, and format as src-image.
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
:command:`mv` [*src-image*] [*dest-image*]
|
2012-05-02 18:46:32 +00:00
|
|
|
Renames an image. Note: rename across pools is not supported.
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
:command:`snap` ls [*image-name*]
|
|
|
|
Dumps the list of snapshots inside a specific image.
|
|
|
|
|
|
|
|
:command:`snap` create [*image-name*]
|
|
|
|
Creates a new snapshot. Requires the snapshot name parameter specified.
|
|
|
|
|
|
|
|
:command:`snap` rollback [*image-name*]
|
|
|
|
Rollback image content to snapshot. This will iterate through the entire blocks
|
|
|
|
array and update the data head content to the snapshotted version.
|
|
|
|
|
|
|
|
:command:`snap` rm [*image-name*]
|
|
|
|
Removes the specified snapshot.
|
|
|
|
|
2012-01-05 01:07:07 +00:00
|
|
|
:command:`snap` purge [*image-name*]
|
|
|
|
Removes all snapshots from an image.
|
|
|
|
|
2012-08-21 01:00:46 +00:00
|
|
|
:command:`snap` protect [*image-name*]
|
|
|
|
Protect a snapshot from deletion, so that clones can be made of it
|
|
|
|
(see `rbd clone`). Snapshots must be protected before clones are made;
|
|
|
|
protection implies that there exist dependent cloned children that
|
2012-08-30 00:30:17 +00:00
|
|
|
refer to this snapshot. `rbd clone` will fail on a nonprotected
|
|
|
|
snapshot.
|
|
|
|
|
|
|
|
This requires format 2.
|
2012-08-21 01:00:46 +00:00
|
|
|
|
|
|
|
:command:`snap` unprotect [*image-name*]
|
|
|
|
Unprotect a snapshot from deletion (undo `snap protect`). If cloned
|
|
|
|
children remain, `snap unprotect` fails. (Note that clones may exist
|
|
|
|
in different pools than the parent snapshot.)
|
|
|
|
|
2012-08-30 00:30:17 +00:00
|
|
|
This requires format 2.
|
|
|
|
|
2011-08-19 23:43:21 +00:00
|
|
|
:command:`map` [*image-name*]
|
|
|
|
Maps the specified image to a block device via the rbd kernel module.
|
|
|
|
|
|
|
|
:command:`unmap` [*device-path*]
|
|
|
|
Unmaps the block device that was mapped via the rbd kernel module.
|
|
|
|
|
2011-11-07 17:27:55 +00:00
|
|
|
:command:`showmapped`
|
|
|
|
Show the rbd images that are mapped via the rbd kernel module.
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
Image name
|
|
|
|
==========
|
|
|
|
|
|
|
|
In addition to using the --pool and the --snap options, the image name can include both
|
|
|
|
the pool name and the snapshot name. The image name format is as follows::
|
|
|
|
|
|
|
|
[pool/]image-name[@snap]
|
|
|
|
|
|
|
|
Thus an image name that contains a slash character ('/') requires specifying the pool
|
|
|
|
name explicitly.
|
|
|
|
|
|
|
|
|
|
|
|
Examples
|
|
|
|
========
|
|
|
|
|
|
|
|
To create a new rbd image that is 100 GB::
|
|
|
|
|
|
|
|
rbd -p mypool create myimage --size 102400
|
|
|
|
|
|
|
|
or alternatively::
|
|
|
|
|
|
|
|
rbd create mypool/myimage --size 102400
|
|
|
|
|
|
|
|
To use a non-default object size (8 MB)::
|
|
|
|
|
|
|
|
rbd create mypool/myimage --size 102400 --order 23
|
|
|
|
|
|
|
|
To delete an rbd image (be careful!)::
|
|
|
|
|
|
|
|
rbd rm mypool/myimage
|
|
|
|
|
|
|
|
To create a new snapshot::
|
|
|
|
|
2012-02-17 20:15:15 +00:00
|
|
|
rbd snap create mypool/myimage@mysnap
|
|
|
|
|
2012-08-30 00:30:17 +00:00
|
|
|
To create a copy-on-write clone of a protected snapshot::
|
|
|
|
|
|
|
|
rbd clone mypool/myimage@mysnap otherpool/cloneimage
|
2012-07-10 20:09:14 +00:00
|
|
|
|
2012-08-30 00:30:17 +00:00
|
|
|
To see which clones of a snapshot exist::
|
|
|
|
|
|
|
|
rbd children mypool/myimage@mysnap
|
2012-07-10 20:09:14 +00:00
|
|
|
|
2012-02-17 20:15:15 +00:00
|
|
|
To delete a snapshot::
|
|
|
|
|
|
|
|
rbd snap rm mypool/myimage@mysnap
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
To map an image via the kernel with cephx enabled::
|
|
|
|
|
2012-08-30 00:30:17 +00:00
|
|
|
rbd map mypool/myimage --id admin --keyfile secretfile
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
To unmap an image::
|
|
|
|
|
|
|
|
rbd unmap /dev/rbd0
|
|
|
|
|
2012-08-30 00:30:17 +00:00
|
|
|
To create an image and a clone from it::
|
|
|
|
|
|
|
|
rbd import --format 2 image mypool/parent
|
|
|
|
rbd snap create --snap snapname mypool/parent
|
|
|
|
rbd snap protect mypool/parent@snap
|
|
|
|
rbd clone mypool/parent@snap otherpool/child
|
|
|
|
|
|
|
|
To change an image from one format to another, export it and then
|
|
|
|
import it as the desired format::
|
|
|
|
|
|
|
|
rbd export mypool/myimage@snap /tmp/img
|
|
|
|
rbd import --format 2 /tmp/img mypool/myimage2
|
|
|
|
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
Availability
|
|
|
|
============
|
|
|
|
|
|
|
|
**rbd** is part of the Ceph distributed file system. Please refer to
|
2012-06-16 21:50:29 +00:00
|
|
|
the Ceph documentation at http://ceph.com/docs for more information.
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
========
|
|
|
|
|
2011-09-09 23:21:52 +00:00
|
|
|
:doc:`ceph <ceph>`\(8),
|
|
|
|
:doc:`rados <rados>`\(8)
|