rbd元数据分析

rbd有几个重要的元数据对象:

1
2
3
4
5
6
7
8
9
10
root@ceph1:~# rados -p rbd ls
rbd_id.myrbdsnapclone1
rbd_header.11ee2ae8944a
rbd_children
rbd_directory
rbd_data.11ee2ae8944a.0000000000000000
rbd_id.myrbd
rbd_data.11ee2ae8944a.0000000000000002
rbd_header.123f238e1f29
rbd_data.11ee2ae8944a.0000000000000001

包括:rbd_directory、rbd_id.imagename、rbd_header.image_id、rbd_data.image_id.offset

rbd_directory

rbd_directory 对象:该对象在每一个pool中都存在。保留该pool下每一个image的目录信息。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
rados -p rbd listomapvals rbd_directory
name_test0
value (18 bytes) :
00000000 0e 00 00 00 31 34 62 35 34 34 36 62 38 62 34 35 |....14b5446b8b45|
00000010 36 37 |67|
00000012

name_test1
value (18 bytes) :
00000000 0e 00 00 00 31 33 30 66 39 63 36 62 38 62 34 35 |....130f9c6b8b45|
00000010 36 37 |67|
00000012

name_test2
value (18 bytes) :
00000000 0e 00 00 00 31 34 62 34 63 39 36 62 38 62 34 35 |....14b4c96b8b45|
00000010 36 37 |67|
00000012

name_test3
value (18 bytes) :
00000000 0e 00 00 00 31 33 30 66 61 35 36 62 38 62 34 35 |....130fa56b8b45|
00000010 36 37 |67|
00000012

name_test4
value (18 bytes) :
00000000 0e 00 00 00 31 33 38 37 64 31 36 62 38 62 34 35 |....1387d16b8b45|
00000010 36 37 |67|
00000012

rbd_id.image_name

保存image的name和id的对应关系

rbd_header.image_id

记录rbd image的元数据,其内容包括size,order,object_prefix, snapseq, parent(克隆的image才有), snapshot{snap id}(各个快照的信息).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[root@172e18e211e54 current]# rados -p rbd listomapvals rbd_header.14b5446b8b4567
create_timestamp
value (8 bytes) :
00000000 a8 46 04 5e f4 63 9d 36 |.F.^.c.6|
00000008

features
value (8 bytes) :
00000000 3d 00 00 00 00 00 00 00 |=.......|
00000008

object_prefix
value (27 bytes) :
00000000 17 00 00 00 72 62 64 5f 64 61 74 61 2e 31 34 62 |....rbd_data.14b|
00000010 35 34 34 36 62 38 62 34 35 36 37 |5446b8b4567|
0000001b

order
value (1 bytes) :
00000000 16 |.|
00000001

size
value (8 bytes) :
00000000 00 00 00 40 00 00 00 00 |...@....|
00000008

snap_seq
value (8 bytes) :
00000000 0d 03 00 00 00 00 00 00 |........|
00000008

snapshot_000000000000030d
value (97 bytes) :
00000000 06 01 5b 00 00 00 0d 03 00 00 00 00 00 00 02 00 |..[.............|
00000010 00 00 56 31 00 00 00 40 00 00 00 00 3d 00 00 00 |..V1...@....=...|
00000020 00 00 00 00 01 01 1c 00 00 00 ff ff ff ff ff ff |................|
00000030 ff ff 00 00 00 00 fe ff ff ff ff ff ff ff 00 00 |................|
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 |................|
00000050 01 04 00 00 00 00 00 00 00 5e 60 0d 5e 82 d7 e5 |.........^`.^...|
00000060 16 |.|
00000061

rbd_data.image_id.offset

rbd image的数据对象,存放具体的数据内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@172e18e211e54 current]# ls *head -la|grep data
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:28 rbd\udata.f5b21e6b8b4567.00000000000000f6__head_C5C18500__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:25 rbd\udata.f5b21e6b8b4567.0000000000000165__head_29FF2D00__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:28 rbd\udata.f5b21e6b8b4567.00000000000005f7__head_27852500__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:22 rbd\udata.f5b21e6b8b4567.0000000000000718__head_0E152500__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:18 rbd\udata.f5b21e6b8b4567.0000000000000748__head_3686C100__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:27 rbd\udata.f5b21e6b8b4567.0000000000000965__head_B07AB900__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:19 rbd\udata.f5b21e6b8b4567.0000000000000f34__head_7ABE3100__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:24 rbd\udata.f5b21e6b8b4567.0000000000001381__head_524CD100__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:29 rbd\udata.f5b21e6b8b4567.0000000000001abb__head_91815900__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:27 rbd\udata.f5b21e6b8b4567.0000000000001bfb__head_8FB1F500__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:25 rbd\udata.f5b21e6b8b4567.0000000000001db4__head_51213900__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:28 rbd\udata.f5b21e6b8b4567.0000000000002dc3__head_5E196900__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:29 rbd\udata.f5b21e6b8b4567.00000000000009ce__head_92E5F111__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:25 rbd\udata.f5b21e6b8b4567.0000000000000a58__head_B66A3511__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:28 rbd\udata.f5b21e6b8b4567.000000000000100b__head_B923BD11__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:26 rbd\udata.f5b21e6b8b4567.0000000000001ea5__head_CBECDD11__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:17 rbd\udata.f5b21e6b8b4567.0000000000001ea8__head_8FFC4111__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:29 rbd\udata.f5b21e6b8b4567.0000000000001f3b__head_D3111911__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:21 rbd\udata.f5b21e6b8b4567.0000000000001f40__head_46A4F911__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:28 rbd\udata.f5b21e6b8b4567.0000000000001f77__head_EF31D511__4
-rw-r--r-- 1 ceph ceph 4194304 Dec 6 19:29 rbd\udata.f5b21e6b8b4567.0000000000002037__head_02271D11__4