0

In Ceph, the command rados --pgid <pgid> ls allows you to list all the rados objects that are stored in a specific placement group. My question is: is there a command that does the reverse? So, is it possible, given a specific rados object name, to determine the placement group that object is stored in? I did not find any such command in the rados man page.

Several sources state that the formula is pgid = hash(object_name)%pg_num, so if that is accurate I guess I'm looking for a command line tool that can do that calculation.

I know I could resort to listing the contents of all pgs until I find the object I need, but that is very inefficient and I would like to avoid it if at all possible.

roelvanmeer
  • 1,764
  • 3
  • 13
  • 27

1 Answers1

1

This seems to get the information you're looking for:

host1:~ # ceph osd map <pool> <object>

For example:

host1:~ # ceph osd map cephfs_data 1000000058e.00000002 
osdmap e1683 pool 'cephfs_data' (35) object '1000000058e.00000002' -> pg 35.5c9f6800 (35.0) -> up ([14,15,1], p14) acting ([14,15,1], p14)
eblock
  • 417
  • 2
  • 6
  • I've updated the question to make it more clear I'm looking for the PG that one specific rados object is in, not any high-level file object or rdb image. – roelvanmeer Mar 13 '23 at 12:48