rbd – manage rados block device (RBD) images

Synopsis

rbd [ -c ceph.conf ] [ -m monaddr ] [–cluster cluster-name][ -p | –pool pool ] [ command … ]

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 andstored in a RADOS object store. The size of the objects the image isstriped over must be a power of two.

Options

  • -c ceph.conf, —conf ceph.conf
  • Use ceph.conf configuration file instead of the default /etc/ceph/ceph.conf todetermine monitor addresses during startup.
  • -m monaddress[:port]
  • Connect to specified monitor (instead of looking through ceph.conf).
  • —cluster cluster-name
  • Use different cluster name as compared to default cluster name ceph.
  • -p pool-name, —pool pool-name
  • Interact with the given pool. Required by most commands.
  • —namespace namespace-name
  • Use a pre-defined image namespace within a pool
  • —no-progress
  • Do not output progress information (goes to standard error bydefault for some commands).

Parameters

  • —image-format format-id
  • Specifies which object layout to use. The default is 2.

    • format 1 - (deprecated) Use the original format for a new rbd image. Thisformat 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 sincethe Bobtail release and the kernel rbd module since kernel 3.10 (exceptfor “fancy” striping, which is supported since kernel 4.17). This addssupport for cloning and is more easily extensible to allow morefeatures in the future.

  • -s size-in-M/G/T, —size size-in-M/G/T
  • Specifies the size of the new rbd image or the new size of the existing rbdimage in M/G/T. If no suffix is given, unit M is assumed.
  • —object-size size-in-B/K/M
  • Specifies the object size in B/K/M. Object size will be rounded up thenearest power of two; if no suffix is given, unit B is assumed. The defaultobject size is 4M, smallest is 4K and maximum is 32M.
  • —stripe-unit size-in-B/K/M
  • Specifies the stripe unit size in B/K/M. If no suffix is given, unit B isassumed. See striping section (below) for more details.
  • —stripe-count num
  • Specifies the number of objects to stripe over before looping backto the first object. See striping section (below) for more details.
  • —snap snap
  • Specifies the snapshot name for the specific operation.
  • —id username
  • Specifies the username (without the client. prefix) to use with the map command.
  • —keyring filename
  • Specifies a keyring file containing a secret for the specified userto use with the map command. If not specified, the default keyringlocations will be searched.
  • —keyfile filename
  • Specifies a file containing the secret key of —id user to use with the map command.This option is overridden by —keyring if the latter is also specified.
  • —shared lock-tag
  • Option for lock add that allows multiple clients to lock thesame image if they use the same tag. The tag is an arbitrarystring. This is useful for situations where an image mustbe open from more than one client at once, like duringlive migration of a virtual machine, or for use underneatha clustered file system.
  • —format format
  • Specifies output formatting (default: plain, json, xml)
  • —pretty-format
  • Make json or xml formatted output more human-readable.
  • -o krbd-options, —options krbd-options
  • Specifies which options to use when mapping or unmapping an image via therbd kernel driver. krbd-options is a comma-separated list of options(similar to mount(8) mount options). See kernel rbd (krbd) options sectionbelow for more details.
  • —read-only
  • Map the image read-only. Equivalent to -o ro.
  • —image-feature feature-name
  • Specifies which RBD format 2 feature should be enabled when creatingan image. Multiple features can be enabled by repeating this optionmultiple times. The following features are supported:

    • layering: layering support

    • striping: striping v2 support

    • exclusive-lock: exclusive locking support

    • object-map: object map support (requires exclusive-lock)

    • fast-diff: fast diff calculations (requires object-map)

    • deep-flatten: snapshot flatten support

    • journaling: journaled IO support (requires exclusive-lock)

    • data-pool: erasure coded pool support

  • —image-shared
  • Specifies that the image will be used concurrently by multiple clients.This will disable features that are dependent upon exclusive ownershipof the image.
  • —whole-object
  • Specifies that the diff should be limited to the extents of a full objectinstead of showing intra-object deltas. When the object map feature isenabled on an image, limiting the diff to the object extents willdramatically improve performance since the differences can be computedby examining the in-memory object map instead of querying RADOS for eachobject within the image.
  • —limit
  • Specifies the limit for the number of snapshots permitted.

