从已删除的 RBD 卷中恢复数据?

Recover Data from Deleted RBD Volume?

有什么方法可以从 Ceph 中删除的 RBD 卷中恢复数据?谢谢

$ ceph osd map pool-name csi-vol-65c11863-32e1-11eb-a202-cab20b4e04f6
osdmap e2248 pool 'pool-name' (8) object 'csi-vol-65c11863-32e1-11eb-a202-cab20b4e04f6' -> pg 8.e5d09b91 (8.11) -> up ([5,4], p5) acting ([5,4], p5)

AFAIK,答案是否定的。但是,我引用了 source 中的以下解释,可能对您有所帮助:

Consider the way Ceph stores data... each RBD is striped into chunks (RADOS objects with 4MB size by default); the chunks are distributed among the OSDs with the configured number of replicates (probably two in your case since you use 2 OSD hosts). RBD uses thin provisioning, so chunks are allocated upon first write access. If an RBD is deleted all of its chunks are deleted on the corresponding OSDs. If you want to recover a deleted RBD, you need to recover all individual chunks. Whether this is possible depends on your filesystem and whether the space of a former chunk is already assigned to other RADOS objects. The RADOS object names are composed of the RBD name and the offset position of the chunk, so if an undelete mechanism exists for the OSDs' filesystem, you have to be able to recover file by their filename, otherwise you might end up mixing the content of various deleted RBDs. Due to the thin provisioning there might be some chunks missing (e.g. never allocated before).

不过,还是有希望的。名为 Mastering Ceph 的 Ceph 书给出了一些 hints 来恢复数据,如下所示:

there are tools that can search through the OSD data structure, find the object files relating to RBDs, and then assemble these objects back into a disk image, resembling the original RBD image.

您可能需要在 Ceph 源代码中找到合适的工具。