# NFS Problems - getfh failed: Operation not permitted

## jamieo

I have 2 machines, A and B. A is currently sharing 4 directories so the /etc/exports looks like:

/usr/home       192.168.123.0/255.255.255.0(rw)

/mnt/data1      192.168.123.0/255.255.255.0(rw,no_root_squash)

/tmp		192.168.123.0/255.255.255.0(rw,no_root_squash)

/usr/portage    192.168.123.0/255.255.255.0(rw,no_root_squash)

B mounts 2 of those directories fine (and does so at boot), so in it's /etc/fstab there is:

A:/usr/portage      /usr/portage    nfs             rw,hard,intr 0 0

A:/usr/home         /usr/home       nfs             rw,hard,intr 0 0

However, when I try and mount /tmp or /mnt/data1 I just get:

mount: A:/mnt/data1 failed, reason given by server: Permission denied

In /var/log/messages on A it reports:

Feb 12 20:13:51 A rpc.mountd: authenticated mount request from B:608 for /mnt/data1 (/mnt/data1)

Feb 12 20:13:51 A rpc.mountd: getfh failed: Operation not permitted

I've tried restarting the nfs server, adding entries in fstab on B, doing exportfs -a, etc. and it's always the same.

In my /etc/hosts.deny I have:

portmap:ALL

lockd:ALL

mountd:ALL

rquotad:ALL

statd:ALL

And /etc/hosts.allow is:

portmap:192.168.123.0/255.255.255.0

lockd:192.168.123.0/255.255.255.0

rquotad:192.168.123.0/255.255.255.0

mountd:192.168.123.0/255.255.255.0

statd:192.168.123.0/255.255.255.0

These are the same on both machines.

Any ideas? I'm a bit stuck with this!!!

Cheers,

Jamie

----------

## fifo

Are /mnt/data1 and /tmp on different devices from the two shares that work? What filesystems are involved here?

----------

## jamieo

/mnt/data1 (on /dev/hda6)

/tmp (on /dev/hda2)

/usr/portage (on /dev/hda2)

/usr/home -> symbolic link to /mnt/data1/home

So / is /dev/hda2 and /mnt/data1 is /dev/hda6. The exported /usr/home is in fact a symbolic link into /dev/hda6.

So the working ones are (kind of) on different devices/partitions and the non-working ones are too  :Sad: 

???

----------

## fifo

Well that has me stumped then  :Confused:  . Have you started portmap on the client? Also try running "exportfs -rav" on the server, and make sure the output is correct.

----------

## jamieo

Yes portmap is started on the client and exportfs -rav gives:

exporting 192.168.123.0/255.255.255.0:/mnt/data1/home

exporting 192.168.123.0/255.255.255.0:/usr/portage

exporting 192.168.123.0/255.255.255.0:/mnt/data1

exporting 192.168.123.0/255.255.255.0:/tmp

So all seems fine that that respect.

 :Sad: 

----------

## fifo

Comment out the /usr/home line in /etc/exports, run "exportfs -rav", and then see if you can mount /mnt/data1. (It should still be possible to mount /mnt/data1/home aswell.)

----------

## jamieo

Ah someone has told me that there is a problem/feature in linux nfs where you can only export one thing from a filesystem.

This does explain my problem. /usr/home and /usr/portage are successfully exported, and they are on different filesystems. However, /tmp and /mnt/data1 seem to be exported, but can't be mounted (as above). These two directories are on the two filesystems exported above. Hence it's not working.

The guy who told me this said he read it in an article by our dearly beloved  :Wink:  Daniel Robbins. So I assume this is my problem.

The "solution" is to export / and so clients can mount anything under that.

Can anyone confirm this?

----------

## cshields

I ran into this problem as well.  This is what fixed it for me:

stop nfs

remove, touch, and chmod 644 /var/lib/nfs/etab, rmtab, state, xtab

(I had to chmod 666 /var/lib/nfs/state to get statd to start correctly)

start nfs

I had found this fix in a couple of places, and I'm not sure why it works, all I know is that in desperation I tried it and it worked for me.  Hope it works for you as well.

Cheers!

----------