Commands

  • bench –io-type [–io-size size-in-B/K/M/G/T] [–io-threads num-ios-in-flight] [–io-total size-in-B/K/M/G/T] [–io-pattern seq | rand] [–rw-mix-read read proportion in readwrite] image-spec
  • Generate a series of IOs to the image and measure the IO throughput andlatency. If no suffix is given, unit B is assumed for both –io-size and–io-total. Defaults are: –io-size 4096, –io-threads 16, –io-total 1G,–io-pattern seq, –rw-mix-read 50.

  • childrensnap-spec

  • List the clones of the image at the given snapshot. This checksevery pool, and outputs the resulting poolname/imagename.

This requires image format 2.

  • clone [–object-size size-in-B/K/M] [–stripe-unit size-in-B/K/M –stripe-count num] [–image-feature feature-name] [–image-shared] parent-snap-spec__child-image-spec
  • Will create a clone (copy-on-write child) of the parent snapshot.Object size will be identical to that of the parent image unlessspecified. Size will be the same as the parent snapshot. The –stripe-unitand –stripe-count arguments are optional, but must be used together.

The parent snapshot must be protected (see rbd snap protect).This requires image format 2.

  • config global getconfig-entity__key
  • Get a global-level configuration override.

  • config global list [–format plain | json | xml] [–pretty-format] config-entity

  • List global-level configuration overrides.

  • config global setconfig-entitykeyvalue

  • Set a global-level configuration override.

  • config global removeconfig-entity__key

  • Remove a global-level configuration override.

  • config image getimage-spec__key

  • Get an image-level configuration override.

  • config image list [–format plain | json | xml] [–pretty-format] image-spec

  • List image-level configuration overrides.

  • config image setimage-speckeyvalue

  • Set an image-level configuration override.

  • config image removeimage-spec__key

  • Remove an image-level configuration override.

  • config pool getpool-name__key

  • Get a pool-level configuration override.

  • config pool list [–format plain | json | xml] [–pretty-format] pool-name

  • List pool-level configuration overrides.

  • config pool setpool-namekeyvalue

  • Set a pool-level configuration override.

  • config pool removepool-name__key

  • Remove a pool-level configuration override.

  • cp (src-image-spec | src-snap-spec) dest-image-spec

  • Copy the content of a src-image into the newly created dest-image.dest-image will have the same size, object size, and image format as src-image.

  • create (-s | –size size-in-M/G/T) [–image-format format-id] [–object-size size-in-B/K/M] [–stripe-unit size-in-B/K/M –stripe-count num] [–thick-provision] [–no-progress] [–image-feature feature-name]… [–image-shared] image-spec

  • Will create a new rbd image. You must also specify the size via –size. The–stripe-unit and –stripe-count arguments are optional, but must be used together.If the –thick-provision is enabled, it will fully allocate storage forthe image at creation time. It will take a long time to do.Note: thick provisioning requires zeroing the contents of the entire image.

  • deep cp (src-image-spec | src-snap-spec) dest-image-spec

  • Deep copy the content of a src-image into the newly created dest-image.Dest-image will have the same size, object size, image format, and snapshots as src-image.

  • device list [-t | –device-type device-type] [–format plain | json | xml] –pretty-format

  • Show the rbd images that are mapped via the rbd kernel module(default) or other supported device.

  • device map [-t | –device-type device-type] [–read-only] [–exclusive] [-o | –options device-options] image-spec | snap-spec

  • Map the specified image to a block device via the rbd kernel module(default) or other supported device (nbd on Linux or ggate onFreeBSD).

The –options argument is a comma separated list of device typespecific options (opt1,opt2=val,…).

  • device unmap [-t | –device-type device-type] [-o | –options device-options] image-spec | snap-spec | device-path
  • Unmap the block device that was mapped via the rbd kernel module(default) or other supported device.

