Firstly create the RBD image by specifying the pool where you’d like to create the image, along with the size of the image:
rbd create your_pool_name/your_image_name --size 20GMap the created RBD image to a block device:
rbd map your_pool_name/your_image_nameFormat the block device with the ext4 filesystem:
mkfs.ext4 /dev/rbd/your_pool_name/your_image_nameCreate a directory to mount the block device to:
mkdir /mnt/rbd-mntMount the RBD image to the directory created above:
mount /dev/rbd/your_pool_name/your_image_name /mnt/rbd-mnt/You can now use the RBD image like any other mounted filesystem.
To unmap the mounted image:
rbd unmap /dev/rbd/your_pool_name/your_image_name