bcache not working as expected with ramdisk as cache deviceSSD as a read cache for FREQUENTLY read dataHow to...

Should the pagination be reset when changing the order?

Tips for remembering the order of parameters for ln?

Did slaves have slaves?

Is it safe to put a microwave in a walk-in closet?

Should I inform my future product owner that there is a good chance that a team member will leave the company soon?

Who are the people reviewing far more papers than they're submitting for review?

Is there any actual security benefit to restricting foreign IPs?

Why would a fighter use the afterburner and air brakes at the same time?

Lumens specs when buying a flashlight/torch. Why maglite has only 680lm but cheap ones have 900,000?

Could the Orion project pusher plate model be used for asteroid deflection?

Does rpcpassword need to be non-obvious in bitcoind?

Very lazy puppy

Secondary characters in character-study fiction

Carroll's interpretation of 1-forms

Delete empty subfolders, keep parent folder

What's the purpose of autocorrelation?

Simple way to decompose a lists in a certain way?

Which block cipher parameters should be kept secret?

Why do we need to use transistors when building an OR gate?

Cemented carbide swords - worth it?

Are lay articles good enough to be the main source of information for PhD research?

Minimum number of lines to draw 111 squares

What is the origin of the “clerics can create water” trope?

What are the end bytes of *.docx file format



bcache not working as expected with ramdisk as cache device


SSD as a read cache for FREQUENTLY read dataHow to remove cache device from bcache?Using multiple SSDs as cache devices with bcache?Change Linux Bcache device typeHow to restart a 'stopped' bcache device?correct method to corrupt super block in ext3 filesystem associated with drbdWhat is grinding my HDDs and how do I stop it?Cannot attach cache device to backing deviceAdd a backing device to an existing bcache deviceReplace Bcache Backing Device






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I was trying out bcache but i don't have an SSD so wanted to use free memory as a substitute. As ramdisk is listed in /proc/devices as block device i assumed this would work OK but with below simple test i can't get it working.



This is on Ubuntu 15.10 with latest 4.5 kernel installed and i'm using the default /dev/ram devices as my SSD substitute.



losetup -f
dd if=/dev/zero of=/tmp/bcache_origin bs=1M count=200
losetup /dev/loop2 /tmp/bcache_origin

make-bcache -B /dev/loop2 -C /dev/ram9


No error or output was given from make-bcache. At this point i expect for the new bcache device to be listed in below paths either by UUID or name but there is nothing.



ls -al /sys/fs/bcache/
ls -al /sys/block/bcache*


Here is outputs from cache-super-show



for cache



bcache-super-show /dev/ram9

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

dev.label (empty)
dev.uuid 2189aa3b-67e7-4296-bb25-6b5ba886befa
dev.sectors_per_block 1
dev.sectors_per_bucket 1024
dev.cache.first_sector 1024
dev.cache.cache_sectors 130048
dev.cache.total_sectors 131072
dev.cache.ordered no
dev.cache.discard no
dev.cache.pos 0
dev.cache.replacement 0 [lru]

cset.uuid 0a6b3824-72c1-489e-9d96-d976cb49e8a9


and origin



bcache-super-show /dev/loop2

sb.magic ok
sb.first_sector 8 [match]
sb.csum ECBC84E42E6F52B9 [match]
sb.version 1 [backing device]

dev.label (empty)
dev.uuid aff690a4-7ee1-4b62-85cc-ad41c775d7d8
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 0a6b3824-72c1-489e-9d96-d976cb49e8a9


I also tried using loop devices for both but that failed even worse. Running below command results in nasty kernel BUG dump in dmesg.



losetup -f
dd if=/dev/zero of=/tmp/bcache_data bs=1M count=200
dd if=/dev/zero of=/tmp/bcache_cache bs=1M count=200

losetup /dev/loop5 /tmp/bcache_data
losetup /dev/loop6 /tmp/bcache_cache
make-bcache -B /dev/loop5 -C /dev/loop6
ll /sys/fs/bcache/


