Difference between --rbind and --bind in mounting












0















I am confused. Linux filesystem is a tree structure, with the root node(starting node) as the root directory.
Now let's suppose I have a folder abc at location /home/abc and another folder xyz at location /home/xyz



Folder xyz consists of some other folders and files inside it. (ex def and mno are folders inside it)



     xyz
/
def mno


When I run the command




mount --rbind /home/xyz /home/abc




(rbind is recursively bind)
I see all the contents of the folder xyz in abc.
Now, when i just run the command




mount --bind /home/xyz /home/abc




I still see all the contents of xyz in abc.



Why is that?



--bind to work just as similarly to --rbind










share|improve this question



























    0















    I am confused. Linux filesystem is a tree structure, with the root node(starting node) as the root directory.
    Now let's suppose I have a folder abc at location /home/abc and another folder xyz at location /home/xyz



    Folder xyz consists of some other folders and files inside it. (ex def and mno are folders inside it)



         xyz
    /
    def mno


    When I run the command




    mount --rbind /home/xyz /home/abc




    (rbind is recursively bind)
    I see all the contents of the folder xyz in abc.
    Now, when i just run the command




    mount --bind /home/xyz /home/abc




    I still see all the contents of xyz in abc.



    Why is that?



    --bind to work just as similarly to --rbind










    share|improve this question

























      0












      0








      0








      I am confused. Linux filesystem is a tree structure, with the root node(starting node) as the root directory.
      Now let's suppose I have a folder abc at location /home/abc and another folder xyz at location /home/xyz



      Folder xyz consists of some other folders and files inside it. (ex def and mno are folders inside it)



           xyz
      /
      def mno


      When I run the command




      mount --rbind /home/xyz /home/abc




      (rbind is recursively bind)
      I see all the contents of the folder xyz in abc.
      Now, when i just run the command




      mount --bind /home/xyz /home/abc




      I still see all the contents of xyz in abc.



      Why is that?



      --bind to work just as similarly to --rbind










      share|improve this question














      I am confused. Linux filesystem is a tree structure, with the root node(starting node) as the root directory.
      Now let's suppose I have a folder abc at location /home/abc and another folder xyz at location /home/xyz



      Folder xyz consists of some other folders and files inside it. (ex def and mno are folders inside it)



           xyz
      /
      def mno


      When I run the command




      mount --rbind /home/xyz /home/abc




      (rbind is recursively bind)
      I see all the contents of the folder xyz in abc.
      Now, when i just run the command




      mount --bind /home/xyz /home/abc




      I still see all the contents of xyz in abc.



      Why is that?



      --bind to work just as similarly to --rbind







      mount filesystem bind umount






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 11 hours ago









      ShrayShray

      163




      163






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Read man 8 mount. It says:



          Bind mounts
          Remount part of the file hierarchy somewhere else. The call is:

          mount --bind olddir newdir

          or by using this fstab entry:

          /olddir /newdir none bind

          After this call the same contents are accessible in two places. One can also remount a
          single file (on a single file). It's also possible to use the bind mount to create a
          mountpoint from a regular directory, for example:

          mount --bind foo foo

          The bind mount call attaches only (part of) a single filesystem, not possible submounts.
          The entire file hierarchy including submounts is attached a second place by using:
          Bind mounts
          Remount part of the file hierarchy somewhere else. The call is:

          mount --bind olddir newdir

          or by using this fstab entry:

          /olddir /newdir none bind

          After this call the same contents are accessible in two places. One can also remount a
          single file (on a single file). It's also possible to use the bind mount to create a
          mountpoint from a regular directory, for example:

          mount --bind foo foo

          The bind mount call attaches only (part of) a single filesystem, not possible submounts.
          The entire file hierarchy including submounts is attached a second place by using:

          mount --rbind olddir newdir

          Note that the filesystem mount options will remain the same as those on the original mount
          point.
          mount --rbind olddir newdir

          Note that the filesystem mount options will remain the same as those on the original mount
          point.





          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',
            autoActivateHeartbeat: false,
            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%2f1122975%2fdifference-between-rbind-and-bind-in-mounting%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














            Read man 8 mount. It says:



            Bind mounts
            Remount part of the file hierarchy somewhere else. The call is:

            mount --bind olddir newdir

            or by using this fstab entry:

            /olddir /newdir none bind

            After this call the same contents are accessible in two places. One can also remount a
            single file (on a single file). It's also possible to use the bind mount to create a
            mountpoint from a regular directory, for example:

            mount --bind foo foo

            The bind mount call attaches only (part of) a single filesystem, not possible submounts.
            The entire file hierarchy including submounts is attached a second place by using:
            Bind mounts
            Remount part of the file hierarchy somewhere else. The call is:

            mount --bind olddir newdir

            or by using this fstab entry:

            /olddir /newdir none bind

            After this call the same contents are accessible in two places. One can also remount a
            single file (on a single file). It's also possible to use the bind mount to create a
            mountpoint from a regular directory, for example:

            mount --bind foo foo

            The bind mount call attaches only (part of) a single filesystem, not possible submounts.
            The entire file hierarchy including submounts is attached a second place by using:

            mount --rbind olddir newdir

            Note that the filesystem mount options will remain the same as those on the original mount
            point.
            mount --rbind olddir newdir

            Note that the filesystem mount options will remain the same as those on the original mount
            point.





            share|improve this answer




























              0














              Read man 8 mount. It says:



              Bind mounts
              Remount part of the file hierarchy somewhere else. The call is:

              mount --bind olddir newdir

              or by using this fstab entry:

              /olddir /newdir none bind

              After this call the same contents are accessible in two places. One can also remount a
              single file (on a single file). It's also possible to use the bind mount to create a
              mountpoint from a regular directory, for example:

              mount --bind foo foo

              The bind mount call attaches only (part of) a single filesystem, not possible submounts.
              The entire file hierarchy including submounts is attached a second place by using:
              Bind mounts
              Remount part of the file hierarchy somewhere else. The call is:

              mount --bind olddir newdir

              or by using this fstab entry:

              /olddir /newdir none bind

              After this call the same contents are accessible in two places. One can also remount a
              single file (on a single file). It's also possible to use the bind mount to create a
              mountpoint from a regular directory, for example:

              mount --bind foo foo

              The bind mount call attaches only (part of) a single filesystem, not possible submounts.
              The entire file hierarchy including submounts is attached a second place by using:

              mount --rbind olddir newdir

              Note that the filesystem mount options will remain the same as those on the original mount
              point.
              mount --rbind olddir newdir

              Note that the filesystem mount options will remain the same as those on the original mount
              point.





              share|improve this answer


























                0












                0








                0







                Read man 8 mount. It says:



                Bind mounts
                Remount part of the file hierarchy somewhere else. The call is:

                mount --bind olddir newdir

                or by using this fstab entry:

                /olddir /newdir none bind

                After this call the same contents are accessible in two places. One can also remount a
                single file (on a single file). It's also possible to use the bind mount to create a
                mountpoint from a regular directory, for example:

                mount --bind foo foo

                The bind mount call attaches only (part of) a single filesystem, not possible submounts.
                The entire file hierarchy including submounts is attached a second place by using:
                Bind mounts
                Remount part of the file hierarchy somewhere else. The call is:

                mount --bind olddir newdir

                or by using this fstab entry:

                /olddir /newdir none bind

                After this call the same contents are accessible in two places. One can also remount a
                single file (on a single file). It's also possible to use the bind mount to create a
                mountpoint from a regular directory, for example:

                mount --bind foo foo

                The bind mount call attaches only (part of) a single filesystem, not possible submounts.
                The entire file hierarchy including submounts is attached a second place by using:

                mount --rbind olddir newdir

                Note that the filesystem mount options will remain the same as those on the original mount
                point.
                mount --rbind olddir newdir

                Note that the filesystem mount options will remain the same as those on the original mount
                point.





                share|improve this answer













                Read man 8 mount. It says:



                Bind mounts
                Remount part of the file hierarchy somewhere else. The call is:

                mount --bind olddir newdir

                or by using this fstab entry:

                /olddir /newdir none bind

                After this call the same contents are accessible in two places. One can also remount a
                single file (on a single file). It's also possible to use the bind mount to create a
                mountpoint from a regular directory, for example:

                mount --bind foo foo

                The bind mount call attaches only (part of) a single filesystem, not possible submounts.
                The entire file hierarchy including submounts is attached a second place by using:
                Bind mounts
                Remount part of the file hierarchy somewhere else. The call is:

                mount --bind olddir newdir

                or by using this fstab entry:

                /olddir /newdir none bind

                After this call the same contents are accessible in two places. One can also remount a
                single file (on a single file). It's also possible to use the bind mount to create a
                mountpoint from a regular directory, for example:

                mount --bind foo foo

                The bind mount call attaches only (part of) a single filesystem, not possible submounts.
                The entire file hierarchy including submounts is attached a second place by using:

                mount --rbind olddir newdir

                Note that the filesystem mount options will remain the same as those on the original mount
                point.
                mount --rbind olddir newdir

                Note that the filesystem mount options will remain the same as those on the original mount
                point.






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 10 hours ago









                waltinatorwaltinator

                22.6k74169




                22.6k74169






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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%2faskubuntu.com%2fquestions%2f1122975%2fdifference-between-rbind-and-bind-in-mounting%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?

                    迪纳利

                    南乌拉尔铁路局