I am using a script where I use a lot of mount points
( mount xx.zz.cc.vv:/sss/ /mnt/qqq )
Unfortunately, if the resource is not available, the system is waiting
for minimum 10 min ( maybe for ever :-) to get access to the 'drive'
Is there a way to tell the 'mount' NOT to spend more than 2 min on each
connection ? ( and to execute the next instruction )
Thanks
Steve
Hey.
Maybe you can tweak it with the 'timeo' and 'retrans' options fo NFS.
`man nfs` for further explanations.
To stop retrying file operations indefinitely, use the 'soft' option.
I don't really know if these options have any affect on mounting, but i
guess mounting is a file operation like any other.
Another idea would be to use automount, which would open a connection
only, when needed. Also, you wouldn't need to maintain a huge script...
>I am using a script where I use a lot of mount points
>( mount xx.zz.cc.vv:/sss/ /mnt/qqq )
That looks like NFS - but you are not providing any details, so it's
a guess of what else is wrong.
>Unfortunately, if the resource is not available, the system is waiting
>for minimum 10 min ( maybe for ever :-) to get access to the 'drive'
man 5 nfs
under 'retry' - a foreground mount waits 2 minutes by default while
a background mount waits 10000 minutes (80 minutes less than 2 weeks).
>Is there a way to tell the 'mount' NOT to spend more than 2 min on
>each connection ? ( and to execute the next instruction )
If that is NFS, yes. Otherwise, more details needed.
Old guy
Hi Guys,
Yes, that was for an NFS mount. Sorry, I was not really clear.
Thanks anyway
I don't know if my mount is in background or not ( as I could see on the
web....
All I want to do, is to have a script and mount some 'drives'
( If I write the command line by hand.. is that in Background ?? )
Anyway, I try something like : mount 192.168.0.2:/home/xxx /mnt/servera -
o timeo=2,retry=0
That sounds not really OK. after 10 min... still waiting....it doesn't
give up :-(
Cheers,
Steve
Thanks
Steve
>I don't know if my mount is in background or not (as I could see on
>the web....
Is the process that runs the command in the foreground (an icon you
clicked that opens a terminal, or something you are doing _directly_
from the command line)? Or is this a daemon, or a sub-shell run by
a daemon such as crond?
>All I want to do, is to have a script and mount some 'drives'
>( If I write the command line by hand.. is that in Background ?? )
From a terminal, such as what I'm typing in now - no. To put it
in the background, you would have to append a ' &' to the command, OR
run the command from a process that itself was started that way.
>Anyway, I try something like : mount 192.168.0.2:/home/xxx /mnt/servera
> -o timeo=2,retry=0
>That sounds not really OK. after 10 min... still waiting....it doesn't
>give up :-(
How about
mount -t nfs -o timeo=2,retry=1,soft 192.168.0.2:/home/xxx /mnt/servera
You can also put these mount options/variables in /etc/fstab IF YOU
INCLUDE a 'noauto' option as well, and then your original mount
command will be interpreted by looking at /etc/fstab and including the
stuff that's in there (the 'noauto' prevents the system boot scripts
from trying to mount the NFS file at boot). Perhaps
192.168.0.2:/home/xxx /mnt/servera nfs noauto,timeo=2,retry=1,soft 0 0
(that's all one line in /etc/fstab).
What is causing the non-availability? Is the file server down, or not
accessible by existing networking? You may want to put a test to see if
the server is reachable before you try to mount from it.
Old guy
Hi Moe,
I wrote a small script file, which try to access some servers. I know
that some of them, are not switched on all day long.
So, the idea is to start the script and connect to all servers
available...
I don't need necessary to start this script every day.
your syntax gives me a better result. at least, it stop after a while...
I tried with 'retry=0' to speed up the process... but at least that works
out
thank you !!
Steve
>Moe Trin wrote:
>> What is causing the non-availability? Is the file server down, or
>> not accessible by existing networking? You may want to put a test
>> to see if the server is reachable before you try to mount from it.
>I wrote a small script file, which try to access some servers. I
>know that some of them, are not switched on all day long.
>So, the idea is to start the script and connect to all servers
>available...
Normally, I'd consider testing to see if the server is up before
attempting to connect. Assuming the servers are configured to
respond to a ping (definitely not always the case), perhaps
ping -qc2 server_a
if [ $? = "0" ] ; then
connect_to_server_a
else
server_a_not_there
fi
ping -qc2 server_b
and so on. If the server is configured to not respond to pings
(ICMP Echo), then use something like hping2 or hping3
(http://www.hping.org/ - but it doesn't seem to have been updated
since 2005) to see if a UDP port is reachable.
Old guy
Thank you. I will try it
thanks again for your help