Ceph- list object in a RADOS block device

1.8k views Asked by At

My question is quiet simple: is it possible to list files that are in a block device?

For instance, if a create a new pool :

ceph osd pool create myPool

and inside this pool I add a RADOS block device :

rbd create myBLock -p myPool --size 1024

On a ceph-client I do:

sudo rbd map myBlock -p myPool

sudo mkfs.ext4 -m0 /dev/rbd/rbd/myBlock

sudo mkdir /mnt/ceph-block-device

sudo mount /dev/rbd/rbd/myBlock /mnt/ceph-block-device

cd /mnt/ceph-block-device

I put some files in the block

touch myfile.txt

touch hello.txt

How on a osd/mon node can I see thoses files and where they are stored? I know that :

ceph osd map -p myPool object1 works perfectly, but How can I see the complete list inside the pool myPool?

Regards,

Ghislain

1

There are 1 answers

0
Vladimir Bashkirtsev On

Short answer: you cannot

Long answer: there no concept of "file" in RADOS block device. It is called "block device" for a reason - it keeps just bunch of consecutive blocks with data. What is inside of these blocks is not a concern for a block device. That's your file system driver job to represent these blocks with data as a "file system" you can browse through. In your case "mkfs.ext4 -m0 /dev/rbd/rbd/myBlock" creates ext4 file system on top of the RBD. And only when you do "mount /dev/rbd/rbd/myBlock /mnt/ceph-block-device" you instruct the system to treat RBD as a file system. Take it away and your file system is no more than just a sequence of blocks with bytes in them.

It is similar to having a file system on a normal hard drive. Get a new hard drive, create a partition, format a file system as ext4, write some files, take the hard drive to the system which does not support ext4 and ask yourself the question "How on a can I see thoses files and where they are stored?" and the answer will be the short answer above: "you cannot"