1

I was trying to simulate a scenario with mdadm and bcache. I created 4 raw img files using qemu-img. I have created raid 10 using mdadm and created tmpfs on /mnt/ramdisk and created a raw ramdisk.img file on ramdisk. Tried to connect ramdisk.img and other 4 mdadm raid10 img files using bcache...

It looks like this.

loop0           7:0    0   512M  0 loop   
└─md0           9:0    0  1020M  0 raid10 
  └─md0p1     259:0    0  1018M  0 md     
    └─bcache0 252:0    0  1018M  0 disk   /media/gediz/vmbcache
loop1           7:1    0   512M  0 loop   
└─md0           9:0    0  1020M  0 raid10 
  └─md0p1     259:0    0  1018M  0 md     
    └─bcache0 252:0    0  1018M  0 disk   /media/gediz/vmbcache
loop2           7:2    0   512M  0 loop   
└─md0           9:0    0  1020M  0 raid10 
  └─md0p1     259:0    0  1018M  0 md     
    └─bcache0 252:0    0  1018M  0 disk   /media/gediz/vmbcache
loop3           7:3    0   512M  0 loop   
└─md0           9:0    0  1020M  0 raid10 
  └─md0p1     259:0    0  1018M  0 md     
    └─bcache0 252:0    0  1018M  0 disk   /media/gediz/vmbcache
loop101         7:101  0   255M  0 loop   
└─loop101p1   259:1    0   228M  0 loop   

mdadm stat:

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid10 loop3[3] loop2[2] loop1[1] loop0[0]
      1044480 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]

Backing superblock:

bcache-super-show /dev/md0p1 
sb.magic        ok
sb.first_sector     8 [match]
sb.csum         51E3C78C7BED1DBF [match]
sb.version      1 [backing device]

dev.label       (empty)
dev.uuid        bb01d667-c8bf-442e-994b-94c108864cf5
dev.sectors_per_block   1
dev.sectors_per_bucket  1024
dev.data.first_sector   16
dev.data.cache_mode 0 [writethrough]
dev.data.cache_state    0 [detached]

cset.uuid       acd29060-d604-4441-961a-413ce85cc604

Cache superblock :

sb.magic        ok
sb.first_sector     8 [match]
sb.csum         D66FD05126FF5088 [match]
sb.version      0 [cache device]

dev.label       (empty)
dev.uuid        774d0fab-82ab-4825-ba19-43a83e4b4f53
dev.sectors_per_block   1
dev.sectors_per_bucket  1024
dev.cache.first_sector  1024
dev.cache.cache_sectors 465920
dev.cache.total_sectors 466944
dev.cache.ordered   no
dev.cache.discard   no
dev.cache.pos       0
dev.cache.replacement   0 [lru]

cset.uuid       f3c837cb-a743-4615-9a7f-4f647d603eaf

I have first tried with make-bcache -B /dev/md0 -C /dev/loop101 feeling sure that it will work without p1 partitions and it did not work with raw devices. Then I have created gpt partitions and formatted backing disk to ext4 left cache disk w/o formatting (as a guide states) and tried to attached didn't worked either ...

# echo f3c837cb-a743-4615-9a7f-4f647d603eaf > /sys/block/bcache0/bcache/attach
-bash: echo: write error: No such file or directory

And the state is:

# cat /sys/block/bcache0/bcache/state
no cache

It is deatached and cannot be attached ...

What did I do wrong ?

My aim is to simulate raid 10 array formed from virtual disks with ramdisk cache using mdadm and bcache.

Thank You.

Gediz GÜRSU
  • 452
  • 3
  • 7

0 Answers0