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 2 days ago









      Dinesh

      82




      82






















          2 Answers
          2






          active

          oldest

          votes


















          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































            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
              yesterday












            • 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
              yesterday











            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









            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 yesterday

























                answered 2 days ago









                Soren A

                3,3111924




                3,3111924

























                    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
                      yesterday












                    • 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
                      yesterday
















                    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
                      yesterday












                    • 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
                      yesterday














                    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 yesterday

























                    answered 2 days ago









                    N0rbert

                    21.5k547101




                    21.5k547101












                    • 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
                      yesterday












                    • 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
                      yesterday


















                    • 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
                      yesterday












                    • 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
                      yesterday
















                    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
                    yesterday






                    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
                    yesterday














                    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
                    yesterday




                    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
                    yesterday


















                    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%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

                    How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                    is 'sed' thread safe

                    How to make a Squid Proxy server?