how to mount filesystem on to an existing (non-empty) directory?












0















How can I mount a new fs (fuse) on to an existing directory where my application is writing?
Details on the issue:
I have /var mounted as ext4. My application writes the data to /var/lib directory (/var/lib is NOT mounted). How may I do this without restarting my application?
On trying to create a mount for /var/lib, I see following message. I am worried about losing existing data in /var/lib to continue with option "nonempty".
"




starting fuse filesystem fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option




"



Thanks,
Dinesh










share|improve this question



























    0















    How can I mount a new fs (fuse) on to an existing directory where my application is writing?
    Details on the issue:
    I have /var mounted as ext4. My application writes the data to /var/lib directory (/var/lib is NOT mounted). How may I do this without restarting my application?
    On trying to create a mount for /var/lib, I see following message. I am worried about losing existing data in /var/lib to continue with option "nonempty".
    "




    starting fuse filesystem fuse: mountpoint is not empty
    fuse: if you are sure this is safe, use the 'nonempty' mount option




    "



    Thanks,
    Dinesh










    share|improve this question

























      0












      0








      0








      How can I mount a new fs (fuse) on to an existing directory where my application is writing?
      Details on the issue:
      I have /var mounted as ext4. My application writes the data to /var/lib directory (/var/lib is NOT mounted). How may I do this without restarting my application?
      On trying to create a mount for /var/lib, I see following message. I am worried about losing existing data in /var/lib to continue with option "nonempty".
      "




      starting fuse filesystem fuse: mountpoint is not empty
      fuse: if you are sure this is safe, use the 'nonempty' mount option




      "



      Thanks,
      Dinesh










      share|improve this question














      How can I mount a new fs (fuse) on to an existing directory where my application is writing?
      Details on the issue:
      I have /var mounted as ext4. My application writes the data to /var/lib directory (/var/lib is NOT mounted). How may I do this without restarting my application?
      On trying to create a mount for /var/lib, I see following message. I am worried about losing existing data in /var/lib to continue with option "nonempty".
      "




      starting fuse filesystem fuse: mountpoint is not empty
      fuse: if you are sure this is safe, use the 'nonempty' mount option




      "



      Thanks,
      Dinesh







      mount






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 4 at 11:40









      DineshDinesh

      103




      103






















          2 Answers
          2






          active

          oldest

          votes


















          0














          As message states you need to pass nonempty mount option:



          sudo mount.fuse /dev/device /var/lib/your_folder -o nonempty


          See man mount.fuse for details:




          nonempty

          Allows mounts over a non-empty file or directory. By default these mounts are
          rejected to prevent accidental covering up of data, which could for example prevent
          automatic backup.




          Note: you should not mount directly to /var/lib as it is used by many applications.






          share|improve this answer


























          • Thanks for the information. Is this possible to achieve the said/mentioned issue using bind mount option? My intention is to test Disk Latency using Charybdefs by skylla. Charybdefs is a fuse based implementation, where the mount will be created onto which the disk latency to be injected / validated. Since my application writes most of its data onto /car/lib, I wanted to mount Charybdefs onto to /var/lib so that, each write operation on to /var/lib will be impacted. Please let me know if there is a way to achieve mount /var/lib without app restart.

            – Dinesh
            Jan 4 at 15:54













          • How about run your application in a chroot, or rewrite it so it doesn't write to /var/lib (why would you do that?).

            – pbhj
            Jan 4 at 16:36



















          1














          You can mount as described in other answer, but the data in the directory you mount on (/var/lib/) will not be available until you unmoumt again. This means that other programs using /var/lib/ might fail.



          AND, depending on how your application handles the files it write to, it might not work at all. If the program opens the file at start, do multiple writes, and then closes the file just before it terminates, you might have a stale filehandle and writes fails. If on the other hand, the program do open - write - close, each time it writes the file, it might work.






          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%2f1106891%2fhow-to-mount-filesystem-on-to-an-existing-non-empty-directory%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            As message states you need to pass nonempty mount option:



            sudo mount.fuse /dev/device /var/lib/your_folder -o nonempty


            See man mount.fuse for details:




            nonempty

            Allows mounts over a non-empty file or directory. By default these mounts are
            rejected to prevent accidental covering up of data, which could for example prevent
            automatic backup.




            Note: you should not mount directly to /var/lib as it is used by many applications.






            share|improve this answer


























            • Thanks for the information. Is this possible to achieve the said/mentioned issue using bind mount option? My intention is to test Disk Latency using Charybdefs by skylla. Charybdefs is a fuse based implementation, where the mount will be created onto which the disk latency to be injected / validated. Since my application writes most of its data onto /car/lib, I wanted to mount Charybdefs onto to /var/lib so that, each write operation on to /var/lib will be impacted. Please let me know if there is a way to achieve mount /var/lib without app restart.

              – Dinesh
              Jan 4 at 15:54













            • How about run your application in a chroot, or rewrite it so it doesn't write to /var/lib (why would you do that?).

              – pbhj
              Jan 4 at 16:36
















            0














            As message states you need to pass nonempty mount option:



            sudo mount.fuse /dev/device /var/lib/your_folder -o nonempty


            See man mount.fuse for details:




            nonempty

            Allows mounts over a non-empty file or directory. By default these mounts are
            rejected to prevent accidental covering up of data, which could for example prevent
            automatic backup.




            Note: you should not mount directly to /var/lib as it is used by many applications.






            share|improve this answer


























            • Thanks for the information. Is this possible to achieve the said/mentioned issue using bind mount option? My intention is to test Disk Latency using Charybdefs by skylla. Charybdefs is a fuse based implementation, where the mount will be created onto which the disk latency to be injected / validated. Since my application writes most of its data onto /car/lib, I wanted to mount Charybdefs onto to /var/lib so that, each write operation on to /var/lib will be impacted. Please let me know if there is a way to achieve mount /var/lib without app restart.

              – Dinesh
              Jan 4 at 15:54













            • How about run your application in a chroot, or rewrite it so it doesn't write to /var/lib (why would you do that?).

              – pbhj
              Jan 4 at 16:36














            0












            0








            0







            As message states you need to pass nonempty mount option:



            sudo mount.fuse /dev/device /var/lib/your_folder -o nonempty


            See man mount.fuse for details:




            nonempty

            Allows mounts over a non-empty file or directory. By default these mounts are
            rejected to prevent accidental covering up of data, which could for example prevent
            automatic backup.




            Note: you should not mount directly to /var/lib as it is used by many applications.






            share|improve this answer















            As message states you need to pass nonempty mount option:



            sudo mount.fuse /dev/device /var/lib/your_folder -o nonempty


            See man mount.fuse for details:




            nonempty

            Allows mounts over a non-empty file or directory. By default these mounts are
            rejected to prevent accidental covering up of data, which could for example prevent
            automatic backup.




            Note: you should not mount directly to /var/lib as it is used by many applications.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 4 at 16:23

























            answered Jan 4 at 11:56









            N0rbertN0rbert

            21.9k547102




            21.9k547102













            • Thanks for the information. Is this possible to achieve the said/mentioned issue using bind mount option? My intention is to test Disk Latency using Charybdefs by skylla. Charybdefs is a fuse based implementation, where the mount will be created onto which the disk latency to be injected / validated. Since my application writes most of its data onto /car/lib, I wanted to mount Charybdefs onto to /var/lib so that, each write operation on to /var/lib will be impacted. Please let me know if there is a way to achieve mount /var/lib without app restart.

              – Dinesh
              Jan 4 at 15:54













            • How about run your application in a chroot, or rewrite it so it doesn't write to /var/lib (why would you do that?).

              – pbhj
              Jan 4 at 16:36



















            • Thanks for the information. Is this possible to achieve the said/mentioned issue using bind mount option? My intention is to test Disk Latency using Charybdefs by skylla. Charybdefs is a fuse based implementation, where the mount will be created onto which the disk latency to be injected / validated. Since my application writes most of its data onto /car/lib, I wanted to mount Charybdefs onto to /var/lib so that, each write operation on to /var/lib will be impacted. Please let me know if there is a way to achieve mount /var/lib without app restart.

              – Dinesh
              Jan 4 at 15:54













            • How about run your application in a chroot, or rewrite it so it doesn't write to /var/lib (why would you do that?).

              – pbhj
              Jan 4 at 16:36

















            Thanks for the information. Is this possible to achieve the said/mentioned issue using bind mount option? My intention is to test Disk Latency using Charybdefs by skylla. Charybdefs is a fuse based implementation, where the mount will be created onto which the disk latency to be injected / validated. Since my application writes most of its data onto /car/lib, I wanted to mount Charybdefs onto to /var/lib so that, each write operation on to /var/lib will be impacted. Please let me know if there is a way to achieve mount /var/lib without app restart.

            – Dinesh
            Jan 4 at 15:54







            Thanks for the information. Is this possible to achieve the said/mentioned issue using bind mount option? My intention is to test Disk Latency using Charybdefs by skylla. Charybdefs is a fuse based implementation, where the mount will be created onto which the disk latency to be injected / validated. Since my application writes most of its data onto /car/lib, I wanted to mount Charybdefs onto to /var/lib so that, each write operation on to /var/lib will be impacted. Please let me know if there is a way to achieve mount /var/lib without app restart.

            – Dinesh
            Jan 4 at 15:54















            How about run your application in a chroot, or rewrite it so it doesn't write to /var/lib (why would you do that?).

            – pbhj
            Jan 4 at 16:36





            How about run your application in a chroot, or rewrite it so it doesn't write to /var/lib (why would you do that?).

            – pbhj
            Jan 4 at 16:36













            1














            You can mount as described in other answer, but the data in the directory you mount on (/var/lib/) will not be available until you unmoumt again. This means that other programs using /var/lib/ might fail.



            AND, depending on how your application handles the files it write to, it might not work at all. If the program opens the file at start, do multiple writes, and then closes the file just before it terminates, you might have a stale filehandle and writes fails. If on the other hand, the program do open - write - close, each time it writes the file, it might work.






            share|improve this answer






























              1














              You can mount as described in other answer, but the data in the directory you mount on (/var/lib/) will not be available until you unmoumt again. This means that other programs using /var/lib/ might fail.



              AND, depending on how your application handles the files it write to, it might not work at all. If the program opens the file at start, do multiple writes, and then closes the file just before it terminates, you might have a stale filehandle and writes fails. If on the other hand, the program do open - write - close, each time it writes the file, it might work.






              share|improve this answer




























                1












                1








                1







                You can mount as described in other answer, but the data in the directory you mount on (/var/lib/) will not be available until you unmoumt again. This means that other programs using /var/lib/ might fail.



                AND, depending on how your application handles the files it write to, it might not work at all. If the program opens the file at start, do multiple writes, and then closes the file just before it terminates, you might have a stale filehandle and writes fails. If on the other hand, the program do open - write - close, each time it writes the file, it might work.






                share|improve this answer















                You can mount as described in other answer, but the data in the directory you mount on (/var/lib/) will not be available until you unmoumt again. This means that other programs using /var/lib/ might fail.



                AND, depending on how your application handles the files it write to, it might not work at all. If the program opens the file at start, do multiple writes, and then closes the file just before it terminates, you might have a stale filehandle and writes fails. If on the other hand, the program do open - write - close, each time it writes the file, it might work.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 4 at 22:27

























                answered Jan 4 at 12:17









                Soren ASoren A

                3,3221924




                3,3221924






























                    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%2f1106891%2fhow-to-mount-filesystem-on-to-an-existing-non-empty-directory%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

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                     ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