Ceph: collect Kernel RBD logs

Quick tip to collect Kernel RBD logs.

Make sure your kernel is compiled with CONFIG_DYNAMIC_DEBUG (and CONFIG_DEBUG_FS) enabled:

$ sudo cat /boot/config-`uname -r` | grep DYNAMIC_DEBUG

Then mount debugfs:

$ sudo mount -t debugfs none /sys/kernel/debug

Set the console log level to 9:

$ sudo echo 9 > /proc/sysrq-trigger

Then chose the module that you want to log:

$ sudo echo 'module rbd +p' | sudo tee -a /sys/kernel/debug/dynamic_debug/control

Looking at dmesg will show the corresponding logs. You can use this script from the Ceph repo as well to enable all of them:

#!/bin/sh -x

p() {
echo "$*" > /sys/kernel/debug/dynamic_debug/control

echo 9 > /proc/sysrq-trigger
p 'module ceph +p'
p 'module libceph +p'
p 'module rbd +p'