Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > HTF do I mount an NFS share under OS X?

HTF do I mount an NFS share under OS X?
Thread Tools
Dedicated MacNNer
Join Date: May 2001
Location: Edinburgh, UK
Status: Offline
Reply With Quote
Jun 17, 2003, 07:22 PM
 
I've looked through the past topics and have not found a working answer to my question: How the **** do you mount an NFS share under Mac OS X?

I've setup /etc/exports with the following:
/usr/netshare 192.168.0.3(rw,insecure) 192.168.0.4(rw,insecure) 192.168.0.5(rw,insecure) 192.168.0.10(rw,insecure)
/pub (ro,insecure,all_squash)

My PowerMac has IP 192.168.0.5 and it totally refuses to connect. I can connect to the Linux (Red Hat 8) box via Linux but Mac OS X will just report "NFS Portmap: RPC: Port mapper failure - RPC: Timed out" every single time (using the command "sudo mount 192.168.0.10:</pub||/usr/netshare> <mylocation>"). I have no other problems connecting to this Linux box at all other than NFS. I also restart the NFS serve daemon every time I change /etc/exports and this works flawlessly but still the Mac won't mount it.

I would be very grateful for any help.
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Jun 17, 2003, 10:00 PM
 
iJed-

My documentation is at another site and I will have access to it tomorrow, but try this link

Apple kBase article
Let me know if this is helpful.

Craig
     
Dedicated MacNNer
Join Date: Sep 2001
Location: San Jose CA
Status: Offline
Reply With Quote
Jun 18, 2003, 02:09 AM
 
It sounds like portmapper may not be running on your MacOS X system. You can start it by doing the following:

$ sudo /usr/sbin/portmap

You can check to see if it has started properly using rpcinfo:

$ rpcinfo -p localhost

The output should list portmapper running on tcp and udp port 111. Once portmapper is running you should be able to list the exports on your linux box by using showmount:

$ showmount -e 192.168.0.10

If you see the directory you want to mount listed, then you should be able to use the mount command to mount it.

If you want to enable portmapper permanently you need to edit /etc/hostconfig and change the line:

RPCSERVER=-AUTOMATIC-

to

RPCSERVER=-YES-

HTH,

--ranga
     
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status: Offline
Reply With Quote
Jun 18, 2003, 12:18 PM
 
Originally posted by iJed:

My PowerMac has IP 192.168.0.5 and it totally refuses to connect. I can connect to the Linux (Red Hat 8) box via Linux but Mac OS X will just report "NFS Portmap: RPC: Port mapper failure - RPC: Timed out" every single time (using the command

"sudo mount 192.168.0.10:</pub||/usr/netshare> <mylocation>"). I have no other problems connecting to this Linux box at all other than NFS. I also restart the NFS serve daemon every time I change /etc/exports and this works flawlessly but still the Mac won't mount it.

I would be very grateful for any help.
The usual command for NFS mounting of NFS exported shares on Mac OS X is:

sudo mount_nfs -P 192.168.0.10:/pub/usr/netshare /mylocation

Note: /mylocation MUST exist. It is known as the mountpoint. You can create this mountpoint like this:

sudo mkdir /mylocation

The -P switch in the mount_nfs command seems to be neccessary for Mac OS X to be able to mount from a Red Hat NFS server.

For more info see the manpage for mount_nfs.

There are quite a few "mount_XXX" commands in Mac OS X which it seems to have inherited from BSD. Not sure why they use so many different ones instead of just using the plain old "mount -tfstype ...."
-DU-...etc...
     
iJed  (op)
Dedicated MacNNer
Join Date: May 2001
Location: Edinburgh, UK
Status: Offline
Reply With Quote
Jun 18, 2003, 06:12 PM
 
I've tried everything given here and still I can't seem to get NFS to work. I'm beginning to think there may be some problem with the NFS server on my Linux box so I may try reinstalling it. I also had the intention of moving my Linux box to Slackware 9 at some point so I may just wait until I do that.

Thanks everyone for your help.
     
Moderator
Join Date: May 2001
Location: Hilbert space
Status: Offline
Reply With Quote
Jun 19, 2003, 05:21 AM
 