Has anyone successfully got a ramdisk to work as caching device with bcache ? Without any sort of stdout/err to indicate where it's failing i'm not sure if this is my miss-configuration or a bug.



Thanks
fLo










share|improve this question















bumped to the homepage by Community 22 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.























    1















    I was trying out bcache but i don't have an SSD so wanted to use free memory as a substitute. As ramdisk is listed in /proc/devices as block device i assumed this would work OK but with below simple test i can't get it working.



    This is on Ubuntu 15.10 with latest 4.5 kernel installed and i'm using the default /dev/ram devices as my SSD substitute.



    losetup -f
    dd if=/dev/zero of=/tmp/bcache_origin bs=1M count=200
    losetup /dev/loop2 /tmp/bcache_origin

    make-bcache -B /dev/loop2 -C /dev/ram9


    No error or output was given from make-bcache. At this point i expect for the new bcache device to be listed in below paths either by UUID or name but there is nothing.



    ls -al /sys/fs/bcache/
    ls -al /sys/block/bcache*


    Here is outputs from cache-super-show



    for cache



    bcache-super-show /dev/ram9

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

    dev.label (empty)
    dev.uuid 2189aa3b-67e7-4296-bb25-6b5ba886befa
    dev.sectors_per_block 1
    dev.sectors_per_bucket 1024
    dev.cache.first_sector 1024
    dev.cache.cache_sectors 130048
    dev.cache.total_sectors 131072
    dev.cache.ordered no
    dev.cache.discard no
    dev.cache.pos 0
    dev.cache.replacement 0 [lru]

    cset.uuid 0a6b3824-72c1-489e-9d96-d976cb49e8a9


    and origin



    bcache-super-show /dev/loop2

    sb.magic ok
    sb.first_sector 8 [match]
    sb.csum ECBC84E42E6F52B9 [match]
    sb.version 1 [backing device]

    dev.label (empty)
    dev.uuid aff690a4-7ee1-4b62-85cc-ad41c775d7d8
    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 0a6b3824-72c1-489e-9d96-d976cb49e8a9


    I also tried using loop devices for both but that failed even worse. Running below command results in nasty kernel BUG dump in dmesg.



    losetup -f
    dd if=/dev/zero of=/tmp/bcache_data bs=1M count=200
    dd if=/dev/zero of=/tmp/bcache_cache bs=1M count=200

    losetup /dev/loop5 /tmp/bcache_data
    losetup /dev/loop6 /tmp/bcache_cache
    make-bcache -B /dev/loop5 -C /dev/loop6
    ll /sys/fs/bcache/


    Has anyone successfully got a ramdisk to work as caching device with bcache ? Without any sort of stdout/err to indicate where it's failing i'm not sure if this is my miss-configuration or a bug.



    Thanks
    fLo










    share|improve this question















    bumped to the homepage by Community 22 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.



















      1












      1








      1








      I was trying out bcache but i don't have an SSD so wanted to use free memory as a substitute. As ramdisk is listed in /proc/devices as block device i assumed this would work OK but with below simple test i can't get it working.



      This is on Ubuntu 15.10 with latest 4.5 kernel installed and i'm using the default /dev/ram devices as my SSD substitute.



      losetup -f
      dd if=/dev/zero of=/tmp/bcache_origin bs=1M count=200
      losetup /dev/loop2 /tmp/bcache_origin

      make-bcache -B /dev/loop2 -C /dev/ram9


      No error or output was given from make-bcache. At this point i expect for the new bcache device to be listed in below paths either by UUID or name but there is nothing.



      ls -al /sys/fs/bcache/
      ls -al /sys/block/bcache*


      Here is outputs from cache-super-show



      for cache



      bcache-super-show /dev/ram9

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

      dev.label (empty)
      dev.uuid 2189aa3b-67e7-4296-bb25-6b5ba886befa
      dev.sectors_per_block 1
      dev.sectors_per_bucket 1024
      dev.cache.first_sector 1024
      dev.cache.cache_sectors 130048
      dev.cache.total_sectors 131072
      dev.cache.ordered no
      dev.cache.discard no
      dev.cache.pos 0
      dev.cache.replacement 0 [lru]

      cset.uuid 0a6b3824-72c1-489e-9d96-d976cb49e8a9


      and origin



      bcache-super-show /dev/loop2

      sb.magic ok
      sb.first_sector 8 [match]
      sb.csum ECBC84E42E6F52B9 [match]
      sb.version 1 [backing device]

      dev.label (empty)
      dev.uuid aff690a4-7ee1-4b62-85cc-ad41c775d7d8
      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 0a6b3824-72c1-489e-9d96-d976cb49e8a9


      I also tried using loop devices for both but that failed even worse. Running below command results in nasty kernel BUG dump in dmesg.



      losetup -f
      dd if=/dev/zero of=/tmp/bcache_data bs=1M count=200
      dd if=/dev/zero of=/tmp/bcache_cache bs=1M count=200

      losetup /dev/loop5 /tmp/bcache_data
      losetup /dev/loop6 /tmp/bcache_cache
      make-bcache -B /dev/loop5 -C /dev/loop6
      ll /sys/fs/bcache/


      Has anyone successfully got a ramdisk to work as caching device with bcache ? Without any sort of stdout/err to indicate where it's failing i'm not sure if this is my miss-configuration or a bug.



      Thanks
      fLo










      share|improve this question














      I was trying out bcache but i don't have an SSD so wanted to use free memory as a substitute. As ramdisk is listed in /proc/devices as block device i assumed this would work OK but with below simple test i can't get it working.



      This is on Ubuntu 15.10 with latest 4.5 kernel installed and i'm using the default /dev/ram devices as my SSD substitute.



      losetup -f
      dd if=/dev/zero of=/tmp/bcache_origin bs=1M count=200
      losetup /dev/loop2 /tmp/bcache_origin

      make-bcache -B /dev/loop2 -C /dev/ram9


      No error or output was given from make-bcache. At this point i expect for the new bcache device to be listed in below paths either by UUID or name but there is nothing.



      ls -al /sys/fs/bcache/
      ls -al /sys/block/bcache*


      Here is outputs from cache-super-show



      for cache



      bcache-super-show /dev/ram9

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

      dev.label (empty)
      dev.uuid 2189aa3b-67e7-4296-bb25-6b5ba886befa
      dev.sectors_per_block 1
      dev.sectors_per_bucket 1024
      dev.cache.first_sector 1024
      dev.cache.cache_sectors 130048
      dev.cache.total_sectors 131072
      dev.cache.ordered no
      dev.cache.discard no
      dev.cache.pos 0
      dev.cache.replacement 0 [lru]

      cset.uuid 0a6b3824-72c1-489e-9d96-d976cb49e8a9


      and origin



      bcache-super-show /dev/loop2

      sb.magic ok
      sb.first_sector 8 [match]
      sb.csum ECBC84E42E6F52B9 [match]
      sb.version 1 [backing device]

      dev.label (empty)
      dev.uuid aff690a4-7ee1-4b62-85cc-ad41c775d7d8
      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 0a6b3824-72c1-489e-9d96-d976cb49e8a9


      I also tried using loop devices for both but that failed even worse. Running below command results in nasty kernel BUG dump in dmesg.



      losetup -f
      dd if=/dev/zero of=/tmp/bcache_data bs=1M count=200
      dd if=/dev/zero of=/tmp/bcache_cache bs=1M count=200

      losetup /dev/loop5 /tmp/bcache_data
      losetup /dev/loop6 /tmp/bcache_cache
      make-bcache -B /dev/loop5 -C /dev/loop6
      ll /sys/fs/bcache/


      Has anyone successfully got a ramdisk to work as caching device with bcache ? Without any sort of stdout/err to indicate where it's failing i'm not sure if this is my miss-configuration or a bug.



      Thanks
      fLo







      kernel lvm cache storage bcache






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 17 '16 at 9:18









      Flo WooFlo Woo

      1481 silver badge5 bronze badges




      1481 silver badge5 bronze badges






      bumped to the homepage by Community 22 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.









      bumped to the homepage by Community 22 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 22 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0
















          some devices need to be registered in order to be used



          after making the cache devices with



          # make-bcache -B /dev/loop2 -C /dev/ram9 


          you need to register both (at least the ramdisk though, loop devices and harddisks seem to autoregister most of the time) with



          # echo /dev/ram9 >/sys/fs/bcache/register


          the uuid enry in /sys/fs/bcache should then show up and the device should be automatically attached as visible in



          # cat /sys/block/bcache0/bcache/state 
          clean


          if you make-bcache the cache and backing device separately with



          # make-bcache -B /dev/loop2
          # make-bcache -C /dev/ram9


          this is not the case and even after you register the ram disk, it will say



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


          although the entry in /sys/fs/bcache will show up:



          # ls /sys/fs/bcache
          f876ea9b-af2c-4b01-84ba-43a87d60501c register register_quiet


          you then need to attach it with



          # echo f876ea9b-af2c-4b01-84ba-43a87d60501c >/sys/block/bcache0/bcache/attach
          # cat /sys/block/bcache0/bcache/state
          clean


          tricky pitfall: once attached to a bcache, you cannot remove the loop device with



          # losetup -d /dev/loop2


          this will fail silently, even though the exit code is 0 (success!)



          you need to first undo everything with



          # echo 1 >/sys/block/bcache0/bcache/stop
          # echo 1 >/sys/fs/bcache/f876ea9b-af2c-4b01-84ba-43a87d60501c/unregister





          share|improve this answer




























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });















            draft saved

            draft discarded
















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f263776%2fbcache-not-working-as-expected-with-ramdisk-as-cache-device%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0
















            some devices need to be registered in order to be used



            after making the cache devices with



            # make-bcache -B /dev/loop2 -C /dev/ram9 


            you need to register both (at least the ramdisk though, loop devices and harddisks seem to autoregister most of the time) with



            # echo /dev/ram9 >/sys/fs/bcache/register


            the uuid enry in /sys/fs/bcache should then show up and the device should be automatically attached as visible in



            # cat /sys/block/bcache0/bcache/state 
            clean


            if you make-bcache the cache and backing device separately with



            # make-bcache -B /dev/loop2
            # make-bcache -C /dev/ram9


            this is not the case and even after you register the ram disk, it will say



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


            although the entry in /sys/fs/bcache will show up:



            # ls /sys/fs/bcache
            f876ea9b-af2c-4b01-84ba-43a87d60501c register register_quiet


            you then need to attach it with



            # echo f876ea9b-af2c-4b01-84ba-43a87d60501c >/sys/block/bcache0/bcache/attach
            # cat /sys/block/bcache0/bcache/state
            clean


            tricky pitfall: once attached to a bcache, you cannot remove the loop device with



            # losetup -d /dev/loop2


            this will fail silently, even though the exit code is 0 (success!)



            you need to first undo everything with



            # echo 1 >/sys/block/bcache0/bcache/stop
            # echo 1 >/sys/fs/bcache/f876ea9b-af2c-4b01-84ba-43a87d60501c/unregister





            share|improve this answer






























              0
















              some devices need to be registered in order to be used



              after making the cache devices with



              # make-bcache -B /dev/loop2 -C /dev/ram9 


              you need to register both (at least the ramdisk though, loop devices and harddisks seem to autoregister most of the time) with



              # echo /dev/ram9 >/sys/fs/bcache/register


              the uuid enry in /sys/fs/bcache should then show up and the device should be automatically attached as visible in



              # cat /sys/block/bcache0/bcache/state 
              clean


              if you make-bcache the cache and backing device separately with



              # make-bcache -B /dev/loop2
              # make-bcache -C /dev/ram9


              this is not the case and even after you register the ram disk, it will say



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


              although the entry in /sys/fs/bcache will show up:



              # ls /sys/fs/bcache
              f876ea9b-af2c-4b01-84ba-43a87d60501c register register_quiet


              you then need to attach it with



              # echo f876ea9b-af2c-4b01-84ba-43a87d60501c >/sys/block/bcache0/bcache/attach
              # cat /sys/block/bcache0/bcache/state
              clean


              tricky pitfall: once attached to a bcache, you cannot remove the loop device with



              # losetup -d /dev/loop2


              this will fail silently, even though the exit code is 0 (success!)



              you need to first undo everything with



              # echo 1 >/sys/block/bcache0/bcache/stop
              # echo 1 >/sys/fs/bcache/f876ea9b-af2c-4b01-84ba-43a87d60501c/unregister





              share|improve this answer




























                0














                0










                0









                some devices need to be registered in order to be used



                after making the cache devices with



                # make-bcache -B /dev/loop2 -C /dev/ram9 


                you need to register both (at least the ramdisk though, loop devices and harddisks seem to autoregister most of the time) with



                # echo /dev/ram9 >/sys/fs/bcache/register


                the uuid enry in /sys/fs/bcache should then show up and the device should be automatically attached as visible in



                # cat /sys/block/bcache0/bcache/state 
                clean


                if you make-bcache the cache and backing device separately with



                # make-bcache -B /dev/loop2
                # make-bcache -C /dev/ram9


                this is not the case and even after you register the ram disk, it will say



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


                although the entry in /sys/fs/bcache will show up:



                # ls /sys/fs/bcache
                f876ea9b-af2c-4b01-84ba-43a87d60501c register register_quiet


                you then need to attach it with



                # echo f876ea9b-af2c-4b01-84ba-43a87d60501c >/sys/block/bcache0/bcache/attach
                # cat /sys/block/bcache0/bcache/state
                clean


                tricky pitfall: once attached to a bcache, you cannot remove the loop device with



                # losetup -d /dev/loop2


                this will fail silently, even though the exit code is 0 (success!)



                you need to first undo everything with



                # echo 1 >/sys/block/bcache0/bcache/stop
                # echo 1 >/sys/fs/bcache/f876ea9b-af2c-4b01-84ba-43a87d60501c/unregister





                share|improve this answer













                some devices need to be registered in order to be used



                after making the cache devices with



                # make-bcache -B /dev/loop2 -C /dev/ram9 


                you need to register both (at least the ramdisk though, loop devices and harddisks seem to autoregister most of the time) with



                # echo /dev/ram9 >/sys/fs/bcache/register


                the uuid enry in /sys/fs/bcache should then show up and the device should be automatically attached as visible in



                # cat /sys/block/bcache0/bcache/state 
                clean


                if you make-bcache the cache and backing device separately with



                # make-bcache -B /dev/loop2
                # make-bcache -C /dev/ram9


                this is not the case and even after you register the ram disk, it will say



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


                although the entry in /sys/fs/bcache will show up:



                # ls /sys/fs/bcache
                f876ea9b-af2c-4b01-84ba-43a87d60501c register register_quiet


                you then need to attach it with



                # echo f876ea9b-af2c-4b01-84ba-43a87d60501c >/sys/block/bcache0/bcache/attach
                # cat /sys/block/bcache0/bcache/state
                clean


                tricky pitfall: once attached to a bcache, you cannot remove the loop device with



                # losetup -d /dev/loop2


                this will fail silently, even though the exit code is 0 (success!)



                you need to first undo everything with



                # echo 1 >/sys/block/bcache0/bcache/stop
                # echo 1 >/sys/fs/bcache/f876ea9b-af2c-4b01-84ba-43a87d60501c/unregister






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 2 at 22:35









                CorvusCoraxCorvusCorax

                1




                1


































                    draft saved

                    draft discarded



















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f263776%2fbcache-not-working-as-expected-with-ramdisk-as-cache-device%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

                    The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

                    Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...