Listing objects

The OSD can contain zero to many placement groups, and zero to many objects within a placement group (PG). The ceph-objectstore-tool utility allows you to list objects stored within an OSD.

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_NUMBER
    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. Identify all the objects within an OSD, regardless of their placement group.
    ceph-objectstore-tool --data-path PATH_TO_OSD --op list
    For example,
    [ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --op list
  4. Identify all the objects within a placement group.
    ceph-objectstore-tool --data-path PATH_TO_OSD --pgid PG_ID --op list
    For example,
    [ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c --op list
  5. Identify the PG that an object belongs to.
    ceph-objectstore-tool --data-path PATH_TO_OSD --op list OBJECT_ID
    For example,
    [ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --op list default.region