Checking for fragmentation

Check the fragmentation level of BlueStore OSDs while the BlueStore OSD process is either online or offline.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • A running IBM Storage Ceph cluster.
  • BlueStore OSDs.

Getting an online BlueStore fragmentation score

Procedure

Inspect a running BlueStore OSD process by getting either a simple or more detailed report.
  • Get a simple report.
    ceph daemon OSD_ID bluestore allocator score block
    For example,
    [ceph: root@host01 /]# ceph daemon osd.123 bluestore allocator score block
  • Get a detailed report.
    ceph daemon OSD_ID bluestore allocator dump block
    For example,
    [ceph: root@host01 /]# ceph daemon osd.123 bluestore allocator dump block

Getting an offline BlueStore fragmentation score

Procedure

  1. Reshard to check the offline BlueStore OSD.
    For more information about resharding, see Resharding the RocksDB database.
    [root@host01 ~]# cephadm shell --name osd.ID
    For example,
    [root@host01 ~]# cephadm shell --name osd.2
    Inferring fsid 110bad0a-bc57-11ee-8138-fa163eb9ffc2
    Inferring config /var/lib/ceph/110bad0a-bc57-11ee-8138-fa163eb9ffc2/osd.2/config
    Using ceph image with id `17334f841482` and tag `cp.stg.icr.io/cp/ibm-ceph/ceph-9-rhel9:7-22/ibm-ceph@sha256:09fc3e5baf198614d70669a106eb87dbebee16d4e91484375778d4adbccadacd
  2. Inspect a non-running BlueStore OSD process.
    Inspect a running BlueStore OSD process by getting either a simple or more detailed report.
    • Get a simple report.
      ceph-bluestore-tool --path PATH_TO_OSD_DATA_DIRECTORY --allocator block free-score
      For example,
      [root@host01 /]# ceph-bluestore-tool --path /var/lib/ceph/osd/ceph-123 --allocator block free-score
    • Get a detailed report.
      ceph-bluestore-tool --path PATH_TO_OSD_DATA_DIRECTORY --allocator block free-dump
      block:
      {
          "fragmentation_rating": 0.018290238194701977
      }
      For example,
      [root@host01 /]# ceph-bluestore-tool --path /var/lib/ceph/osd/ceph-123 --allocator block free-dump
      block:
      {
          "capacity": 21470642176,
          "alloc_unit": 4096,
          "alloc_type": "hybrid",
          "alloc_name": "block",
          "extents": [
              {
                  "offset": "0x370000",
                  "length": "0x20000"
              },
              {
                  "offset": "0x3a0000",
                  "length": "0x10000"
              },
              {
                  "offset": "0x3f0000",
                  "length": "0x20000"
              },
              {
                  "offset": "0x460000",
                  "length": "0x10000"
              },