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.
Use ceph.conf configuration file instead of the default /etc/ceph/ceph.conf to determine monitor addresses during startup.
Connect to specified monitor (instead of looking through ceph.conf).
Interact with the given pool. Required by most commands.
Do not output progress information (goes to standard error by default for some commands).
Specifies which object layout to use. The default is 1.
Specifies the size (in megabytes) of the new rbd image.
Specifies the object size expressed as a number of bits, such that the object size is 1 << order. The default is 22 (4 MB).
Specifies the stripe unit size in bytes. See striping section (below) for more details.
Specifies the number of objects to stripe over before looping back to the first object. See striping section (below) for more details.
Specifies the snapshot name for the specific operation.
Specifies the username (without the client. prefix) to use with the map command.
Specifies a file containing the secret to use with the map command. If not specified, client.admin will be used by default.
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.
Option for lock add that allows multiple clients to lock the same image if they use the same tag. The tag is an arbitrary string. This is useful for situations where an image must be open from more than one client at once, like during live migration of a virtual machine, or for use underneath a clustered filesystem.
Specifies output formatting (default: plain, json, xml)
Make json or xml formatted output more human-readable.
Specifies which options to use when mapping an image. map-options is a comma-separated string of options (similar to mount(8) mount options). See map options section below for more details.
Map the image read-only. Equivalent to -o ro.
Will create a clone (copy-on-write child) of the parent snapshot. Object order will be identical to that of the parent image unless specified. Size will be the same as the parent snapshot.
The parent snapshot must be protected (see rbd snap protect). This requires image format 2.
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.
This requires image format 2.
List the clones of the image at the given snapshot. This checks every pool, and outputs the resulting poolname/imagename.
This requires image format 2.
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 refer to this snapshot. rbd clone will fail on a nonprotected snapshot.
This requires image format 2.
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.)
This requires image format 2.
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.
RBD images are striped over many objects, which are then stored by the Ceph distributed object store (RADOS). As a result, read and write requests for the image are distributed across many nodes in the cluster, generally preventing any single node from becoming a bottleneck when individual images get large or busy.
The striping is controlled by three parameters:
By default, [stripe_unit] is the same as the object size and [stripe_count] is 1. Specifying a different [stripe_unit] requires that the STRIPINGV2 feature be supported (added in Ceph v0.53) and format 2 images be used.
Most of these options are useful mainly for debugging and benchmarking. The default values are set in the kernel and may therefore depend on the version of the running kernel.
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:
rbd snap create mypool/myimage@mysnap
To create a copy-on-write clone of a protected snapshot:
rbd clone mypool/myimage@mysnap otherpool/cloneimage
To see which clones of a snapshot exist:
rbd children mypool/myimage@mysnap
To delete a snapshot:
rbd snap rm mypool/myimage@mysnap
To map an image via the kernel with cephx enabled:
rbd map mypool/myimage --id admin --keyfile secretfile
To unmap an image:
rbd unmap /dev/rbd0
To create an image and a clone from it:
rbd import --image-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 create an image with a smaller stripe_unit (to better distribute small writes in some workloads):
rbd -p mypool create myimage --size 102400 --stripe-unit 65536 --stripe-count 16
To change an image from one image format to another, export it and then import it as the desired image format:
rbd export mypool/myimage@snap /tmp/img
rbd import --image-format 2 /tmp/img mypool/myimage2
To lock an image for exclusive use:
rbd lock add mypool/myimage mylockid
To release a lock:
rbd lock remove mypool/myimage mylockid client.2485
rbd is part of the Ceph distributed storage system. Please refer to the Ceph documentation at http://ceph.com/docs for more information.