The –options argument is a comma separated list of device typespecific options (opt1,opt2=val,…).

  • diff [–from-snap snap-name] [–whole-object] image-spec | snap-spec
  • Dump a list of byte extents in the image that have changed since the specified startsnapshot, or since the image was created. Each output line includes the starting offset(in bytes), the length of the region (in bytes), and either ‘zero’ or ‘data’ to indicatewhether the region is known to be zeros or may contain other data.

  • du [-p | –pool pool-name] [image-spec | snap-spec] [–merge-snapshots]

  • Will calculate the provisioned and actual disk usage of all images andassociated snapshots within the specified pool. It can also be used againstindividual images and snapshots.

If the RBD fast-diff feature is not enabled on images, this operation willrequire querying the OSDs for every potential object within the image.

The –merge-snapshots will merge snapshots used space into their parent images.

  • export [–export-format format (1 or 2)] (image-spec | snap-spec) [dest-path]
  • Export image to dest path (use - for stdout).The –export-format accepts ‘1’ or ‘2’ currently. Format 2 allow us to export not only the contentof image, but also the snapshots and other properties, such as image_order, features.

  • export-diff [–from-snap snap-name] [–whole-object] (image-spec | snap-spec) dest-path

  • Export an incremental diff for an image to dest path (use - for stdout). Ifan initial snapshot is specified, only changes since that snapshot are included; otherwise,any regions of the image that contain data are included. The end snapshot is specifiedusing the standard –snap option or @snap syntax (see below). The image diff format includesmetadata about image size changes, and the start and end snapshots. It efficiently representsdiscarded or ‘zero’ regions of the image.

  • feature disableimage-spec__feature-name

  • Disable the specified feature on the specified image. Multiple features canbe specified.

  • feature enableimage-spec__feature-name

  • Enable the specified feature on the specified image. Multiple features canbe specified.

  • flattenimage-spec

  • If image is a clone, copy all shared blocks from the parent snapshot andmake the child independent of the parent, severing the link betweenparent snap and child. The parent snapshot can be unprotected anddeleted if it has no further dependent clones.

This requires image format 2.

  • group creategroup-spec
  • Create a group.

  • group image addgroup-spec__image-spec

  • Add an image to a group.

  • group image listgroup-spec

  • List images in a group.

  • group image removegroup-spec__image-spec

  • Remove an image from a group.

  • group ls [-p | –pool pool-name]

  • List rbd groups.

  • group renamesrc-group-spec__dest-group-spec

  • Rename a group. Note: rename across pools is not supported.

  • group rmgroup-spec

  • Delete a group.

  • group snap creategroup-snap-spec

  • Make a snapshot of a group.

  • group snap listgroup-spec

  • List snapshots of a group.

  • group snap rmgroup-snap-spec

  • Remove a snapshot from a group.

  • group snap renamegroup-snap-spec__snap-name

  • Rename group’s snapshot.

  • group snap rollbackgroup-snap-spec

  • Rollback group to snapshot.

  • image-meta getimage-spec__key

  • Get metadata value with the key.

  • image-meta listimage-spec

  • Show metadata held on the image. The first column is the keyand the second column is the value.

  • image-meta removeimage-spec__key

  • Remove metadata key with the value.

  • image-meta setimage-speckeyvalue

  • Set metadata key with the value. They will displayed in image-meta list.

  • import [–export-format format (1 or 2)] [–image-format format-id] [–object-size size-in-B/K/M] [–stripe-unit size-in-B/K/M –stripe-count num] [–image-feature feature-name]… [–image-shared] src-path [image-spec]

  • Create a new image and imports its data from path (use - forstdin). The import operation will try to create sparse rbd imagesif possible. For import from stdin, the sparsification unit isthe data block size of the destination image (object size).

The –stripe-unit and –stripe-count arguments are optional, but must beused together.

