how to release device locked by bcache











up vote
0
down vote

favorite












Today I bought a 128MB SSD disk, installed it, then installed bcache-tools. After attempting to access the device I got these errors:



root@dev:/sys/block/sda/bcache# make-bcache -B /dev/sdb1 /dev/sdb1 -C /dev/sda
Can't open dev /dev/sda: Device or resource busy


root@dev:/sys/block/sda/bcache# fdisk /dev/sda

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

/dev/sda: device contains a valid 'bcache' signature; it is strongly recommended to wipe the device with wipefs(8) if this is unexpected, in order to avoid possible collisions

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xfef282bc.

Command (m for help): q

root@dev:/sys/block/sda/bcache# wipefs -a /dev/sda
wipefs: error: /dev/sda: probing initialization failed: Device or resource busy
root@dev:/sys/block/sda/bcache#


So I have the following questions:




  • Why did bcache started to use my SSD disk (/dev/sda) without even asking me for permission? That's a lot of disrespect to the authority.

  • How do I disable bcache so I can properly format the devices, they are not formatted yet.


This is the output of ls -l in bcache devices:



root@dev:/sys/block/sda/bcache# ls -l
total 0
-r--r--r-- 1 root root 4096 Apr 26 18:47 block_size
-r--r--r-- 1 root root 4096 Apr 26 18:47 btree_written
-r--r--r-- 1 root root 4096 Apr 26 18:47 bucket_size
-rw-r--r-- 1 root root 4096 Apr 26 18:47 cache_replacement_policy
--w------- 1 root root 4096 Apr 26 18:47 clear_stats
-rw-r--r-- 1 root root 4096 Apr 26 18:47 discard
-r--r--r-- 1 root root 4096 Apr 26 18:47 io_errors
-r--r--r-- 1 root root 4096 Apr 26 18:47 metadata_written
-r--r--r-- 1 root root 4096 Apr 26 18:47 nbuckets
-r--r--r-- 1 root root 4096 Apr 26 18:47 priority_stats
lrwxrwxrwx 1 root root 0 Apr 26 18:47 set -> ../../../../../../../../../../fs/bcache/b9d9517a-a606-4ac2-86dc-3399e9678381
-r--r--r-- 1 root root 4096 Apr 26 18:47 written
root@dev:/sys/block/sda/bcache# pwd
/sys/block/sda/bcache
root@dev:/sys/block/sda/bcache#


.



root@dev:/sys/fs/bcache# ls -l
total 0
drwxr-xr-x 7 root root 0 Apr 26 19:00 b9d9517a-a606-4ac2-86dc-3399e9678381
--w------- 1 root root 4096 Apr 26 19:00 register
--w------- 1 root root 4096 Apr 26 19:00 register_quiet
root@dev:/sys/fs/bcache#









