blob: 3530f93e6004e009908112c5e918049368b05fd4 (
plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
$ get_block_name_prefix() {
> rbd info --format=json $1 | python -c "import sys, json; print json.load(sys.stdin)['block_name_prefix']"
> }
$ rbd create --size 200M img
$ DEV=$(sudo rbd map img)
$ xfs_io -c 'pwrite -b 4M 0 200M' $DEV >/dev/null
$ sudo rbd unmap $DEV
$ rbd snap create img@snap
$ rbd snap protect img@snap
cloneimg1:
1 object in an object set, 4M
25 full object sets
25 objects in total
$ rbd clone img@snap cloneimg1
$ DEV=$(sudo rbd map cloneimg1)
$ hexdump $DEV
0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ fallocate -z -l 100M $DEV
$ hexdump $DEV
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
6400000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ sudo rbd unmap $DEV
$ DEV=$(sudo rbd map cloneimg1)
$ hexdump $DEV
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
6400000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ sudo rbd unmap $DEV
cloneimg2:
7 objects in an object set, 28M
3 full object sets
min((100M % 28M) / 512K, 7) = 7 objects in the last object set
28 objects in total
$ rbd clone --stripe-unit 512K --stripe-count 7 img@snap cloneimg2
$ DEV=$(sudo rbd map cloneimg2)
$ hexdump $DEV
0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ fallocate -z -l 100M $DEV
$ hexdump $DEV
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
6400000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ sudo rbd unmap $DEV
$ DEV=$(sudo rbd map cloneimg2)
$ hexdump $DEV
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
6400000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ sudo rbd unmap $DEV
cloneimg3:
23 objects in an object set, 92M
1 full object set
min((100M % 92M) / 512K, 23) = 16 objects in the last object set
39 objects in total
$ rbd clone --stripe-unit 512K --stripe-count 23 img@snap cloneimg3
$ DEV=$(sudo rbd map cloneimg3)
$ hexdump $DEV
0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ fallocate -z -l 100M $DEV
$ hexdump $DEV
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
6400000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ sudo rbd unmap $DEV
$ DEV=$(sudo rbd map cloneimg3)
$ hexdump $DEV
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
6400000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ sudo rbd unmap $DEV
cloneimg4:
65 objects in an object set, 260M
0 full object sets
min((100M % 260M) / 512K, 65) = 65 objects in the last object set
65 objects in total
$ rbd clone --stripe-unit 512K --stripe-count 65 img@snap cloneimg4
$ DEV=$(sudo rbd map cloneimg4)
$ hexdump $DEV
0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ fallocate -z -l 100M $DEV
$ hexdump $DEV
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
6400000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ sudo rbd unmap $DEV
$ DEV=$(sudo rbd map cloneimg4)
$ hexdump $DEV
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
6400000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
c800000
$ sudo rbd unmap $DEV
$ rados -p rbd ls | grep -c $(get_block_name_prefix cloneimg1)
25
$ rados -p rbd ls | grep -c $(get_block_name_prefix cloneimg2)
28
$ rados -p rbd ls | grep -c $(get_block_name_prefix cloneimg3)
39
$ rados -p rbd ls | grep -c $(get_block_name_prefix cloneimg4)
65
$ rbd rm --no-progress cloneimg4
$ rbd rm --no-progress cloneimg3
$ rbd rm --no-progress cloneimg2
$ rbd rm --no-progress cloneimg1
$ rbd snap unprotect img@snap
$ rbd snap rm --no-progress img@snap
$ rbd rm --no-progress img
|