On Mon, Aug 8, 2016 at 11:47 PM, Jason Dillaman <jdillama@xxxxxxxxxx> wrote: > On Mon, Aug 8, 2016 at 5:39 PM, Jason Dillaman <jdillama@xxxxxxxxxx> wrote: >> Unfortunately, for v2 RBD images, this image name to image id mapping >> is stored in the LevelDB database within the OSDs and I don't know, >> offhand, how to attempt to recover deleted values from there. > > Actually, to correct myself, the "rbd_id.<image id>" object just I think Jason meant to write "rbd_id.<image name>" here. > writes the image id in binary to the file. So if you can recover that > file and retrieve its contents, you can again determine the block name > prefix in the form of "rbd_data.<image id>.<object number>". So if you had a v2 image named "myimage" in a pool named "rbd" $ ceph osd map rbd rbd_id.myimage osdmap e11 pool 'rbd' (0) object 'rbd_id.myimage' -> pg 0.f8d9dc15 (0.5) -> up ([0,2,1], p0) acting ([0,2,1], p0) you'd need to search for a file whose name starts with "rbd\uid.myimage" under <path to osd0, osd2 or osd1>/current/0.5_head/. The 0.5 is the short PG id from the ceph osd map command above (the object doesn't have to exist for it to work). The "\u" is literally a "\" followed by a "u" - ceph's FileStore uses underscores as separators so underscores in object names get translated to "\u" in the corresponding file names. The actual file name is going to be something along the lines of "rbd\uid.myimage__head_F8D9DC15__0": $ xxd "./0.5_head/rbd\uid.myimage__head_F8D9DC15__0" 00000000: 0c00 0000 3130 3130 3734 6230 6463 3531 ....101074b0dc51 That's the prefix for the image. myimage actually exists here, so I can verify it with: $ rbd info rbd/myimage | grep block_name_prefix block_name_prefix: rbd_data.101074b0dc51 With the prefix at hand, you'd need to search all <path to osd>/current/ directories for files whose names start with "rbd\udata.101074b0dc51", doing the equivalent of: $ find . -regex ".*/rbd\\\udata.101074b0dc51.*" ./0.4_head/rbd\udata.101074b0dc51.0000000000000003__head_64B130D4__0 ./0.0_head/rbd\udata.101074b0dc51.0000000000000000__head_7A694010__0 ./0.3_head/rbd\udata.101074b0dc51.0000000000000004__head_85FCAA2B__0 ./0.1_head/rbd\udata.101074b0dc51.0000000000000002__head_660B5009__0 ./0.6_head/rbd\udata.101074b0dc51.0000000000000001__head_33B916C6__0 ... There is a rbd-recover-tool tool in the ceph source tree, which can reconstruct rbd images from a FileStore structure outlined in this thread. I'm not sure if we document it or even build it (probably not, and it won't be of much use to you anyway since the files are gone), but you can peruse the code for the exact object name regexes. Thanks, Ilya _______________________________________________ ceph-users mailing list ceph-users@xxxxxxxxxxxxxx http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com