Working with image metadata

Ceph supports adding custom image metadata as key-value pairs. The pairs do not have any strict format. By using metadata you can also set the RADOS Block Device (RBD) configuration parameters for particular images. Use the rbd image-meta command to work with metadata.

Prerequisites

  • A running IBM Storage Ceph cluster.

  • Root-level access to the client node.

Procedure

  1. To set a new metadata key-value pair:

    Syntax

    rbd image-meta set POOL_NAME/IMAGE_NAME KEY VALUE

    Example

    [ceph: root@host01 /]# rbd image-meta set pool1/image1 last_update 2021-06-06

    This example sets the last_update key to the 2021-06-06 value on the image1 image in the pool1 pool.

  2. To view a value of a key:

    Syntax

    rbd image-meta get POOL_NAME/IMAGE_NAME KEY

    Example

    [ceph: root@host01 /]# rbd image-meta get pool1/image1 last_update

    This example views the value of the last_update key.

  3. To show all metadata on an image:

    Syntax

    rbd image-meta list POOL_NAME/IMAGE_NAME

    Example

    [ceph: root@host01 /]# rbd image-meta list pool1/image1

    This example lists the metadata set for the image1 image in the pool1 pool.

  4. To remove a metadata key-value pair:

    Syntax

    rbd image-meta remove POOL_NAME/IMAGE_NAME KEY

    Example

    [ceph: root@host01 /]# rbd image-meta remove pool1/image1 last_update

    This example removes the last_update key-value pair from the image1 image in the pool1 pool.

  5. To override the RBD image configuration settings set in the Ceph configuration file for a particular image:

    Syntax

    rbd config image set POOL_NAME/IMAGE_NAME  PARAMETER VALUE

    Example

    [ceph: root@host01 /]# rbd config image set pool1/image1 rbd_cache false

    This example disables the RBD cache for the image1 image in the pool1 pool.

Reference

For a list of possible configuration options, see General options.