share|improve this question


























    up vote
    0
    down vote

    favorite












    Today I bought a 128MB SSD disk, installed it, then installed bcache-tools. After attempting to access the device I got these errors:



    root@dev:/sys/block/sda/bcache# make-bcache -B /dev/sdb1 /dev/sdb1 -C /dev/sda
    Can't open dev /dev/sda: Device or resource busy


    root@dev:/sys/block/sda/bcache# fdisk /dev/sda

    Welcome to fdisk (util-linux 2.27.1).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.

    /dev/sda: device contains a valid 'bcache' signature; it is strongly recommended to wipe the device with wipefs(8) if this is unexpected, in order to avoid possible collisions

    Device does not contain a recognized partition table.
    Created a new DOS disklabel with disk identifier 0xfef282bc.

    Command (m for help): q

    root@dev:/sys/block/sda/bcache# wipefs -a /dev/sda
    wipefs: error: /dev/sda: probing initialization failed: Device or resource busy
    root@dev:/sys/block/sda/bcache#


    So I have the following questions:




    • Why did bcache started to use my SSD disk (/dev/sda) without even asking me for permission? That's a lot of disrespect to the authority.

    • How do I disable bcache so I can properly format the devices, they are not formatted yet.


    This is the output of ls -l in bcache devices:



    root@dev:/sys/block/sda/bcache# ls -l
    total 0
    -r--r--r-- 1 root root 4096 Apr 26 18:47 block_size
    -r--r--r-- 1 root root 4096 Apr 26 18:47 btree_written
    -r--r--r-- 1 root root 4096 Apr 26 18:47 bucket_size
    -rw-r--r-- 1 root root 4096 Apr 26 18:47 cache_replacement_policy
    --w------- 1 root root 4096 Apr 26 18:47 clear_stats
    -rw-r--r-- 1 root root 4096 Apr 26 18:47 discard
    -r--r--r-- 1 root root 4096 Apr 26 18:47 io_errors
    -r--r--r-- 1 root root 4096 Apr 26 18:47 metadata_written
    -r--r--r-- 1 root root 4096 Apr 26 18:47 nbuckets
    -r--r--r-- 1 root root 4096 Apr 26 18:47 priority_stats
    lrwxrwxrwx 1 root root 0 Apr 26 18:47 set -> ../../../../../../../../../../fs/bcache/b9d9517a-a606-4ac2-86dc-3399e9678381
    -r--r--r-- 1 root root 4096 Apr 26 18:47 written
    root@dev:/sys/block/sda/bcache# pwd
    /sys/block/sda/bcache
    root@dev:/sys/block/sda/bcache#


    .



    root@dev:/sys/fs/bcache# ls -l
    total 0
    drwxr-xr-x 7 root root 0 Apr 26 19:00 b9d9517a-a606-4ac2-86dc-3399e9678381
    --w------- 1 root root 4096 Apr 26 19:00 register
    --w------- 1 root root 4096 Apr 26 19:00 register_quiet
    root@dev:/sys/fs/bcache#









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Today I bought a 128MB SSD disk, installed it, then installed bcache-tools. After attempting to access the device I got these errors:



      root@dev:/sys/block/sda/bcache# make-bcache -B /dev/sdb1 /dev/sdb1 -C /dev/sda
      Can't open dev /dev/sda: Device or resource busy


      root@dev:/sys/block/sda/bcache# fdisk /dev/sda

      Welcome to fdisk (util-linux 2.27.1).
      Changes will remain in memory only, until you decide to write them.
      Be careful before using the write command.

      /dev/sda: device contains a valid 'bcache' signature; it is strongly recommended to wipe the device with wipefs(8) if this is unexpected, in order to avoid possible collisions

      Device does not contain a recognized partition table.
      Created a new DOS disklabel with disk identifier 0xfef282bc.

      Command (m for help): q

      root@dev:/sys/block/sda/bcache# wipefs -a /dev/sda
      wipefs: error: /dev/sda: probing initialization failed: Device or resource busy
      root@dev:/sys/block/sda/bcache#


      So I have the following questions:




      • Why did bcache started to use my SSD disk (/dev/sda) without even asking me for permission? That's a lot of disrespect to the authority.

      • How do I disable bcache so I can properly format the devices, they are not formatted yet.


      This is the output of ls -l in bcache devices:



      root@dev:/sys/block/sda/bcache# ls -l
      total 0
      -r--r--r-- 1 root root 4096 Apr 26 18:47 block_size
      -r--r--r-- 1 root root 4096 Apr 26 18:47 btree_written
      -r--r--r-- 1 root root 4096 Apr 26 18:47 bucket_size
      -rw-r--r-- 1 root root 4096 Apr 26 18:47 cache_replacement_policy
      --w------- 1 root root 4096 Apr 26 18:47 clear_stats
      -rw-r--r-- 1 root root 4096 Apr 26 18:47 discard
      -r--r--r-- 1 root root 4096 Apr 26 18:47 io_errors
      -r--r--r-- 1 root root 4096 Apr 26 18:47 metadata_written
      -r--r--r-- 1 root root 4096 Apr 26 18:47 nbuckets
      -r--r--r-- 1 root root 4096 Apr 26 18:47 priority_stats
      lrwxrwxrwx 1 root root 0 Apr 26 18:47 set -> ../../../../../../../../../../fs/bcache/b9d9517a-a606-4ac2-86dc-3399e9678381
      -r--r--r-- 1 root root 4096 Apr 26 18:47 written
      root@dev:/sys/block/sda/bcache# pwd
      /sys/block/sda/bcache
      root@dev:/sys/block/sda/bcache#


      .



      root@dev:/sys/fs/bcache# ls -l
      total 0
      drwxr-xr-x 7 root root 0 Apr 26 19:00 b9d9517a-a606-4ac2-86dc-3399e9678381
      --w------- 1 root root 4096 Apr 26 19:00 register
      --w------- 1 root root 4096 Apr 26 19:00 register_quiet
      root@dev:/sys/fs/bcache#









      share|improve this question













      Today I bought a 128MB SSD disk, installed it, then installed bcache-tools. After attempting to access the device I got these errors:



      root@dev:/sys/block/sda/bcache# make-bcache -B /dev/sdb1 /dev/sdb1 -C /dev/sda
      Can't open dev /dev/sda: Device or resource busy


      root@dev:/sys/block/sda/bcache# fdisk /dev/sda

      Welcome to fdisk (util-linux 2.27.1).
      Changes will remain in memory only, until you decide to write them.
      Be careful before using the write command.

      /dev/sda: device contains a valid 'bcache' signature; it is strongly recommended to wipe the device with wipefs(8) if this is unexpected, in order to avoid possible collisions

      Device does not contain a recognized partition table.
      Created a new DOS disklabel with disk identifier 0xfef282bc.

      Command (m for help): q

      root@dev:/sys/block/sda/bcache# wipefs -a /dev/sda
      wipefs: error: /dev/sda: probing initialization failed: Device or resource busy
      root@dev:/sys/block/sda/bcache#


      So I have the following questions:




      • Why did bcache started to use my SSD disk (/dev/sda) without even asking me for permission? That's a lot of disrespect to the authority.

      • How do I disable bcache so I can properly format the devices, they are not formatted yet.


      This is the output of ls -l in bcache devices:



      root@dev:/sys/block/sda/bcache# ls -l
      total 0
      -r--r--r-- 1 root root 4096 Apr 26 18:47 block_size
      -r--r--r-- 1 root root 4096 Apr 26 18:47 btree_written
      -r--r--r-- 1 root root 4096 Apr 26 18:47 bucket_size
      -rw-r--r-- 1 root root 4096 Apr 26 18:47 cache_replacement_policy
      --w------- 1 root root 4096 Apr 26 18:47 clear_stats
      -rw-r--r-- 1 root root 4096 Apr 26 18:47 discard
      -r--r--r-- 1 root root 4096 Apr 26 18:47 io_errors
      -r--r--r-- 1 root root 4096 Apr 26 18:47 metadata_written
      -r--r--r-- 1 root root 4096 Apr 26 18:47 nbuckets
      -r--r--r-- 1 root root 4096 Apr 26 18:47 priority_stats
      lrwxrwxrwx 1 root root 0 Apr 26 18:47 set -> ../../../../../../../../../../fs/bcache/b9d9517a-a606-4ac2-86dc-3399e9678381
      -r--r--r-- 1 root root 4096 Apr 26 18:47 written
      root@dev:/sys/block/sda/bcache# pwd
      /sys/block/sda/bcache
      root@dev:/sys/block/sda/bcache#


      .



      root@dev:/sys/fs/bcache# ls -l
      total 0
      drwxr-xr-x 7 root root 0 Apr 26 19:00 b9d9517a-a606-4ac2-86dc-3399e9678381
      --w------- 1 root root 4096 Apr 26 19:00 register
      --w------- 1 root root 4096 Apr 26 19:00 register_quiet
      root@dev:/sys/fs/bcache#






      bcache






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 27 at 0:05









      Nulik

      1187




      1187






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          bcache doesn't do this. Either the disk you purchased wasn't clean and already contained a bcache superblock upon unboxing (so it may be a returned drive that wasn't wiped properly), or the first command you ran was fishy: It has /dev/sdb1 twice on the command line which may have confused the command and it already created the superblock and attached /dev/sdb1.



          To get rid of it, detach the backing device:



          # echo 1 >/sys/block/sdb/sdb1/bcache/detach


          Then unregister the cache:



          # echo 1 >/sys/fs/bcache/b9d9517a-a606-4ac2-86dc-3399e9678381/unregister


          Now, instantly wipe it before udev reregisters it:



          # wipe -a /dev/sda


          Do not be confused that /dev/sdb1 still shows up as under control of bcache. It doesn't hurt and you can access it through /dev/bcache0. It's not attached to a cache and thus doesn't benefit from any caching, it works in pass-through mode until you re-attach it to a cache manually:



          # echo CACHE_SET_ID >/sys/block/sdb/sdb1/bcache/attach


          In that case, you create a cache device only, then attach any disk to it (with the above command following this one):



          # make-bcache -C CACHE_DEV





          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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/3.0/"u003ecc by-sa 3.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%2faskubuntu.com%2fquestions%2f1028573%2fhow-to-release-device-locked-by-bcache%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








            up vote
            0
            down vote













            bcache doesn't do this. Either the disk you purchased wasn't clean and already contained a bcache superblock upon unboxing (so it may be a returned drive that wasn't wiped properly), or the first command you ran was fishy: It has /dev/sdb1 twice on the command line which may have confused the command and it already created the superblock and attached /dev/sdb1.



            To get rid of it, detach the backing device:



            # echo 1 >/sys/block/sdb/sdb1/bcache/detach


            Then unregister the cache:



            # echo 1 >/sys/fs/bcache/b9d9517a-a606-4ac2-86dc-3399e9678381/unregister


            Now, instantly wipe it before udev reregisters it:



            # wipe -a /dev/sda


            Do not be confused that /dev/sdb1 still shows up as under control of bcache. It doesn't hurt and you can access it through /dev/bcache0. It's not attached to a cache and thus doesn't benefit from any caching, it works in pass-through mode until you re-attach it to a cache manually:



            # echo CACHE_SET_ID >/sys/block/sdb/sdb1/bcache/attach


            In that case, you create a cache device only, then attach any disk to it (with the above command following this one):



            # make-bcache -C CACHE_DEV





            share|improve this answer

























              up vote
              0
              down vote













              bcache doesn't do this. Either the disk you purchased wasn't clean and already contained a bcache superblock upon unboxing (so it may be a returned drive that wasn't wiped properly), or the first command you ran was fishy: It has /dev/sdb1 twice on the command line which may have confused the command and it already created the superblock and attached /dev/sdb1.



              To get rid of it, detach the backing device:



              # echo 1 >/sys/block/sdb/sdb1/bcache/detach


              Then unregister the cache:



              # echo 1 >/sys/fs/bcache/b9d9517a-a606-4ac2-86dc-3399e9678381/unregister


              Now, instantly wipe it before udev reregisters it:



              # wipe -a /dev/sda


              Do not be confused that /dev/sdb1 still shows up as under control of bcache. It doesn't hurt and you can access it through /dev/bcache0. It's not attached to a cache and thus doesn't benefit from any caching, it works in pass-through mode until you re-attach it to a cache manually:



              # echo CACHE_SET_ID >/sys/block/sdb/sdb1/bcache/attach


              In that case, you create a cache device only, then attach any disk to it (with the above command following this one):



              # make-bcache -C CACHE_DEV





              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                bcache doesn't do this. Either the disk you purchased wasn't clean and already contained a bcache superblock upon unboxing (so it may be a returned drive that wasn't wiped properly), or the first command you ran was fishy: It has /dev/sdb1 twice on the command line which may have confused the command and it already created the superblock and attached /dev/sdb1.



                To get rid of it, detach the backing device:



                # echo 1 >/sys/block/sdb/sdb1/bcache/detach


                Then unregister the cache:



                # echo 1 >/sys/fs/bcache/b9d9517a-a606-4ac2-86dc-3399e9678381/unregister


                Now, instantly wipe it before udev reregisters it:



                # wipe -a /dev/sda


                Do not be confused that /dev/sdb1 still shows up as under control of bcache. It doesn't hurt and you can access it through /dev/bcache0. It's not attached to a cache and thus doesn't benefit from any caching, it works in pass-through mode until you re-attach it to a cache manually:



                # echo CACHE_SET_ID >/sys/block/sdb/sdb1/bcache/attach


                In that case, you create a cache device only, then attach any disk to it (with the above command following this one):



                # make-bcache -C CACHE_DEV





                share|improve this answer












                bcache doesn't do this. Either the disk you purchased wasn't clean and already contained a bcache superblock upon unboxing (so it may be a returned drive that wasn't wiped properly), or the first command you ran was fishy: It has /dev/sdb1 twice on the command line which may have confused the command and it already created the superblock and attached /dev/sdb1.



                To get rid of it, detach the backing device:



                # echo 1 >/sys/block/sdb/sdb1/bcache/detach


                Then unregister the cache:



                # echo 1 >/sys/fs/bcache/b9d9517a-a606-4ac2-86dc-3399e9678381/unregister


                Now, instantly wipe it before udev reregisters it:



                # wipe -a /dev/sda


                Do not be confused that /dev/sdb1 still shows up as under control of bcache. It doesn't hurt and you can access it through /dev/bcache0. It's not attached to a cache and thus doesn't benefit from any caching, it works in pass-through mode until you re-attach it to a cache manually:



                # echo CACHE_SET_ID >/sys/block/sdb/sdb1/bcache/attach


                In that case, you create a cache device only, then attach any disk to it (with the above command following this one):



                # make-bcache -C CACHE_DEV






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 at 22:34









                hurikhan77

                888




                888






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028573%2fhow-to-release-device-locked-by-bcache%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

                    How did Captain America manage to do this?

                    迪纳利

                    南乌拉尔铁路局