How about the good old `connect to' dialog (Apple + K), then enter

nfs://machine:directoryname

Done.

You can manually mount nfs shares as a root user, but I was unable to unmount them.

If that doesn't work, deactivate your firewall, try again. If that doesn't work either, I'd double check the config of your nfs server.
I don't suffer from insanity, I enjoy every minute of it.
     
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status: Offline
Reply With Quote
Jun 19, 2003, 10:43 AM
 
Originally posted by iJed:
I've tried everything given here and still I can't seem to get NFS to work. I'm beginning to think there may be some problem with the NFS server on my Linux box so I may try reinstalling it. I also had the intention of moving my Linux box to Slackware 9 at some point so I may just wait until I do that.

Thanks everyone for your help.
It is very unlikely that it is the fault of your Red Hat 8 server... because you can mount the shares just fine on another Linux client. Aside from that... I have been using NFS from Linux (Red Hat in particular) to Mac OS X boxes for years and have never had a problem.

There are several key things to this issue some of which are higlighted by the result you get when trying to mount the share:

1. Is the line on your Mac OS X client in your /etc/hostconfig file set to:

RPCSERVER=-YES-
?

If not change it and reboot.

2. What do you get in response to the command:

rpcinfo -p localhost
?

If you get something like:

rpcinfo: can't contact portmapper: RPC: Remote system error - Connection refused

then your portmapper is not running. You will need to start it. It should have started automatically if you completed step 1. above. To start it manually:

sudo /usr/sbin/portmap

THEN try the command:

rpcinfo -p localhost

You should now get the response:

program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper

If not then there is something wrong with your Mac OS X client. It is very important that the portmapper works... without it you will not be able to mount NFS shares.

4. If portmap works then the next step is to make sure that firewalling is OFF on both the Mac OS X client and the Linux server. To turn it off on Mac OS X consult the documentation that came with your firewall software.
To turn it off in RedHat Linux (as root):

/sbin/service iptables stop

This should be fairly "safe" since you are on a private subnet and I assume it is firewalled from the big bad internet at the router (or wherever).

5. Clean up your /etc/exports file on the Linux server... make it look like this:

/usr/netshare 192.168.0.0/255.255.255.0(rw)
/pub 192.168.0.0/255.255.255.0(ro,all_squash)

The "insecure" setting is not neccessary.

6. Make sure that /pub has at least permissions drwxr-xr-x on the server (the d just means it is a directory) Check with:

ls -l /

If not then:

chmod 0755 /pub

and check again.

7. Make sure that /usr/netshare has at least permissions drwxrwxrwx on the server:

ls -l /usr

I would recommend that you set it to
drwxrwxrwt (the t is for the "sticky bit"). Using the sticky bit enables your users to save files and prevents others from deleting them. Like this:

chmod 1777 /usr/netshare

8. Re-export the shares.... either:

exportfs -r

or

/sbin/service nfs restart

from the Linux server.

9. Try mounting one of the shares from a Mac OS X client:

mount_nfs -P 192.168.0.10:/pub /mountpoint

where /mountpoint is some dir you created on the Mac OS X client. This is assuming the IP address of the Linux server is 192.168.0.10.
Does that work? Can you do:

ls -l /mountpoint
?
on the client and see what is in /pub on the server? Do you still get the portmap error on the client?

10. If it mounts OK you can check with this command on the client:

mount

It should report something like this:

192.168.0.10:/pub on /mountpoint type nfs (ro,addr=192.168.0.10)

You can also check on the Linux server what is exported and to where with:

cat /proc/fs/nfs/exports

it will list all clients that are currently mounting the exported shares.

11. Last but not least.... as a further troubleshooting tool you can follow this on the server by running the command (as root in a terminal):

tail -f /var/log/messages

(use Ctrl-C to quit).

You should see something like this:

Jun 19 11:29:41 localhost rpc.mountd: authenticated mount request from 192.168.0.5:618 for /pub (/mountpoint)

If for some reason it does NOT work you may see something like this:

Jun 19 11:32:49 localhost portmap[21206]: connect from 192.168.0.5 to getport(nfs): request from unauthorized host

Do you see anything while trying to mount/umount the shares? If so, what?

The tail -f /var/log/messages command is very useful when troubleshooting things on the Linux server side. You should have a terminal open either on the client (to the server via ssh) or directly on the server with that command running all the time while setting these things up.

Once you get this little problem out of the way you may want to try using NIS on the server and clients to clear up permissions problems you will almost certainly run into with shares exported/mounted read-write.

See: http://bresink.de/osx/nis.html for an excellent HOWTO on that topic.
-DU-...etc...
     
iJed  (op)
Dedicated MacNNer
Join Date: May 2001
Location: Edinburgh, UK
Status: Offline
Reply With Quote
Jun 19, 2003, 12:17 PM
 
It works!!!!


4. If portmap works then the next step is to make sure that firewalling is OFF on both the Mac OS X client and the Linux server. To turn it off on Mac OS X consult the documentation that came with your firewall software.
To turn it off in RedHat Linux (as root):

/sbin/service iptables stop

This should be fairly "safe" since you are on a private subnet and I assume it is firewalled from the big bad internet at the router (or wherever).
Thank you for reminding me about this once again. I had assumed (stupidly) that I had disabled the firewall under Linux when it was actually still up and blocking the nfs port. Instantly, upon disabling this, it worked. I cannot believe how long I've spent on this to overlook such a simple thing.

Thanks everyone here. You have all been a great help.
     
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status: Offline
Reply With Quote
Jun 19, 2003, 12:34 PM
 
Originally posted by iJed:
It works!!!!



Thank you for reminding me about this once again. I had assumed (stupidly) that I had disabled the firewall under Linux when it was actually still up and blocking the nfs port. Instantly, upon disabling this, it worked. I cannot believe how long I've spent on this to overlook such a simple thing.

Thanks everyone here. You have all been a great help.
Rest assured.... I STILL make the same mistake Glad you got it working.

To make sure that it DOES NOT start up again... in the case of when you reboot the server... turn the service off in the startup scripts. There are several ways to do this. Best is to log in to a terminal and run the command (as root):

/usr/sbin/setup

Use arrow keys or tab to navigate and spacebar or enter to select to... Firewall configuration --> select No firewall --> OK --> Quit.

Strangely enough, after doing the above, iptables will still start up on bootup but it won't interfere with anything. You can turn it off but for some reason on reboot it will be configured to start again even if you have configured it for "No firewall". I don't know whether this is a good or bad thing.
(Last edited by utidjian; Jun 19, 2003 at 12:52 PM. )
-DU-...etc...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:36 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2