CephNotes

Some notes about Ceph
Laurent Barbe @CCM Benchmark

Don't Forget Unmap Before Remove Rbd

1
2
3
4
$ rbd rm rbd/myrbd
Removing image: 99% complete...failed.2013-08-02 14:07:17.530470 7f3ba2692760 -1 librbd: error removing header: (16) Device or resource busy
rbd: error: image still has watchers
This means the image is still open or the client using it crashed. Try again after closing/unmapping it or waiting 30s for the crashed client to timeout.
1
2
3
$ rbd showmapped
id pool image snap  device    
1  rbd  myrbd -     /dev/rbd1
1
2
3
4
5
6
$ service rbdmap stop
[ ok ] Stopping RBD Mapping: /dev/rbd1

$ rbd rm rbd/myrbd
Removing image: 100% complete...done.
$ vim /etc/ceph/rbdmap 

To know who is using rbd device you can use listwatchers :

Since Hammer

$ rbd status myrbd
Watchers:
    watcher=10.2.0.131:0/1013964 client.34453 cookie=1

Before Hammer

# Image format 1 :
# ----------------

$ rados -p rbd listwatchers myrbd.rbd
watcher=10.2.0.131:0/1013964 client.34453 cookie=1



# Image format 2 :
# ----------------

$ rbd info myrbd
rbd image 'myrbd':
        size 1024 TB in 268435456 objects
        order 22 (4096 kB objects)
        block_name_prefix: rbd_data.82072ae8944a
        format: 2
        features: layering

$ rados -p rbd listwatchers rbd_header.82072ae8944a
watcher=10.2.0.131:0/1013964 client.34453 cookie=1

Comments