The –export-format accepts ‘1’ or ‘2’ currently. Format 2 allow us to import not only the contentof image, but also the snapshots and other properties, such as image_order, features.

  • import-diffsrc-path__image-spec
  • Import an incremental diff of an image and applies it to the current image. If the diffwas generated relative to a start snapshot, we verify that snapshot already exists beforecontinuing. If there was an end snapshot we verify it does not already exist beforeapplying the changes, and create the snapshot when we are done.

  • infoimage-spec | snap-spec

  • Will dump information (such as size and object size) about a specific rbd image.If image is a clone, information about its parent is also displayed.If a snapshot is specified, whether it is protected is shown as well.

  • journal client disconnectjournal-spec

  • Flag image journal client as disconnected.

  • journal export [–verbose] [–no-error] src-journal-spec__path-name

  • Export image journal to path (use - for stdout). It can be make a backupof the image journal especially before attempting dangerous operations.

Note that this command may not always work if the journal is badly corrupted.

  • journal import [–verbose] [–no-error] path-name__dest-journal-spec
  • Import image journal from path (use - for stdin).

  • journal infojournal-spec

  • Show information about image journal.

  • journal inspect [–verbose] journal-spec

  • Inspect and report image journal for structural errors.

  • journal resetjournal-spec

  • Reset image journal.

  • journal statusjournal-spec

  • Show status of image journal.

  • lock add [–shared lock-tag] image-spec__lock-id

  • Lock an image. The lock-id is an arbitrary name for the user’sconvenience. By default, this is an exclusive lock, meaning itwill fail if the image is already locked. The –shared optionchanges this behavior. Note that locking does not affectany operation other than adding a lock. It does notprotect an image from being deleted.

  • lock lsimage-spec

  • Show locks held on the image. The first column is the lockerto use with the lock remove command.

  • lock rmimage-speclock-idlocker

  • Release a lock on an image. The lock id and locker areas output by lock ls.

  • ls [-l | –long] [pool-name]

  • Will list all rbd images listed in the rbd_directory object. With-l, also show snapshots, and use longer-format output includingsize, parent (if clone), format, etc.

  • merge-difffirst-diff-pathsecond-diff-pathmerged-diff-path

  • Merge two continuous incremental diffs of an image into one single diff. Thefirst diff’s end snapshot must be equal with the second diff’s start snapshot.The first diff could be - for stdin, and merged diff could be - for stdout, whichenables multiple diff files to be merged using something like‘rbd merge-diff first second - | rbd merge-diff - third result’. Note this commandcurrently only support the source incremental diff with stripe_count == 1

  • migration abortimage-spec

  • Cancel image migration. This step may be run after successful orfailed migration prepare or migration execute steps and returns theimage to its initial (before migration) state. All modifications tothe destination image are lost.

  • migration commitimage-spec

  • Commit image migration. This step is run after a successful migrationprepare and migration execute steps and removes the source image data.

  • migration executeimage-spec

  • Execute image migration. This step is run after a successful migrationprepare step and copies image data to the destination.

  • migration prepare [–order order] [–object-size object-size] [–image-feature image-feature] [–image-shared] [–stripe-unit stripe-unit] [–stripe-count stripe-count] [–data-pool data-pool] src-image-spec [dest-image-spec]

  • Prepare image migration. This is the first step when migrating animage, i.e. changing the image location, format or otherparameters that can’t be changed dynamically. The destination canmatch the source, and in this case dest-image-spec can be omitted.After this step the source image is set as a parent of thedestination image, and the image is accessible in copy-on-write modeby its destination spec.

  • mirror image demoteimage-spec

  • Demote a primary image to non-primary for RBD mirroring.

  • mirror image disable [–force] image-spec

  • Disable RBD mirroring for an image. If the mirroring isconfigured in image mode for the image’s pool, then itcan be explicitly disabled mirroring for each image withinthe pool.

  • mirror image enableimage-spec

  • Enable RBD mirroring for an image. If the mirroring isconfigured in image mode for the image’s pool, then itcan be explicitly enabled mirroring for each image withinthe pool.

