From Beocat
Extracting Data off CephFS
List inodes in directory, starting with the "root" inode
rados -p metadata listomapkeys 10000000000.00000000 | less
Get the omap value for the next path
rados -p metadata getomapval 10000000000.00000000 some_directory_head
value (412 bytes) : 00000000 02 00 00 00 00 00 00 00 49 0b 06 71 01 00 00 85 |........I..q....| 00000010 14 00 00 00 01 00 00 00 00 00 00 7e 80 48 57 fc |...........~.HW.| 00000020 86 82 1e ed 41 00 00 08 09 00 00 09 09 00 00 01 |....A...........| 00000030 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000060 01 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 |................| 00000070 00 00 00 00 00 00 00 00 7e 80 48 57 fc 86 82 1e |........~.HW....| 00000080 f4 41 c8 55 af 61 a0 01 0e 00 00 00 00 00 00 00 |.A.U.a..........| 00000090 02 02 20 00 00 00 00 00 00 00 00 00 00 00 7e 80 |.. ...........~.| 000000a0 48 57 fc 86 82 1e 07 00 00 00 00 00 00 00 15 00 |HW..............| 000000b0 00 00 00 00 00 00 03 02 38 00 00 00 a4 c3 14 00 |........8.......| 000000c0 00 00 00 00 22 e6 88 da 9d 00 00 00 74 19 00 00 |....".......t...| 000000d0 00 00 00 00 89 00 00 00 00 00 00 00 00 00 00 00 |................| 000000e0 00 00 00 00 00 00 00 00 00 00 00 00 3d 10 4d 57 |............=.MW| 000000f0 87 e8 e8 29 03 02 38 00 00 00 a4 c3 14 00 00 00 |...)..8.........| 00000100 00 00 22 e6 88 da 9d 00 00 00 74 19 00 00 00 00 |..".......t.....| 00000110 00 00 89 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000120 00 00 00 00 00 00 00 00 00 00 3d 10 4d 57 87 e8 |..........=.MW..| 00000130 e8 29 1d 0b a2 1e 00 00 00 00 00 00 00 00 00 00 |.)..............| 00000140 00 00 01 00 00 00 00 00 00 00 cf 4d 00 00 00 00 |...........M....| 00000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff |................| 00000160 ff ff ff ff ff ff 00 00 00 00 01 01 10 00 00 00 |................| 00000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000190 fe ff ff ff ff ff ff ff 00 00 00 00 |............| 0000019c
The inode for the next lookup is in red. In the correct order it is 10000001485.00000000. Perform more lookups until you have the inode of the file you want.
Then you can check the size of the file. Perform a binary search using stat to check object sizes. (Only works for non-sparse files)
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000000f cachepool/1000c165612.0000000f mtime 2016-04-14 18:31:39.000000, size 4194304 [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000000ff cachepool/1000c165612.000000ff mtime 2016-04-17 03:19:25.000000, size 4194304 [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000fff error stat-ing cachepool/1000c165612.00000fff: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000008ff error stat-ing cachepool/1000c165612.000008ff: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000004ff error stat-ing cachepool/1000c165612.000004ff: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000002ff error stat-ing cachepool/1000c165612.000002ff: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000001ff error stat-ing cachepool/1000c165612.000001ff: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000018f error stat-ing cachepool/1000c165612.0000018f: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000014f error stat-ing cachepool/1000c165612.0000014f: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000012f cachepool/1000c165612.0000012f mtime 2016-04-17 13:59:58.000000, size 4194304 [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000013f error stat-ing cachepool/1000c165612.0000013f: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000138 error stat-ing cachepool/1000c165612.00000138: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000134 error stat-ing cachepool/1000c165612.00000134: (2) No such file or directory [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000132 cachepool/1000c165612.00000132 mtime 2016-04-17 14:40:05.000000, size 4194304 [root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000133 cachepool/1000c165612.00000133 mtime 2016-04-17 14:40:05.000000, size 88171
The above inode is 0x133 segments long. We then need to get all those segments.
for x in {0..307}; do
segment=$(printf %8x'\n' ${x} | sed -e 's/ /0/g');
rados -p cachepool get 1000c165612.$segment some_file.$segment
done
Once the segments have been extracted, you must put them together.
cat some_file.* > some_file
Then you can delete the segments
rm -f some_file.*
Congratulations and godspeed.