CephNotes

Some notes about Ceph
Laurent Barbe @SIB

LXC 2.0.0 First support for Ceph RBD

FYI, the first RBD support has been added to LXC commands.

Example :

# Install LXC 2.0.0 (ubuntu) :
$ add-apt-repository ppa:ubuntu-lxc/lxc-stable
$ apt-get update
$ apt-get install lxc

# Add a ceph pool for lxc bloc devices :
$ ceph osd pool create lxc 64 64

# To create the container, you only need to specify "rbd" backingstore :
$ lxc-create -n ctn1 -B rbd -t debian
/dev/rbd0
debootstrap est /usr/sbin/debootstrap
Checking cache download in /var/cache/lxc/debian/rootfs-jessie-amd64 ... 
Copying rootfs to /usr/lib/x86_64-linux-gnu/lxc...
Generation complete.
$ rbd showmapped 
id pool image snap device    
0  lxc  ctn1  -    /dev/rbd0

$ rbd -p lxc info ctn1
rbd image 'ctn1':
    size 1024 MB in 256 objects
    order 22 (4096 kB objects)
    block_name_prefix: rb.0.1217d.74b0dc51
    format: 1
$ lxc-start -n ctn1
$ lxc-attach -n ctn1
ctn1$ mount | grep ' / '
/dev/rbd/lxc/ctn1 on / type ext3 (rw,relatime,stripe=1024,data=ordered)
$ lxc-destroy -n ctn1
Removing image: 100% complete...done.
Destroyed container ctn1

Some options :

--rbdpool POOL   : will create the blockdevice in the pool named POOL, rather than the default, which is 'lxc'.

--rbdname RBDNAME : will create a blockdevice named RBDNAME rather than the default, which is the container name.

--fssize : Create a RBD of size SIZE * unit U (bBkKmMgGtT)

For example :

$ lxc-create -n ctn2 -B rbd -t debian --rbdpool=rbd --rbdname=lxc-ctn2 --fssize=2G

What is not yet done:

  • Persistence on reboot: (RBD can be optionally added to rbdmap file)
  • Snapshots
  • Params for authentication (user, keyring...)
  • Other rbd options (format, ...)

The release annoucement :

https://linuxcontainers.org/fr/lxc/news/#lxc-200-release-announcement-6th-of-april-2016

misc RBD, LXC

Comments