This requires the RBD journaling feature is enabled.

  • mirror image promote [–force] image-spec
  • Promote a non-primary image to primary for RBD mirroring.

  • mirror image resyncimage-spec

  • Force resync to primary image for RBD mirroring.

  • mirror image statusimage-spec

  • Show RBD mirroring status for an image.

  • mirror pool demote [pool-name]

  • Demote all primary images within a pool to non-primary.Every mirroring enabled image will demoted in the pool.

  • mirror pool disable [pool-name]

  • Disable RBD mirroring by default within a pool. When mirroringis disabled on a pool in this way, mirroring will also bedisabled on any images (within the pool) for which mirroringwas enabled explicitly.

  • mirror pool enable [pool-name] mode

  • Enable RBD mirroring by default within a pool.The mirroring mode can either be pool or image.If configured in pool mode, all images in the poolwith the journaling feature enabled are mirrored.If configured in image mode, mirroring needs to beexplicitly enabled (by mirror image enable command)on each image.

  • mirror pool info [pool-name]

  • Show information about the pool mirroring configuration.It includes mirroring mode, peer UUID, remote cluster name,and remote client name.

  • mirror pool peer add [pool-name] remote-cluster-spec

  • Add a mirroring peer to a pool.remote-cluster-spec is [remote client name@]remote cluster name.

The default for remote client name is “client.admin”.

This requires mirroring mode is enabled.

  • mirror pool peer remove [pool-name] uuid
  • Remove a mirroring peer from a pool. The peer uuid is availablefrom mirror pool info command.

  • mirror pool peer set [pool-name] uuidkeyvalue

  • Update mirroring peer settings.The key can be either client or cluster, and the valueis corresponding to remote client name or remote cluster name.

  • mirror pool promote [–force] [pool-name]

  • Promote all non-primary images within a pool to primary.Every mirroring enabled image will promoted in the pool.

  • mirror pool status [–verbose] [pool-name]

  • Show status for all mirrored images in the pool.With –verbose, also show additionally output statusdetails for every mirroring image in the pool.

  • mvsrc-image-spec__dest-image-spec

  • Rename an image. Note: rename across pools is not supported.

  • namespace createpool-name/namespace-name

  • Create a new image namespace within the pool.

  • namespace listpool-name

  • List image namespaces defined within the pool.

  • namespace removepool-name/namespace-name

  • Remove an empty image namespace from the pool.

  • object-map checkimage-spec | snap-spec

  • Verify the object map is correct.

  • object-map rebuildimage-spec | snap-spec

  • Rebuild an invalid object map for the specified image. An image snapshot can bespecified to rebuild an invalid object map for a snapshot.

  • pool init [pool-name] [–force]

  • Initialize pool for use by RBD. Newly created pools must initializedprior to use.

  • resize (-s | –size size-in-M/G/T) [–allow-shrink] image-spec

  • Resize rbd image. The size parameter also needs to be specified.The –allow-shrink option lets the size be reduced.

  • rmimage-spec

  • Delete an rbd image (including all data blocks). If the image hassnapshots, this fails and nothing is deleted.

  • snap createsnap-spec

  • Create a new snapshot. Requires the snapshot name parameter specified.

  • snap limit clearimage-spec

  • Remove any previously set limit on the number of snapshots allowed onan image.

  • snap limit set [–limit] limit__image-spec

  • Set a limit for the number of snapshots allowed on an image.

  • snap lsimage-spec

  • Dump the list of snapshots inside a specific image.

  • snap protectsnap-spec

  • 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 thatrefer to this snapshot. rbd clone will fail on a nonprotectedsnapshot.

This requires image format 2.

  • snap purgeimage-spec
  • Remove all unprotected snapshots from an image.

  • snap renamesrc-snap-spec__dest-snap-spec

  • Rename a snapshot. Note: rename across pools and images is not supported.

  • snap rm [–force] snap-spec

  • Remove the specified snapshot.

  • snap rollbacksnap-spec

  • Rollback image content to snapshot. This will iterate through the entire blocksarray and update the data head content to the snapshotted version.

  • snap unprotectsnap-spec

  • Unprotect a snapshot from deletion (undo snap protect). If clonedchildren remain, snap unprotect fails. (Note that clones may existin different pools than the parent snapshot.)

