LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   strange thing with nfs (http://www.linuxquestions.org/questions/slackware-14/strange-thing-with-nfs-318577/)

egag 04-29-2005 09:19 PM

strange thing with nfs
 
hoi all...

when i mount on pc A a nfs-share wich is on the disk of pc B,
and i shutdown pc B then i get the following :

-konquerer will not show the root-dir.
after a while i don't even get the filename of subdirs.
only
------
a
aa
b
bb
c
cc
etc......
-----

-ksysguard gives only "888888....etc" in the status bar, and no data on
running processes.
-i cannot unmount the share

i get kernel messages saying it's trying to mount and
in a console all is normal ( "ls / " and " top" work ok )

in the exports file on pc B there's only the (rw,sync) option.

rebooting pc B makes all normal again and then
i can unmount the share .

i think i have to change some setings somewhere , but
i can't find it.

any suggestions welcome .

egag

AltF4 04-29-2005 09:22 PM

mount the NFS directory with the "-o soft" option

egag 04-29-2005 09:27 PM

hmmm.....from " man mount "
---------
soft This option allows the kernel to time out if the nfs server is not
responding for some time. The time can be specified with timeo=time.
This option might be useful if your nfs server sometimes doesn't
respond or will be rebooted while some process tries to get a file
from the server. Usually it just causes lots of trouble.

---------

it sais it should work, but also causes " lot's of trouble ".

maybe there's more options...

egag

egag 04-30-2005 09:09 AM

well.....using the " soft " option makes it a little better.
switching to the root dir causes a timeout of a few minutes,
but it won't hang.

on pc A the mount command gives

-------
192.168.0.3:/home/packages on /diskhome type nfs (rw,soft,intr,addr=192.168.0.3)
-------

but it's only kde app.'s that are bothered; cli works ok.
so maybe i should set smth. in kde.....?

egag

keefaz 04-30-2005 01:53 PM

Try automount your nfs share, it is not too hard to set (your kernel has to be
configured with autofs though, preferably as module)

- installpkg autofs
- create a /etc/auto.master file with the content :
Code:

/net    /etc/auto.net
- create a /etc/auto.net file with the content :
Code:

packages    -fstype=nfs,rw,hard,intr    192.168.0.3:/home/packages
For some reason, there is no rc.autofs installed with the autofs package
so there is one :
http://mariner.cs.ucdavis.edu/slackw...ware/rc.autofs

save it as /etc/rc.d/rc.autofs
Then chmod +x it and /etc/rc.d/rc.autofs start, maybe add
' /etc/rc.d/rc.autofs start ' in rc.local

So try : konqueror /net/packages

egag 04-30-2005 06:19 PM

well....been trying for hours to get it working.
are you sure the script is ok ?
it won't run ok.......

maybe someone can explain this part:
---------
function getmounts()
{
# Check for local maps to be loaded
if [ -f /etc/auto.master ]
then
echo "echo "check"" #<---- added by me
cat /etc/auto.master | sed -e '/^#/d' -e '/^$/d'| (
while read dir map options
do
if [ ! -z "$dir" -a ! -z "$map" \
-a x`echo "$map" | cut -c1` != 'x-' ]
then
echo "echo "check1 "" #<added by me
etc.......
----------

this function is called as " getmounts | sh "

i added two checks.
the first one is echoed, the 2.nd one not.

and it's after this that the command " automount" is issued
so that's never run.

egag

keefaz 05-01-2005 02:35 AM

I have used this script for a long time, it works fine

I added your line to test at the same place in rc.autofs
"check1" was echoed 3 times when I did rc.autofs restart

Could you post auto.master and auto.* associed file ?

keefaz 05-01-2005 03:05 AM

Quote:

maybe someone can explain this part
Code:

if [ ! -z "$dir" -a ! -z "$map" \
-a x`echo "$map" | cut -c1` != 'x-' ]

There are 3 expressions :
! -z "$dir" : $dir must not be empty
! -z "$map" : $map must not be empty

x`echo "$map" | cut -c1` != 'x-' : this one seems complicated but not really,
first let see what is between the ` ` chars : echo "$map" | cut -c1
so it takes the first char in $map variable if $map was equal to "-fs", then
x`echo "$map" | cut -c1` != 'x-'
becomes
x- != 'x-' : so the test return false
(basically, if the first char of $map contains '-', the last test returns false)

And finally the -a connective option stands for the 3 expressions must returns true
like : expression1 && expression2 && expression3

egag 05-01-2005 08:44 AM

thanks for the clear explanation.

i have these files :

/etc/auto.master

Code:

/net    /etc/auto.net  --timeout=60
/etc/auto.net

Code:

packages        -fstype=nfs,rw,hard,intr        192.168.0.3:/home/packages
a              -fstype=auto,rw,sync,umask=002  :/dev/fd0
d              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

(i added cd & floppy also )

when running the script with these files, we should get

$dir = /net

and

$map =/etc/auto.net

and that should work then....but it doesn't.

any idea ?

egag

egag 05-01-2005 11:44 AM

well.....i got it.

in the file /etc/auto.master i needed to put a return at the end of the line
( just hit enter )

thanks for the help/explanation.

it works nice :)

egag

keefaz 05-01-2005 11:46 AM

I would remove --timeout in auto.master to see if it works but frankly
I have no idea why /etc/auto.master does not pass the first test in
getmounts() function :

Code:

echo "/net    /etc/auto.net  --timeout=60" |  (
        while read dir map options; do
            if [ ! -z "$dir" -a ! -z "$map" -a x`echo "$map" | cut -c1` != 'x-' ]; then
                echo "test ok"
                echo "dir: $dir"
                echo "map: $map"
                echo "options: $options"
            fi
        done)
-----------------------
test ok
dir: /net
map: /etc/auto.net
options: --timeout=60

That works as expected...

[edit]
I am glad you get it working ;)

egag 05-01-2005 11:51 AM

i think it's rather a stupid mistake.
took me 6 hours and i got the script almost memorised :D

egag

soyloquesoy 07-13-2005 01:54 PM

Question...
 
Do the /net and /net/packages
directories have to be created? Or are they created by the automount scripts?

I have tried to do this following your instructions (ie. without creating the directories) and I get the following error:
[root@machine1 /]# cd /net/packages
bash: cd: /net/packages: No such file or directory

Thanks!

M

egag 07-13-2005 02:03 PM

only /net; just use " #mkdir /net " to make it.


edit:erroredit

egag


All times are GMT -5. The time now is 02:55 PM.