Ubuntu 26.04

Ceph Tentacle : Use Block Device2026/04/27

 

Configure a Client Host [dlp] to use Ceph Storage like follows.

                                         |
        +--------------------+           |
        |   [dlp.srv.world]  |10.0.0.30  |
        |     Ceph Client    +-----------+
        |                    |           |
        +--------------------+           |
            +----------------------------+----------------------------+
            |                            |                            |
            |10.0.0.51                   |10.0.0.52                   |10.0.0.53 
+-----------+-----------+    +-----------+-----------+    +-----------+-----------+
|   [node01.srv.world]  |    |   [node02.srv.world]  |    |   [node03.srv.world]  |
|     Object Storage    +----+     Object Storage    +----+     Object Storage    |
|     Monitor Daemon    |    |                       |    |                       |
|     Manager Daemon    |    |                       |    |                       |
+-----------------------+    +-----------------------+    +-----------------------+

 
For example, Create a block device and mount it on a Client Host.
[1] Transfer SSH public key to Client Host and Configure it from Admin Node.
# transfer public key

root@node01:~#
ssh-copy-id dlp

# install required packages

root@node01:~#
ssh dlp "apt -y install ceph-common"
# transfer required files to Client Host

root@node01:~#
scp /etc/ceph/ceph.conf dlp:/etc/ceph/

ceph.conf                                     100%  273   150.3KB/s   00:00
root@node01:~#
scp /etc/ceph/ceph.client.admin.keyring dlp:/etc/ceph/

ceph.client.admin.keyring                     100%  151    82.6KB/s   00:00
root@node01:~#
ssh dlp "chown ceph:ceph /etc/ceph/ceph.*"

[2] Create a Block device and mount it on a Client Host.
# create default RBD pool [rbd]

root@dlp:~#
ceph osd pool create rbd 32

pool 'rbd' created
# enable Placement Groups auto scale mode

root@dlp:~#
ceph osd pool set rbd pg_autoscale_mode on

set pool 2 pg_autoscale_mode to on
# initialize the pool

root@dlp:~#
rbd pool init rbd

root@dlp:~#
ceph osd pool autoscale-status

POOL    SIZE  TARGET SIZE  RATE  RAW CAPACITY   RATIO  TARGET RATIO  EFFECTIVE RATIO  BIAS  PG_NUM  NEW PG_NUM  AUTOSCALE  BULK 
.mgr  452.0k                3.0        479.9G  0.0000                                  1.0       1              on         False
rbd       0                 3.0        479.9G  0.0000                                  1.0      32              on         False

# create a block device with 10G

root@dlp:~#
rbd create --size 10G --pool rbd rbd01
# confirm

root@dlp:~#
rbd ls -l

NAME   SIZE    PARENT  FMT  PROT  LOCK
rbd01  10 GiB            2

# map the block device

root@dlp:~#
rbd map rbd01

/dev/rbd0
# confirm

root@dlp:~#
rbd showmapped

id  pool  namespace  image  snap  device
0   rbd              rbd01  -     /dev/rbd0

# format with EXT4

root@dlp:~#
mkfs.ext4 /dev/rbd0

mke2fs 1.47.2 (1-Jan-2025)
Discarding device blocks: done
Creating filesystem with 2621440 4k blocks and 655360 inodes
Filesystem UUID: 9095153e-9ab0-41ed-bdd8-23dd8ef830fe
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

root@dlp:~#
mount /dev/rbd0 /mnt

root@dlp:~#
df -hT

Filesystem                        Type   Size  Used Avail Use% Mounted on
tmpfs                             tmpfs  680M  1.1M  679M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4    14G  5.8G  7.3G  45% /
tmpfs                             tmpfs  1.7G     0  1.7G   0% /dev/shm
none                              tmpfs  1.0M     0  1.0M   0% /run/credentials/systemd-journald.service
none                              tmpfs  1.0M     0  1.0M   0% /run/credentials/systemd-resolved.service
tmpfs                             tmpfs  1.7G     0  1.7G   0% /tmp
/dev/vda2                         ext4   2.0G   96M  1.7G   6% /boot
none                              tmpfs  1.0M     0  1.0M   0% /run/credentials/systemd-networkd.service
none                              tmpfs  1.0M     0  1.0M   0% /run/credentials/getty@tty1.service
none                              tmpfs  1.0M     0  1.0M   0% /run/credentials/serial-getty@ttyS0.service
tmpfs                             tmpfs  340M  8.0K  340M   1% /run/user/0
/dev/rbd0                         ext4   9.8G  2.1M  9.3G   1% /mnt
[3] For delete Block devices or Pools you created, run commands like follows.
For deleting Pools, it needs to set [mon allow pool delete = true] on [Monitor Daemon] configuration.
# unmap

root@dlp:~#
rbd unmap /dev/rbd/rbd/rbd01
# delete a block device

root@dlp:~#
rbd rm rbd01 -p rbd

Removing image: 100% complete...done.
# delete a pool
# ceph osd pool delete [Pool Name] [Pool Name] ***

root@dlp:~#
ceph osd pool delete rbd rbd --yes-i-really-really-mean-it

pool 'rbd' removed
Matched Content