how to check if mount is soft NFS
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
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
networking mount nfs
add a comment |Â
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
networking mount nfs
add a comment |Â
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
networking mount nfs
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
networking mount nfs
asked Feb 21 at 14:13
user2820116
82
82
add a comment |Â
add a comment |Â
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
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
add a comment |Â
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"
add a comment |Â
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
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
add a comment |Â
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
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
add a comment |Â
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
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
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
add a comment |Â
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
add a comment |Â
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"
add a comment |Â
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"
add a comment |Â
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"
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"
answered Feb 21 at 14:49
steeldriver
63.4k1198167
63.4k1198167
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password