This requires image format 2.

  • sparsify [–sparse-size sparse-size] image-spec
  • Reclaim space for zeroed image extents. The default sparse size is4096 bytes and can be changed via –sparse-size option with thefollowing restrictions: it should be power of two, not less than4096, and not larger than image object size.

  • statusimage-spec

  • Show the status of the image, including which clients have it open.

  • trash ls [pool-name]

  • List all entries from trash.

  • trash mvimage-spec

  • Move an image to the trash. Images, even ones actively in-use byclones, can be moved to the trash and deleted at a later time.

  • trash purge [pool-name]

  • Remove all expired images from trash.

  • trash restoreimage-id

  • Restore an image from trash.

  • trash rmimage-id

  • Delete an image from trash. If image deferment time has not expiredyou can not removed it unless use force. But an actively in-use by clonesor has snapshots can not be removed.

  • watchimage-spec

  • Watch events on image.

Image, snap, group and journal specs

image-spec is [pool-name/[namespace-name/]]image-name

snap-spec is [pool-name/[namespace-name/]]image-name@snap-name

group-spec is [pool-name/[namespace-name/]]group-name

group-snap-spec is [pool-name/[namespace-name/]]group-name@snap-name

journal-spec is [pool-name/[namespace-name/]]journal-name

The default for pool-name is “rbd” and namespace-name is “”. If an imagename contains a slash character (‘/’), pool-name is required.

The journal-name is image-id.

You may specify each name individually, using –pool, –namespace, –image, and–snap options, but this is discouraged in favor of the above spec syntax.

Striping

RBD images are striped over many objects, which are then stored by theCeph distributed object store (RADOS). As a result, read and writerequests for the image are distributed across many nodes in thecluster, generally preventing any single node from becoming abottleneck when individual images get large or busy.

The striping is controlled by three parameters:

  • object-size
  • The size of objects we stripe over is a power of two. It will be rounded up the nearest power of two.The default object size is 4 MB, smallest is 4K and maximum is 32M.
  • stripe_unit
  • Each [stripe_unit] contiguous bytes are stored adjacently in the same object, before we move onto the next object.
  • stripe_count
  • After we write [stripe_unit] bytes to [stripe_count] objects, we loop back to the initial objectand write another stripe, until the object reaches its maximum size. At that point,we move on to the next [stripe_count] objects.

By default, [stripe_unit] is the same as the object size and [stripe_count] is 1. Specifying a different[stripe_unit] and/or [stripe_count] is often referred to as using “fancy” striping and requires format 2.

Kernel rbd (krbd) options

Most of these options are useful mainly for debugging and benchmarking. Thedefault values are set in the kernel and may therefore depend on the version ofthe running kernel.

Per client instance rbd device map options:

  • fsid=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee - FSID that should be assumed bythe client.

  • ip=a.b.c.d[:p] - IP and, optionally, port the client should use.

  • share - Enable sharing of client instances with other mappings (default).

  • noshare - Disable sharing of client instances with other mappings.

  • crc - Enable CRC32C checksumming for data writes (default).

  • nocrc - Disable CRC32C checksumming for data writes.

  • cephx_require_signatures - Require cephx message signing (since 3.19,default).

  • nocephx_require_signatures - Don’t require cephx message signing (since3.19).

  • tcp_nodelay - Disable Nagle’s algorithm on client sockets (since 4.0,default).

  • notcp_nodelay - Enable Nagle’s algorithm on client sockets (since 4.0).

  • cephx_sign_messages - Enable message signing (since 4.4, default).

  • nocephx_sign_messages - Disable message signing (since 4.4).

  • mounttimeout=x - A timeout on various steps in _rbd device map andrbd device unmap sequences (default is 60 seconds). In particular,since 4.2 this can be used to ensure that rbd device unmap eventuallytimes out when there is no network connection to a cluster.

  • osdkeepalive=x - OSD keepalive timeout (default is 5 seconds).

  • osd_idle_ttl=x - OSD idle TTL (default is 60 seconds).

