Use Ceph Block Device

Page content

Ceph block devices are thin-provisioned, resizable and store data striped over multiple OSDs in a Ceph cluster. Ceph block devices leverage RADOS capabilities such as snapshotting, replication and consistency. Ceph’s RADOS Block Devices (RBD) interact with OSDs using kernel modules or the librbd library.

Environment

192.168.1.31    ceph01
192.168.1.32    ceph02
192.168.1.33    ceph03

Install Client cli

ceph-deploy install client
ceph-deploy admin client

sudo chmod 644 /etc/ceph/ceph.client.admin.keyring

Basic Usage

# create pool
ceph osd pool create stack 64 64

# createdisk to pool
rbd create disk01 --size 10G --image-feature layering --pool stack --allow-shrink

# show list
rbd ls -l

# show info
rbd --image disk01 -p stack info

# resize
rbd resize --image disk01 -p stack --size 6G

# remove
rbd rm disk01 -p stack

# map the image to device
sudo rbd map disk01

# show mapping
rbd showmapped

# format with XFS
sudo mkfs.xfs /dev/rbd0

# mount device
sudo mount /dev/rbd0 /mnt
df -hT