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}Код: Выделить всё
rbd create bar --size 1024 --pool swimmingpoolКод: Выделить всё
rbd create foo --size 1024To list block devices in the rbd pool, execute the following (i.e., rbd is the default pool name):
Код: Выделить всё
rbd lsКод: Выделить всё
rbd ls {poolname}Код: Выделить всё
rbd ls swimmingpoolTo retrieve information from a particular image, execute the following, but replace {image-name} with the name for the image:
Код: Выделить всё
rbd --image {image-name} infoКод: Выделить всё
rbd --image foo infoFor example:rbd --image {image-name} -p {pool-name} info
Resizing a Block Device Imagerbd --image bar -p swimmingpool info
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 2048To 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}Код: Выделить всё
rbd rm fooКод: Выделить всё
rbd rm {image-name} -p {pool-name}Код: Выделить всё
rbd rm bar -p swimmingpool