From Beocat
Jump to: navigation, search
(Created page with "== 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 th...")
 
Line 36: Line 36:
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.
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)
<tt>
<pre>
[root@hobbit01 ~]# rados -p metadata getomapval 1000b96f842.00000000 some_file_head
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000000f
value (412 bytes) :
cachepool/1000c165612.0000000f mtime 2016-04-14 18:31:39.000000, size 4194304
00000000  02 00 00 00 00 00 00 00  49 0b 06 71 01 00 00 12  |........I..q....|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000000ff
00000010  56 16 0c 00 01 00 00 00  00 00 00 60 f2 0f 57 1f  |V..........`..W.|
cachepool/1000c165612.000000ff mtime 2016-04-17 03:19:25.000000, size 4194304
00000020  ee 48 2a a4 81 00 00 08  09 00 00 09 09 00 00 01  |.H*.............|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000fff
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 40 00  |..............@.|
  error stat-ing cachepool/1000c165612.00000fff: (2) No such file or directory
  00000040  01 00 00 00 00 00 40 00  00 00 00 00 00 00 00 00  |......@.........|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000008ff
  00000050  <span style="color: blue">ff ff ff ff</span> <span style="color: red">22</span> 00 00 00  <span style="color: green">6b 58 c1 4c</span> 00 00 00 00  |...."...kX.L....|
  error stat-ing cachepool/1000c165612.000008ff: (2) No such file or directory
00000060  01 00 00 00 ff ff ff ff  ff ff ff ff 00 00 00 00  |................|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000004ff
  00000070  00 00 00 00 00 00 00 00  95 e6 13 57 f8 21 27 19  |...........W.!'.|
  error stat-ing cachepool/1000c165612.000004ff: (2) No such file or directory
00000080  60 f2 0f 57 1f ee 48 2a  00 00 00 00 00 00 00 00  |`..W..H*........|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000002ff
  00000090  02 02 20 00 00 00 00 00  00 00 00 00 00 00 00 00  |.. .............|
  error stat-ing cachepool/1000c165612.000002ff: (2) No such file or directory
000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.000001ff
  000000b0  00 00 00 00 00 00 03 02  38 00 00 00 00 00 00 00  |........8.......|
  error stat-ing cachepool/1000c165612.000001ff: (2) No such file or directory
000000c0  00 00 00 00 6b 58 c1 4c  00 00 00 00 01 00 00 00  |....kX.L........|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000018f
  000000d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  error stat-ing cachepool/1000c165612.0000018f: (2) No such file or directory
*
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000014f
000000f0  00 00 00 00 03 02 38 00  00 00 00 00 00 00 00 00  |......8.........|
  error stat-ing cachepool/1000c165612.0000014f: (2) No such file or directory
  00000100  00 00 6b 58 c1 4c 00 00  00 00 01 00 00 00 00 00  |..kX.L..........|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000012f
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
cachepool/1000c165612.0000012f mtime 2016-04-17 13:59:58.000000, size 4194304
*
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.0000013f
00000130  00 00 05 f2 01 00 00 00  00 00 00 00 00 00 00 00  |................|
  error stat-ing cachepool/1000c165612.0000013f: (2) No such file or directory
00000140  00 00 01 00 00 00 00 00  00 00 a5 00 00 00 00 00  |................|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000138
  00000150  00 00 00 00 00 00 00 00  00 00 00 00 00 00 ff ff  |................|
  error stat-ing cachepool/1000c165612.00000138: (2) No such file or directory
00000160  ff ff ff ff ff ff 00 00  00 00 01 01 10 00 00 00  |................|
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000134
  00000170  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  error stat-ing cachepool/1000c165612.00000134: (2) No such file or directory
*
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000132
  00000190  fe ff ff ff ff ff ff ff  00 00 00 00              |............|
cachepool/1000c165612.00000132 mtime 2016-04-17 14:40:05.000000, size 4194304
0000019c
[root@hobbit01 some_directory]# rados -p cachepool stat 1000c165612.00000133
</tt>
cachepool/1000c165612.00000133 mtime 2016-04-17 14:40:05.000000, size 88171
In blue, is the number of bytes for each segment (4MB). In red is the pool ID. In Green is the number of bytes (0x4cc1586b). Divide 0x4cc1586b by 4MB. Then we have to extract that many segments.
</pre>
The above inode is 0x133 segments long. We then need to get all those segments.
The above inode is 0x133 segments long. We then need to get all those segments.
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>

Revision as of 09:51, 23 June 2016

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.

[root@hobbit01 ~]# rados -p metadata getomapval 1000b96f842.00000000 some_file_head
value (412 bytes) :
00000000  02 00 00 00 00 00 00 00  49 0b 06 71 01 00 00 12  |........I..q....|
00000010  56 16 0c 00 01 00 00 00  00 00 00 60 f2 0f 57 1f  |V..........`..W.|
00000020  ee 48 2a a4 81 00 00 08  09 00 00 09 09 00 00 01  |.H*.............|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 40 00  |..............@.|
00000040  01 00 00 00 00 00 40 00  00 00 00 00 00 00 00 00  |......@.........|
00000050  ff ff ff ff 22 00 00 00  6b 58 c1 4c 00 00 00 00  |...."...kX.L....|
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  95 e6 13 57 f8 21 27 19  |...........W.!'.|
00000080  60 f2 0f 57 1f ee 48 2a  00 00 00 00 00 00 00 00  |`..W..H*........|
00000090  02 02 20 00 00 00 00 00  00 00 00 00 00 00 00 00  |.. .............|
000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000b0  00 00 00 00 00 00 03 02  38 00 00 00 00 00 00 00  |........8.......|
000000c0  00 00 00 00 6b 58 c1 4c  00 00 00 00 01 00 00 00  |....kX.L........|
000000d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000000f0  00 00 00 00 03 02 38 00  00 00 00 00 00 00 00 00  |......8.........|
00000100  00 00 6b 58 c1 4c 00 00  00 00 01 00 00 00 00 00  |..kX.L..........|
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000130  00 00 05 f2 01 00 00 00  00 00 00 00 00 00 00 00  |................|
00000140  00 00 01 00 00 00 00 00  00 00 a5 00 00 00 00 00  |................|
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

In blue, is the number of bytes for each segment (4MB). In red is the pool ID. In Green is the number of bytes (0x4cc1586b). Divide 0x4cc1586b by 4MB. Then we have to extract that many segments. 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.