]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | RBD Export & Import |
2 | =================== | |
3 | ||
4 | This is a file format of an RBD image or snapshot. It's a sparse format | |
5 | for the full image. There are three recording sections in the file. | |
6 | ||
7 | (1) Header. | |
8 | (2) Metadata. | |
9 | (3) Diffs. | |
10 | ||
11 | Header | |
12 | ~~~~~~ | |
13 | ||
14 | "rbd image v2\\n" | |
15 | ||
16 | Metadata records | |
17 | ~~~~~~~~~~~~~~~~ | |
18 | ||
19 | Every record has a one byte "tag" that identifies the record type, | |
20 | followed by length of data, and then some other data. | |
21 | ||
22 | Metadata records come in the first part of the image. Order is not | |
23 | important, as long as all the metadata records come before the data | |
24 | records. | |
25 | ||
26 | In v2, we have the following metadata in each section: | |
27 | (1 Bytes) tag. | |
28 | (8 Bytes) length. | |
29 | (n Bytes) data. | |
30 | ||
31 | In this way, we can skip the unrecognized tag. | |
32 | ||
33 | Image order | |
34 | ----------- | |
35 | ||
36 | - u8: 'O' | |
37 | - le64: length of appending data (8) | |
38 | - le64: image order | |
39 | ||
40 | Image format | |
41 | ------------ | |
42 | ||
43 | - u8: 'F' | |
44 | - le64: length of appending data (8) | |
45 | - le64: image format | |
46 | ||
47 | Image Features | |
48 | -------------- | |
49 | ||
50 | - u8: 'T' | |
51 | - le64: length of appending data (8) | |
52 | - le64: image features | |
53 | ||
54 | Image Stripe unit | |
55 | ----------------- | |
56 | ||
57 | - u8: 'U' | |
58 | - le64: length of appending data (8) | |
59 | - le64: image striping unit | |
60 | ||
61 | Image Stripe count | |
62 | ------------------ | |
63 | ||
64 | - u8: 'C' | |
65 | - le64: length of appending data (8) | |
66 | - le64: image striping count | |
67 | ||
28e407b8 AA |
68 | ImageMeta Key and Value |
69 | ----------------------- | |
70 | ||
71 | - u8: 'M' | |
72 | - le64: length of appending data (length of key + length of value + 4 * 2) | |
73 | - string: image-meta key | |
74 | - string: image-meta value | |
75 | ||
7c673cae FG |
76 | Final Record |
77 | ~~~~~~~~~~~~ | |
78 | ||
79 | End | |
80 | --- | |
81 | ||
82 | - u8: 'E' | |
83 | ||
84 | ||
85 | Diffs records | |
28e407b8 AA |
86 | ~~~~~~~~~~~~~ |
87 | ||
7c673cae FG |
88 | Record the all snapshots and the HEAD in this section. |
89 | ||
28e407b8 AA |
90 | Snap Protection status |
91 | ---------------------- | |
92 | ||
93 | Record the snapshot's protection status if `--export-format=2`. | |
94 | - u8: 'p' | |
95 | - le64: length of appending data (8) | |
96 | - u8: snap protection status (0 for false, 1 for true) | |
97 | ||
98 | Others | |
99 | ------ | |
100 | ||
7c673cae FG |
101 | - le64: number of diffs |
102 | - Diffs ... | |
103 | ||
104 | Detail please refer to rbd-diff.rst |