how to check if mount is soft NFS

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite












I'm looking for a command to check if a nfs folder is mounted soft, my fstab is:



10.10.1.3:/home/share3 /home/share3 nfs soft 0 0









share|improve this question

























    up vote
    1
    down vote

    favorite












    I'm looking for a command to check if a nfs folder is mounted soft, my fstab is:



    10.10.1.3:/home/share3 /home/share3 nfs soft 0 0









    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I'm looking for a command to check if a nfs folder is mounted soft, my fstab is:



      10.10.1.3:/home/share3 /home/share3 nfs soft 0 0









      share|improve this question













      I'm looking for a command to check if a nfs folder is mounted soft, my fstab is:



      10.10.1.3:/home/share3 /home/share3 nfs soft 0 0






      networking mount nfs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 21 at 14:13









      user2820116

      82




      82




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          You can use the mount command to show all your mounts (or look at /etc/mtab), the grep command to select your specific mount, then another grep to check for soft:



          mount | grep /home/share3 | grep -q soft
          if [[ $? -eq 0 ]] ; then
          echo "/home/share3 is mounted with 'soft'"
          else
          echo "/home/share3 is not mounted with 'soft'"
          fi





          share|improve this answer




















          • Even better would be /proc/mount as it always lists all mount points as seen by the kernel in a machine-readable format.
            – David Foerster
            Feb 21 at 17:16

















          up vote
          2
          down vote













          Although I probably would have used mount (as described in walinator's answer) myself, according to man mount we should get out of the habit:




           The listing.
          The listing mode is maintained for backward compatibility only.

          For more robust and customizable output use findmnt(8), espe‐
          cially in your scripts.



          The findmnt command gives a bit more flexibility as well - for example you can find either by source or target directly (without needing to grep), and output just the filesystem-specific options. Compare:



          $ mount -t nfs | grep public
          192.168.1.127:/c/public on /mnt/nfs/public type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127)


          to



          $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS
          rw,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127


          I don't think it (yet) provides a way to get values of specific options directly, so a grep or awk would still be necessary for that.



          $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"
          hard


          In your case, it would be



          findmnt -nM /home/share3 -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"





          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: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            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%2f1008401%2fhow-to-check-if-mount-is-soft-nfs%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            You can use the mount command to show all your mounts (or look at /etc/mtab), the grep command to select your specific mount, then another grep to check for soft:



            mount | grep /home/share3 | grep -q soft
            if [[ $? -eq 0 ]] ; then
            echo "/home/share3 is mounted with 'soft'"
            else
            echo "/home/share3 is not mounted with 'soft'"
            fi





            share|improve this answer




















            • Even better would be /proc/mount as it always lists all mount points as seen by the kernel in a machine-readable format.
              – David Foerster
              Feb 21 at 17:16














            up vote
            1
            down vote



            accepted










            You can use the mount command to show all your mounts (or look at /etc/mtab), the grep command to select your specific mount, then another grep to check for soft:



            mount | grep /home/share3 | grep -q soft
            if [[ $? -eq 0 ]] ; then
            echo "/home/share3 is mounted with 'soft'"
            else
            echo "/home/share3 is not mounted with 'soft'"
            fi





            share|improve this answer




















            • Even better would be /proc/mount as it always lists all mount points as seen by the kernel in a machine-readable format.
              – David Foerster
              Feb 21 at 17:16












            up vote
            1
            down vote



            accepted







            up vote
            1
            down vote



            accepted






            You can use the mount command to show all your mounts (or look at /etc/mtab), the grep command to select your specific mount, then another grep to check for soft:



            mount | grep /home/share3 | grep -q soft
            if [[ $? -eq 0 ]] ; then
            echo "/home/share3 is mounted with 'soft'"
            else
            echo "/home/share3 is not mounted with 'soft'"
            fi





            share|improve this answer












            You can use the mount command to show all your mounts (or look at /etc/mtab), the grep command to select your specific mount, then another grep to check for soft:



            mount | grep /home/share3 | grep -q soft
            if [[ $? -eq 0 ]] ; then
            echo "/home/share3 is mounted with 'soft'"
            else
            echo "/home/share3 is not mounted with 'soft'"
            fi






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 21 at 14:24









            waltinator

            20.7k74168




            20.7k74168











            • Even better would be /proc/mount as it always lists all mount points as seen by the kernel in a machine-readable format.
              – David Foerster
              Feb 21 at 17:16
















            • Even better would be /proc/mount as it always lists all mount points as seen by the kernel in a machine-readable format.
              – David Foerster
              Feb 21 at 17:16















            Even better would be /proc/mount as it always lists all mount points as seen by the kernel in a machine-readable format.
            – David Foerster
            Feb 21 at 17:16




            Even better would be /proc/mount as it always lists all mount points as seen by the kernel in a machine-readable format.
            – David Foerster
            Feb 21 at 17:16












            up vote
            2
            down vote













            Although I probably would have used mount (as described in walinator's answer) myself, according to man mount we should get out of the habit:




             The listing.
            The listing mode is maintained for backward compatibility only.

            For more robust and customizable output use findmnt(8), espe‐
            cially in your scripts.



            The findmnt command gives a bit more flexibility as well - for example you can find either by source or target directly (without needing to grep), and output just the filesystem-specific options. Compare:



            $ mount -t nfs | grep public
            192.168.1.127:/c/public on /mnt/nfs/public type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127)


            to



            $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS
            rw,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127


            I don't think it (yet) provides a way to get values of specific options directly, so a grep or awk would still be necessary for that.



            $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"
            hard


            In your case, it would be



            findmnt -nM /home/share3 -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"





            share|improve this answer
























              up vote
              2
              down vote













              Although I probably would have used mount (as described in walinator's answer) myself, according to man mount we should get out of the habit:




               The listing.
              The listing mode is maintained for backward compatibility only.

              For more robust and customizable output use findmnt(8), espe‐
              cially in your scripts.



              The findmnt command gives a bit more flexibility as well - for example you can find either by source or target directly (without needing to grep), and output just the filesystem-specific options. Compare:



              $ mount -t nfs | grep public
              192.168.1.127:/c/public on /mnt/nfs/public type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127)


              to



              $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS
              rw,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127


              I don't think it (yet) provides a way to get values of specific options directly, so a grep or awk would still be necessary for that.



              $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"
              hard


              In your case, it would be



              findmnt -nM /home/share3 -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"





              share|improve this answer






















                up vote
                2
                down vote










                up vote
                2
                down vote









                Although I probably would have used mount (as described in walinator's answer) myself, according to man mount we should get out of the habit:




                 The listing.
                The listing mode is maintained for backward compatibility only.

                For more robust and customizable output use findmnt(8), espe‐
                cially in your scripts.



                The findmnt command gives a bit more flexibility as well - for example you can find either by source or target directly (without needing to grep), and output just the filesystem-specific options. Compare:



                $ mount -t nfs | grep public
                192.168.1.127:/c/public on /mnt/nfs/public type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127)


                to



                $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS
                rw,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127


                I don't think it (yet) provides a way to get values of specific options directly, so a grep or awk would still be necessary for that.



                $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"
                hard


                In your case, it would be



                findmnt -nM /home/share3 -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"





                share|improve this answer












                Although I probably would have used mount (as described in walinator's answer) myself, according to man mount we should get out of the habit:




                 The listing.
                The listing mode is maintained for backward compatibility only.

                For more robust and customizable output use findmnt(8), espe‐
                cially in your scripts.



                The findmnt command gives a bit more flexibility as well - for example you can find either by source or target directly (without needing to grep), and output just the filesystem-specific options. Compare:



                $ mount -t nfs | grep public
                192.168.1.127:/c/public on /mnt/nfs/public type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127)


                to



                $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS
                rw,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.127,mountvers=3,mountport=3097,mountproto=udp,local_lock=none,addr=192.168.1.127


                I don't think it (yet) provides a way to get values of specific options directly, so a grep or awk would still be necessary for that.



                $ findmnt -nM /mnt/nfs/public -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"
                hard


                In your case, it would be



                findmnt -nM /home/share3 -oFS-OPTIONS | grep -qE 'bsoftb' && echo "soft" || echo "hard"






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 21 at 14:49









                steeldriver

                63.4k1198167




                63.4k1198167



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1008401%2fhow-to-check-if-mount-is-soft-nfs%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    pylint3 and pip3 broken

                    Missing snmpget and snmpwalk

                    How to enroll fingerprints to Ubuntu 17.10 with VFS491