Mapping Ceph Block Device

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.

How to do it…

  1. Map the block device to the client-node1:
    # rbd map --image rbd1 --name client.rbd
    
  2. Check the mapped block device:
    # rbd showmapped --name client.rbd
    
    How to do it…
  3. 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
  4. Test the block device by writing data to it:
    # dd ...

Get Ceph Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.