Does order of mount operations matter when mounting into an existing mountpoint?












1














The question Best practice when mounting a new disk within an existing mount?
inspired me to ask this follow-up question:



The other question asked whether it is ok to



mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv


so that /home/mythtv is a mountpoint within the mountpoint
/home. (spoiler: Yes, it is perfectly ok.).



What if I'd change the order of commands to



mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home


Will that yield the same result or will /home/mythtv be hidden by /home?
I assume /home contains an (empty) directory /home/mythtv.










share|improve this question



























    1














    The question Best practice when mounting a new disk within an existing mount?
    inspired me to ask this follow-up question:



    The other question asked whether it is ok to



    mount /dev/sdb1 /home
    mount /dev/sdb2 /home/mythtv


    so that /home/mythtv is a mountpoint within the mountpoint
    /home. (spoiler: Yes, it is perfectly ok.).



    What if I'd change the order of commands to



    mount /dev/sdb2 /home/mythtv
    mount /dev/sdb1 /home


    Will that yield the same result or will /home/mythtv be hidden by /home?
    I assume /home contains an (empty) directory /home/mythtv.










    share|improve this question

























      1












      1








      1







      The question Best practice when mounting a new disk within an existing mount?
      inspired me to ask this follow-up question:



      The other question asked whether it is ok to



      mount /dev/sdb1 /home
      mount /dev/sdb2 /home/mythtv


      so that /home/mythtv is a mountpoint within the mountpoint
      /home. (spoiler: Yes, it is perfectly ok.).



      What if I'd change the order of commands to



      mount /dev/sdb2 /home/mythtv
      mount /dev/sdb1 /home


      Will that yield the same result or will /home/mythtv be hidden by /home?
      I assume /home contains an (empty) directory /home/mythtv.










      share|improve this question













      The question Best practice when mounting a new disk within an existing mount?
      inspired me to ask this follow-up question:



      The other question asked whether it is ok to



      mount /dev/sdb1 /home
      mount /dev/sdb2 /home/mythtv


      so that /home/mythtv is a mountpoint within the mountpoint
      /home. (spoiler: Yes, it is perfectly ok.).



      What if I'd change the order of commands to



      mount /dev/sdb2 /home/mythtv
      mount /dev/sdb1 /home


      Will that yield the same result or will /home/mythtv be hidden by /home?
      I assume /home contains an (empty) directory /home/mythtv.







      mount






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      PerlDuck

      5,40411231




      5,40411231






















          1 Answer
          1






          active

          oldest

          votes


















          5














          Yes, it metters! Your first example:



          mount /dev/sdb1 /home
          mount /dev/sdb2 /home/mythtv


          is the only right way, when mounting you must respect the tree order.



          In your second examples



          mount /dev/sdb2 /home/mythtv
          mount /dev/sdb1 /home


          If we assuming /home/mythtv exists on the filesystem is gonna mount it with no problem, but after you mount the second volume you cannot access anymore to the first one, this because you let system mount sdb2 on the path existing in to /home/mythtv when you mount the /home/ you are telling you system to mount it in the /home which also exist but is going to "cover" existing mount point, they are both mounted, but when you type cd /home/mythtv bash take you to sdb1:/mythtv instead sdb2:/home/mythtv because they are different path.



          I hope to explain good. If not clear pleas ask in the comment, I'll try to get it to you more clear.



          Update
          as per @mook765 says, the order is important also in the fstab files:



          fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.






          share|improve this answer























          • Yes, that sounds reasonable. Thank you.
            – PerlDuck
            1 hour ago






          • 2




            @PerlDuck This is also important for /etc/fstab, line order matters.
            – mook765
            58 mins ago






          • 1




            Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
            – AtomiX84
            49 mins ago













          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%2f1106879%2fdoes-order-of-mount-operations-matter-when-mounting-into-an-existing-mountpoint%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









          5














          Yes, it metters! Your first example:



          mount /dev/sdb1 /home
          mount /dev/sdb2 /home/mythtv


          is the only right way, when mounting you must respect the tree order.



          In your second examples



          mount /dev/sdb2 /home/mythtv
          mount /dev/sdb1 /home


          If we assuming /home/mythtv exists on the filesystem is gonna mount it with no problem, but after you mount the second volume you cannot access anymore to the first one, this because you let system mount sdb2 on the path existing in to /home/mythtv when you mount the /home/ you are telling you system to mount it in the /home which also exist but is going to "cover" existing mount point, they are both mounted, but when you type cd /home/mythtv bash take you to sdb1:/mythtv instead sdb2:/home/mythtv because they are different path.



          I hope to explain good. If not clear pleas ask in the comment, I'll try to get it to you more clear.



          Update
          as per @mook765 says, the order is important also in the fstab files:



          fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.






          share|improve this answer























          • Yes, that sounds reasonable. Thank you.
            – PerlDuck
            1 hour ago






          • 2




            @PerlDuck This is also important for /etc/fstab, line order matters.
            – mook765
            58 mins ago






          • 1




            Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
            – AtomiX84
            49 mins ago


















          5














          Yes, it metters! Your first example:



          mount /dev/sdb1 /home
          mount /dev/sdb2 /home/mythtv


          is the only right way, when mounting you must respect the tree order.



          In your second examples



          mount /dev/sdb2 /home/mythtv
          mount /dev/sdb1 /home


          If we assuming /home/mythtv exists on the filesystem is gonna mount it with no problem, but after you mount the second volume you cannot access anymore to the first one, this because you let system mount sdb2 on the path existing in to /home/mythtv when you mount the /home/ you are telling you system to mount it in the /home which also exist but is going to "cover" existing mount point, they are both mounted, but when you type cd /home/mythtv bash take you to sdb1:/mythtv instead sdb2:/home/mythtv because they are different path.



          I hope to explain good. If not clear pleas ask in the comment, I'll try to get it to you more clear.



          Update
          as per @mook765 says, the order is important also in the fstab files:



          fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.






          share|improve this answer























          • Yes, that sounds reasonable. Thank you.
            – PerlDuck
            1 hour ago






          • 2




            @PerlDuck This is also important for /etc/fstab, line order matters.
            – mook765
            58 mins ago






          • 1




            Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
            – AtomiX84
            49 mins ago
















          5












          5








          5






          Yes, it metters! Your first example:



          mount /dev/sdb1 /home
          mount /dev/sdb2 /home/mythtv


          is the only right way, when mounting you must respect the tree order.



          In your second examples



          mount /dev/sdb2 /home/mythtv
          mount /dev/sdb1 /home


          If we assuming /home/mythtv exists on the filesystem is gonna mount it with no problem, but after you mount the second volume you cannot access anymore to the first one, this because you let system mount sdb2 on the path existing in to /home/mythtv when you mount the /home/ you are telling you system to mount it in the /home which also exist but is going to "cover" existing mount point, they are both mounted, but when you type cd /home/mythtv bash take you to sdb1:/mythtv instead sdb2:/home/mythtv because they are different path.



          I hope to explain good. If not clear pleas ask in the comment, I'll try to get it to you more clear.



          Update
          as per @mook765 says, the order is important also in the fstab files:



          fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.






          share|improve this answer














          Yes, it metters! Your first example:



          mount /dev/sdb1 /home
          mount /dev/sdb2 /home/mythtv


          is the only right way, when mounting you must respect the tree order.



          In your second examples



          mount /dev/sdb2 /home/mythtv
          mount /dev/sdb1 /home


          If we assuming /home/mythtv exists on the filesystem is gonna mount it with no problem, but after you mount the second volume you cannot access anymore to the first one, this because you let system mount sdb2 on the path existing in to /home/mythtv when you mount the /home/ you are telling you system to mount it in the /home which also exist but is going to "cover" existing mount point, they are both mounted, but when you type cd /home/mythtv bash take you to sdb1:/mythtv instead sdb2:/home/mythtv because they are different path.



          I hope to explain good. If not clear pleas ask in the comment, I'll try to get it to you more clear.



          Update
          as per @mook765 says, the order is important also in the fstab files:



          fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 44 mins ago

























          answered 1 hour ago









          AtomiX84

          2507




          2507












          • Yes, that sounds reasonable. Thank you.
            – PerlDuck
            1 hour ago






          • 2




            @PerlDuck This is also important for /etc/fstab, line order matters.
            – mook765
            58 mins ago






          • 1




            Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
            – AtomiX84
            49 mins ago




















          • Yes, that sounds reasonable. Thank you.
            – PerlDuck
            1 hour ago






          • 2




            @PerlDuck This is also important for /etc/fstab, line order matters.
            – mook765
            58 mins ago






          • 1




            Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
            – AtomiX84
            49 mins ago


















          Yes, that sounds reasonable. Thank you.
          – PerlDuck
          1 hour ago




          Yes, that sounds reasonable. Thank you.
          – PerlDuck
          1 hour ago




          2




          2




          @PerlDuck This is also important for /etc/fstab, line order matters.
          – mook765
          58 mins ago




          @PerlDuck This is also important for /etc/fstab, line order matters.
          – mook765
          58 mins ago




          1




          1




          Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
          – AtomiX84
          49 mins ago






          Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
          – AtomiX84
          49 mins ago




















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f1106879%2fdoes-order-of-mount-operations-matter-when-mounting-into-an-existing-mountpoint%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

          Understanding the information contained in the Deep Space Network XML data?

          Ross-on-Wye

          Eastern Orthodox Church