-
Notifications
You must be signed in to change notification settings - Fork 0
/
rbd.8
616 lines (616 loc) · 17.1 KB
/
rbd.8
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
.\" Man page generated from reStructuredText.
.
.TH "RBD" "8" "January 12, 2014" "dev" "Ceph"
.SH NAME
rbd \- manage rados block device (RBD) images
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.SH SYNOPSIS
.nf
\fBrbd\fP [ \-c \fIceph.conf\fP ] [ \-m \fImonaddr\fP ] [ \-p | \-\-pool \fIpool\fP ] [
\-\-size \fIsize\fP ] [ \-\-order \fIbits\fP ] [ \fIcommand\fP ... ]
.fi
.sp
.SH DESCRIPTION
.sp
\fBrbd\fP is a utility for manipulating rados block device (RBD) images,
used by the Linux rbd driver and the rbd storage driver for Qemu/KVM.
RBD images are simple block devices that are striped over objects and
stored in a RADOS object store. The size of the objects the image is
striped over must be a power of two.
.SH OPTIONS
.INDENT 0.0
.TP
.B \-c ceph.conf, \-\-conf ceph.conf
Use ceph.conf configuration file instead of the default /etc/ceph/ceph.conf to
determine monitor addresses during startup.
.UNINDENT
.INDENT 0.0
.TP
.B \-m monaddress[:port]
Connect to specified monitor (instead of looking through ceph.conf).
.UNINDENT
.INDENT 0.0
.TP
.B \-p pool, \-\-pool pool
Interact with the given pool. Required by most commands.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-no\-progress
Do not output progress information (goes to standard error by
default for some commands).
.UNINDENT
.SH PARAMETERS
.INDENT 0.0
.TP
.B \-\-image\-format format
Specifies which object layout to use. The default is 1.
.INDENT 7.0
.IP \(bu 2
format 1 \- Use the original format for a new rbd image. This format is
understood by all versions of librbd and the kernel rbd module, but
does not support newer features like cloning.
.IP \(bu 2
format 2 \- Use the second rbd format, which is supported by
librbd (but not the kernel rbd module) at this time. This adds
support for cloning and is more easily extensible to allow more
features in the future.
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-\-size size\-in\-mb
Specifies the size (in megabytes) of the new rbd image.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-order bits
Specifies the object size expressed as a number of bits, such that
the object size is \fB1 << order\fP\&. The default is 22 (4 MB).
.UNINDENT
.INDENT 0.0
.TP
.B \-\-stripe\-unit size\-in\-bytes
Specifies the stripe unit size in bytes. See striping section (below) for more details.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-stripe\-count num
Specifies the number of objects to stripe over before looping back
to the first object. See striping section (below) for more details.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-snap snap
Specifies the snapshot name for the specific operation.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-id username
Specifies the username (without the \fBclient.\fP prefix) to use with the map command.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-keyfile filename
Specifies a file containing the secret to use with the map command.
If not specified, \fBclient.admin\fP will be used by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-keyring filename
Specifies a keyring file containing a secret for the specified user
to use with the map command. If not specified, the default keyring
locations will be searched.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-shared tag
Option for \fIlock add\fP that allows multiple clients to lock the
same image if they use the same tag. The tag is an arbitrary
string. This is useful for situations where an image must
be open from more than one client at once, like during
live migration of a virtual machine, or for use underneath
a clustered filesystem.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-format format
Specifies output formatting (default: plain, json, xml)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-pretty\-format
Make json or xml formatted output more human\-readable.
.UNINDENT
.INDENT 0.0
.TP
.B \-o map\-options, \-\-options map\-options
Specifies which options to use when mapping an image. map\-options is
a comma\-separated string of options (similar to mount(8) mount options).
See map options section below for more details.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-read\-only
Map the image read\-only. Equivalent to \-o ro.
.UNINDENT
.SH COMMANDS
.INDENT 0.0
.TP
.B \fBls\fP [\-l | \-\-long] [pool\-name]
Will list all rbd images listed in the rbd_directory object. With
\-l, also show snapshots, and use longer\-format output including
size, parent (if clone), format, etc.
.TP
.B \fBinfo\fP [\fIimage\-name\fP]
Will dump information (such as size and order) about a specific rbd image.
If image is a clone, information about its parent is also displayed.
If a snapshot is specified, whether it is protected is shown as well.
.TP
.B \fBcreate\fP [\fIimage\-name\fP]
Will create a new rbd image. You must also specify the size via \-\-size. The
\-\-stripe\-unit and \-\-stripe\-count arguments are optional, but must be used together.
.TP
.B \fBclone\fP [\fIparent\-snapname\fP] [\fIimage\-name\fP]
Will create a clone (copy\-on\-write child) of the parent snapshot.
Object order will be identical to that of the parent image unless
specified. Size will be the same as the parent snapshot.
.sp
The parent snapshot must be protected (see \fIrbd snap protect\fP).
This requires image format 2.
.TP
.B \fBflatten\fP [\fIimage\-name\fP]
If image is a clone, copy all shared blocks from the parent snapshot and
make the child independent of the parent, severing the link between
parent snap and child. The parent snapshot can be unprotected and
deleted if it has no further dependent clones.
.sp
This requires image format 2.
.TP
.B \fBchildren\fP [\fIimage\-name\fP]
List the clones of the image at the given snapshot. This checks
every pool, and outputs the resulting poolname/imagename.
.sp
This requires image format 2.
.TP
.B \fBresize\fP [\fIimage\-name\fP] [\-\-allow\-shrink]
Resizes rbd image. The size parameter also needs to be specified.
The \-\-allow\-shrink option lets the size be reduced.
.TP
.B \fBrm\fP [\fIimage\-name\fP]
Deletes an rbd image (including all data blocks). If the image has
snapshots, this fails and nothing is deleted.
.TP
.B \fBexport\fP [\fIimage\-name\fP] [\fIdest\-path\fP]
Exports image to dest path (use \- for stdout).
.TP
.B \fBimport\fP [\fIpath\fP] [\fIdest\-image\fP]
Creates a new image and imports its data from path (use \- for
stdin). The import operation will try to create sparse rbd images
if possible. For import from stdin, the sparsification unit is
the data block size of the destination image (1 << order).
.TP
.B \fBexport\-diff\fP [\fIimage\-name\fP] [\fIdest\-path\fP] [\-\-from\-snap \fIsnapname\fP]
Exports an incremental diff for an image to dest path (use \- for stdout). If
an initial snapshot is specified, only changes since that snapshot are included; otherwise,
any regions of the image that contain data are included. The end snapshot is specified
using the standard \-\-snap option or @snap syntax (see below). The image diff format includes
metadata about image size changes, and the start and end snapshots. It efficiently represents
discarded or \(aqzero\(aq regions of the image.
.TP
.B \fBimport\-diff\fP [\fIsrc\-path\fP] [\fIimage\-name\fP]
Imports an incremental diff of an image and applies it to the current image. If the diff
was generated relative to a start snapshot, we verify that snapshot already exists before
continuing. If there was an end snapshot we verify it does not already exist before
applying the changes, and create the snapshot when we are done.
.TP
.B \fBdiff\fP [\fIimage\-name\fP] [\-\-from\-snap \fIsnapname\fP]
Dump a list of byte extents in the image that have changed since the specified start
snapshot, or since the image was created. Each output line includes the starting offset
(in bytes), the length of the region (in bytes), and either \(aqzero\(aq or \(aqdata\(aq to indicate
whether the region is known to be zeros or may contain other data.
.TP
.B \fBcp\fP [\fIsrc\-image\fP] [\fIdest\-image\fP]
Copies the content of a src\-image into the newly created dest\-image.
dest\-image will have the same size, order, and image format as src\-image.
.TP
.B \fBmv\fP [\fIsrc\-image\fP] [\fIdest\-image\fP]
Renames an image. Note: rename across pools is not supported.
.TP
.B \fBsnap\fP ls [\fIimage\-name\fP]
Dumps the list of snapshots inside a specific image.
.TP
.B \fBsnap\fP create [\fIimage\-name\fP]
Creates a new snapshot. Requires the snapshot name parameter specified.
.TP
.B \fBsnap\fP rollback [\fIimage\-name\fP]
Rollback image content to snapshot. This will iterate through the entire blocks
array and update the data head content to the snapshotted version.
.TP
.B \fBsnap\fP rm [\fIimage\-name\fP]
Removes the specified snapshot.
.TP
.B \fBsnap\fP purge [\fIimage\-name\fP]
Removes all snapshots from an image.
.TP
.B \fBsnap\fP protect [\fIimage\-name\fP]
Protect a snapshot from deletion, so that clones can be made of it
(see \fIrbd clone\fP). Snapshots must be protected before clones are made;
protection implies that there exist dependent cloned children that
refer to this snapshot. \fIrbd clone\fP will fail on a nonprotected
snapshot.
.sp
This requires image format 2.
.TP
.B \fBsnap\fP unprotect [\fIimage\-name\fP]
Unprotect a snapshot from deletion (undo \fIsnap protect\fP). If cloned
children remain, \fIsnap unprotect\fP fails. (Note that clones may exist
in different pools than the parent snapshot.)
.sp
This requires image format 2.
.TP
.B \fBmap\fP [\fIimage\-name\fP] [\-o | \-\-options \fImap\-options\fP ] [\-\-read\-only]
Maps the specified image to a block device via the rbd kernel module.
.TP
.B \fBunmap\fP [\fIdevice\-path\fP]
Unmaps the block device that was mapped via the rbd kernel module.
.TP
.B \fBshowmapped\fP
Show the rbd images that are mapped via the rbd kernel module.
.TP
.B \fBlock\fP list [\fIimage\-name\fP]
Show locks held on the image. The first column is the locker
to use with the \fIlock remove\fP command.
.TP
.B \fBlock\fP add [\fIimage\-name\fP] [\fIlock\-id\fP]
Lock an image. The lock\-id is an arbitrary name for the user\(aqs
convenience. By default, this is an exclusive lock, meaning it
will fail if the image is already locked. The \-\-shared option
changes this behavior. Note that locking does not affect
any operation other than adding a lock. It does not
protect an image from being deleted.
.TP
.B \fBlock\fP remove [\fIimage\-name\fP] [\fIlock\-id\fP] [\fIlocker\fP]
Release a lock on an image. The lock id and locker are
as output by lock ls.
.TP
.B \fBbench\-write\fP [\fIimage\-name\fP] \-\-io\-size [\fIio\-size\-in\-bytes\fP] \-\-io\-threads [\fInum\-ios\-in\-flight\fP] \-\-io\-total [\fItotal\-bytes\-to\-write\fP]
Generate a series of sequential writes to the image and measure the
write throughput and latency. Defaults are: \-\-io\-size 4096, \-\-io\-threads 16,
\-\-io\-total 1GB
.UNINDENT
.SH IMAGE NAME
.sp
In addition to using the \-\-pool and the \-\-snap options, the image name can include both
the pool name and the snapshot name. The image name format is as follows:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[pool/]image\-name[@snap]
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Thus an image name that contains a slash character (\(aq/\(aq) requires specifying the pool
name explicitly.
.SH STRIPING
.sp
RBD images are striped over many objects, which are then stored by the
Ceph distributed object store (RADOS). As a result, read and write
requests for the image are distributed across many nodes in the
cluster, generally preventing any single node from becoming a
bottleneck when individual images get large or busy.
.sp
The striping is controlled by three parameters:
.INDENT 0.0
.TP
.B order
.TP
.B The size of objects we stripe over is a power of two, specifially 2^[*order*] bytes. The default
.TP
.B is 22, or 4 MB.
.UNINDENT
.INDENT 0.0
.TP
.B stripe_unit
.TP
.B Each [*stripe_unit*] contiguous bytes are stored adjacently in the same object, before we move on
.TP
.B to the next object.
.UNINDENT
.INDENT 0.0
.TP
.B stripe_count
.TP
.B After we write [*stripe_unit*] bytes to [*stripe_count*] objects, we loop back to the initial object
.TP
.B and write another stripe, until the object reaches its maximum size (as specified by [*order*]. At that
.TP
.B point, we move on to the next [*stripe_count*] objects.
.UNINDENT
.sp
By default, [\fIstripe_unit\fP] is the same as the object size and [\fIstripe_count\fP] is 1. Specifying a different
[\fIstripe_unit\fP] requires that the STRIPINGV2 feature be supported (added in Ceph v0.53) and format 2 images be
used.
.SH MAP OPTIONS
.sp
Most of these options are useful mainly for debugging and benchmarking. The
default values are set in the kernel and may therefore depend on the version of
the running kernel.
.INDENT 0.0
.IP \(bu 2
fsid=aaaaaaaa\-bbbb\-cccc\-dddd\-eeeeeeeeeeee \- FSID that should be assumed by
the client.
.IP \(bu 2
ip=a.b.c.d[:p] \- IP and, optionally, port the client should use.
.IP \(bu 2
share \- Enable sharing of client instances with other mappings (default).
.IP \(bu 2
noshare \- Disable sharing of client instances with other mappings.
.IP \(bu 2
crc \- Enable CRC32C checksumming for data writes (default).
.IP \(bu 2
nocrc \- Disable CRC32C checksumming for data writes.
.IP \(bu 2
osdkeepalive=x \- OSD keepalive timeout (default is 5 seconds).
.IP \(bu 2
osd_idle_ttl=x \- OSD idle TTL (default is 60 seconds).
.IP \(bu 2
rw \- Map the image read\-write (default).
.IP \(bu 2
ro \- Map the image read\-only. Equivalent to \-\-read\-only.
.UNINDENT
.SH EXAMPLES
.sp
To create a new rbd image that is 100 GB:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd \-p mypool create myimage \-\-size 102400
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
or alternatively:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd create mypool/myimage \-\-size 102400
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To use a non\-default object size (8 MB):
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd create mypool/myimage \-\-size 102400 \-\-order 23
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To delete an rbd image (be careful!):
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd rm mypool/myimage
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To create a new snapshot:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd snap create mypool/myimage@mysnap
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To create a copy\-on\-write clone of a protected snapshot:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd clone mypool/myimage@mysnap otherpool/cloneimage
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To see which clones of a snapshot exist:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd children mypool/myimage@mysnap
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To delete a snapshot:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd snap rm mypool/myimage@mysnap
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To map an image via the kernel with cephx enabled:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd map mypool/myimage \-\-id admin \-\-keyfile secretfile
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To unmap an image:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd unmap /dev/rbd0
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To create an image and a clone from it:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd import \-\-image\-format 2 image mypool/parent
rbd snap create \-\-snap snapname mypool/parent
rbd snap protect mypool/parent@snap
rbd clone mypool/parent@snap otherpool/child
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To create an image with a smaller stripe_unit (to better distribute small writes in some workloads):
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd \-p mypool create myimage \-\-size 102400 \-\-stripe\-unit 65536 \-\-stripe\-count 16
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To change an image from one image format to another, export it and then
import it as the desired image format:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd export mypool/myimage@snap /tmp/img
rbd import \-\-image\-format 2 /tmp/img mypool/myimage2
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To lock an image for exclusive use:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd lock add mypool/myimage mylockid
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To release a lock:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
rbd lock remove mypool/myimage mylockid client.2485
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AVAILABILITY
.sp
\fBrbd\fP is part of the Ceph distributed storage system. Please refer to
the Ceph documentation at \fI\%http://ceph.com/docs\fP for more information.
.SH SEE ALSO
.sp
\fBceph\fP(8),
\fBrados\fP(8)
.SH COPYRIGHT
2010-2014, Inktank Storage, Inc. and contributors. Licensed under Creative Commons BY-SA
.\" Generated by docutils manpage writer.
.