Per mapping (block device) rbd device map options:

  • rw - Map the image read-write (default).

  • ro - Map the image read-only. Equivalent to –read-only.

  • queue_depth=x - queue depth (since 4.2, default is 128 requests).

  • lock_on_read - Acquire exclusive lock on reads, in addition to writes anddiscards (since 4.9).

  • exclusive - Disable automatic exclusive lock transitions (since 4.12).

  • lock_timeout=x - A timeout on waiting for the acquisition of exclusive lock(since 4.17, default is 0 seconds, meaning no timeout).

  • notrim - Turn off discard and write zeroes offload support to avoiddeprovisioning a fully provisioned image (since 4.17). When enabled, discardrequests will fail with -EOPNOTSUPP, write zeroes requests will fall back tomanually zeroing.

  • abort_on_full - Fail write requests with -ENOSPC when the cluster is full orthe data pool reaches its quota (since 5.0). The default behaviour is toblock until the full condition is cleared.

  • alloc_size - Minimum allocation unit of the underlying OSD object storebackend (since 5.1, default is 64K bytes). This is used to round off anddrop discards that are too small. For bluestore, the recommended setting isbluestore_min_alloc_size (typically 64K for hard disk drives and 16K forsolid-state drives). For filestore with filestore_punch_hole = false, therecommended setting is image object size (typically 4M).

rbd device unmap options:

  • force - Force the unmapping of a block device that is open (since 4.9). Thedriver will wait for running requests to complete and then unmap; requestssent to the driver after initiating the unmap will be failed.

Examples

To create a new rbd image that is 100 GB:

  1. rbd create mypool/myimage --size 102400

To use a non-default object size (8 MB):

  1. rbd create mypool/myimage --size 102400 --object-size 8M

To delete an rbd image (be careful!):

  1. rbd rm mypool/myimage

To create a new snapshot:

  1. rbd snap create mypool/myimage@mysnap

To create a copy-on-write clone of a protected snapshot:

  1. rbd clone mypool/myimage@mysnap otherpool/cloneimage

To see which clones of a snapshot exist:

  1. rbd children mypool/myimage@mysnap

To delete a snapshot:

  1. rbd snap rm mypool/myimage@mysnap

To map an image via the kernel with cephx enabled:

  1. rbd device map mypool/myimage --id admin --keyfile secretfile

To map an image via the kernel with different cluster name other than default ceph:

  1. rbd device map mypool/myimage --cluster cluster-name

To unmap an image:

  1. rbd device unmap /dev/rbd0

To create an image and a clone from it:

  1. rbd import --image-format 2 image mypool/parent
  2. rbd snap create mypool/parent@snap
  3. rbd snap protect mypool/parent@snap
  4. rbd clone mypool/parent@snap otherpool/child

To create an image with a smaller stripe_unit (to better distribute small writes in some workloads):

  1. rbd create mypool/myimage --size 102400 --stripe-unit 65536B --stripe-count 16

To change an image from one image format to another, export it and thenimport it as the desired image format:

  1. rbd export mypool/myimage@snap /tmp/img
  2. rbd import --image-format 2 /tmp/img mypool/myimage2

To lock an image for exclusive use:

  1. rbd lock add mypool/myimage mylockid

To release a lock:

  1. rbd lock remove mypool/myimage mylockid client.2485

To list images from trash:

  1. rbd trash ls mypool

To defer delete an image (use –expires-at to set expiration time, default is now):

  1. rbd trash mv mypool/myimage --expires-at "tomorrow"

To delete an image from trash (be careful!):

  1. rbd trash rm mypool/myimage-id

To force delete an image from trash (be careful!):

  1. rbd trash rm mypool/myimage-id --force

To restore an image from trash:

  1. rbd trash restore mypool/myimage-id

To restore an image from trash and rename it:

  1. rbd trash restore mypool/myimage-id --image mynewimage

Availability

rbd is part of Ceph, a massively scalable, open-source, distributed storage system. Please refer tothe Ceph documentation at http://ceph.com/docs for more information.

See also

ceph(8),rados(8)