How do I mount an rbd device from fstab

According to this link:

http://docs.ceph.com/docs/master/start/quick-rbd/

I can mount an rbd, which works perfectly. The question I have is how do I do this from fstab?

The end goal being to mount it to /var/lib/mysql

I've only found examples for cephfs mounts but not rbd.


To answer my own question. Which I originally found the answer to here (just before Noah posted his link to the forums)

Basically the file rbdmap (which I'd seen but not realised it's significance before) is the key to getting it working.

Note: I'm using ceph-deploy. That may or may not be significant.

The init script /etc/init.d/rbdmap and /etc/ceph/rbdmap are the key's to it.

First you need to enable to the init script. Under Ubuntu/Debian this can be achieved with.

sudo update-rc.d rbdmap defaults

Then edit /etc/ceph/rbdmap and add rbd entries according to the format given. By default, the rbdmap file contains:

# RbdDevice     Parameters
#poolname/imagename id=client,keyring=/etc/ceph/ceph.client.keyring

Enter new entries in there.

For my mysql disk:

rbd/mysql   id=admin,keyring=/etc/ceph/ceph.client.admin.keyring

And my fstab file contains:

/dev/rbd/rbd/mysql /mnt/mysql-data  ext4    defaults,noatime,_netdev        0       0

This will be mounted at startup and unmounted at shutdown. The _netdev parameter specifies that the rbd device will not be mounted until the networking is started and initialized.