Before you can add a block device to a node, you must create an image for it in the Ceph Storage Cluster first. To create a block device image, execute the following:
Код: Выделить всё
rbd create {image-name} --size {megabytes} --pool {pool-name}
For example, to create a 1GB image named bar that stores information in a pool named swimmingpool, execute the following:
Код: Выделить всё
rbd create bar --size 1024 --pool swimmingpool
If you don’t specify pool when creating an image, it will be stored in the default pool rbd. For example, to create a 1GB image named foo stored in the default pool rbd, execute the following:
Код: Выделить всё
rbd create foo --size 1024
Listing Block Device Images
To list block devices in the rbd pool, execute the following (i.e., rbd is the default pool name):
Код: Выделить всё
rbd ls
To list block devices in a particular pool, execute the following, but replace {poolname} with the name of the pool:
Код: Выделить всё
rbd ls {poolname}
For example:
Код: Выделить всё
rbd ls swimmingpool
Retrieving Image Information
To retrieve information from a particular image, execute the following, but replace {image-name} with the name for the image:
Код: Выделить всё
rbd --image {image-name} info
For example:
Код: Выделить всё
rbd --image foo info
To retrieve information from an image within a pool, execute the following, but replace {image-name} with the name of the image and replace {pool-name} with the name of the pool:
rbd --image {image-name} -p {pool-name} info
For example:
rbd --image bar -p swimmingpool info
Resizing a Block Device Image
Ceph Block Device images are thin provisioned. They don’t actually use any physical storage until you begin saving data to them. However, they do have a maximum capacity that you set with the --size option. If you want to increase (or decrease) the maximum size of a Ceph Block Device image, execute the following:
Код: Выделить всё
rbd resize --image foo --size 2048
Removing a Block Device Image
To remove a block device, execute the following, but replace {image-name} with the name of the image you want to remove:
Код: Выделить всё
rbd rm {image-name}
For example:
Код: Выделить всё
rbd rm foo
To remove a block device from a pool, execute the following, but replace {image-name} with the name of the image to remove and replace {pool-name} with the name of the pool:
Код: Выделить всё
rbd rm {image-name} -p {pool-name}
For example:
Код: Выделить всё
rbd rm bar -p swimmingpool