Manipulating object map header

The ceph-objectstore-tool utility outputs the object map (OMAP) header with the values that are associated with the object’s keys.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • Root-level access to the Ceph OSD node.
  • Stopping the ceph-osd daemon.

Procedure

  1. Verify that the appropriate OSD is down.
    systemctl status ceph-osd@OSD_ID
    For example,
    [root@host01 ~]# systemctl status ceph-osd@1
  2. Log in to the OSD container.
    cephadm shell --name osd.OSD_ID
    For example,
    [root@host01 ~]# cephadm shell --name osd.0
  3. Get the object map header.
    ceph-objectstore-tool --data-path PATH_TO_OSD \
    --pgid PG_ID OBJECT \
    get-omaphdr > OBJECT_MAP_FILE_NAME
    For example,
    [ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 \
    --pgid 0.1c '{"oid":"zone_info.default","key":"","snapid":-2,"hash":235010478,"max":0,"pool":11,"namespace":""}'  \
    get-omaphdr > zone_info.default.omaphdr.txt
  4. Set the object map header.
    ceph-objectstore-tool --data-path PATH_TO_OSD \
    --pgid PG_ID OBJECT \
    set-omaphdr > OBJECT_MAP_FILE_NAME
    For example,
    [ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 \
    --pgid 0.1c '{"oid":"zone_info.default","key":"","snapid":-2,"hash":235010478,"max":0,"pool":11,"namespace":""}'  \
    set-omaphdr > zone_info.default.omaphdr.txt