Now that we have created a block device on a Ceph cluster, in order to use this block device, we need to map it to the client machine. To do this, execute the following commands from the client-node1
machine.
Map the block device to the
client-node1
:# rbd map --image rbd1 --name client.rbd
Check the mapped block device:
# rbd showmapped --name client.rbd
To make use of this block device, we should create a filesystem on this and mount it:
# fdisk -l /dev/rbd1 # mkfs.xfs /dev/rbd1 # mkdir /mnt/ceph-disk1 # mount /dev/rbd1 /mnt/ceph-disk1 # df -h /mnt/ceph-disk1
Test the block device by writing data to it:
# dd if=/dev/zero of=/mnt/ceph-disk1/file1 count=100 bs=1M
To map the block device across reboots, you should add
init-rbdmap
script to the system startup, add the Ceph user and keyring details to/etc/ceph/rbdmap
, and finally, update the/etc/fstab
file:# wget https://raw.githubusercontent.com/ksingh7/ceph-cookbook/master/rbdmap -O /etc/init.d/rbdmap...