How do I use NFS (mount a linux folder on my Panther iMac)?

michaelsanford

Translator, Web Developer
I'm having problems, stemming from ignorance, on using `mount` to connect to my RedHat box.

I have a folder /home/tank on my RH machine that I'd like to access from my iMac. I've heard that NFS is faster than Samba, so I'd like to use that; Samba is working well though so if I have to I can fall back on that.

So, I've tried "sudo mount trogdor.local:/home/tank /Volumes/tank" and just get "mount_nfs: can't access /home/tank: Permission denied"

What haven't I done ? Is there something more to configure on the RedHat side (with, say, redhat-config-nfs )?

Thanks!

PS I read a bunch of threads abot LDAP and UIDs, and the manpages don't seem to allow specifying a UID when connecting, which is a little bizzare to me. None of it was useful in solving my problem.
 
michaelsanford said:
What haven't I done ? Is there something more to configure on the RedHat side (with, say, redhat-config-nfs )?

If you haven't done so already, you must allow access through the firewall on your linux machine on some specific ports for NFS exports to work. Right now I can't remember exactly which but I can certainly find out when I get home.
 
My linux box is on the LAN side of my firewall, so I have no firewall on it at all.

After mucking around a bit, I used redhat-config-nfs and added my iMac as a host, and /home/tank as a folder, read/write.

Using "sudo mount trogdor.local:/home/tank /Volumes/tank" only works if /Volumes/tank exists already, as a folder. Even then I don't have write access.

Am I on the right track?
 
To be honest, I'd never bothered to try and mount an NFS sharepoint via the terminal before now, but I've done everything the way you described and managed to get read/write access no problem. This was, however, a directory I'd previously mounted via 'Connect to Server' in the Finder - which might make a difference? I don't know.

Thing I noticed about mounting a sharepoint via the terminal was that it was bit weird/untidy in the Finder where an icon representing the directory appears on the desktop then refuses to be deleted when you drag it to the trash, even after I umount the sharepoint. Had to delete the directory in /Volumes (in your case that would be /Volumes/tank) before the desktop icon would disappear. Guess Finder handles all this stuff in the background.

If its of interest to you, I've been automounting my NFS directories by altering the NetInfo database in the manner described on Mike Bombich's website....

http://www.bombich.com/mactips/automount.html

Works well for me.
 
Hi Michael :)
Have you created the folder /Volumes/tank ? If I remember correctly, you can only mount NFS onto existing dirs - the dir should be empty though.
I *think* you can also mount NFS shares with Command-K in Finder and then specifiying the share to mount in the form:
nfs://machine.domain/folder/to/mount
Hope this helps :)
C
PS: I haven't checked your site for ages! Must do so :D
 
Hey LC, long time no chat.

Yeah, you can mount nfs via nfs:// in the finder but I was trying to be as *nix-y as I could be, also sometimes I want to mount the drive over SSH when I'm in another city.

It seems like I can only mount NFS shares into folders, which to me seems a little odd, but it seems to be working at least partially.

Check my site in a little while, it's under major revision, most of the revising will take place tomorrow :p
 
Hey Michael,

I'll be sure to check it out :)
Also - have you read the mount_nfs man page? You don't normally use that command directly; instead, the mount command calls it for you. But its good to have read the man page, because it contains more detailed information about NFS mounting behaviour.
The reason you need a directory to mount onto is because NFS mounts onto a node in the filesystem. Without checking in the various books on this matter, a node is an entry in the file system hierarchy - hence files or dirs. But in *nix everything is a file, so a directory is a file which is a node. It just depends on which of the words you like best :D It boils down to that you have to give the mount command a concrete context for it to graft the remote FS onto. Don't know if that helps any?

Cheers,
C
 
I did check that manpage but it didn't give me as much information as I would have liked concerning my problem. And yes, the node explanation makes perfect sense, I sometimes forget about that "everything-is-a-file" addage; thanks LC!

I've determined, from all this help, that the problem is conflicting UIDs on the NFS host and the Darwin client.

The solution: check "Treat remote root user as local root user" and when the mountpoint is mounted with "sudo" it works! See the two attachments taken from redhat-config-nfs (over XDMCP from my iMac I might add, I love XDMCP!). I suppose I could have also configured "Treat all clients as anon users" and specified my Darwin UID but that's a little less secure than the root option...

My problem now: how do I unmount the NFS mountpoint without rebooting :p I've checked the mount manpage and didn't find the word "unmount" and the command unmount seems to be a BSD system call that I can't issue from a command prompt... :confused:

(PS Gonna work on my site today, add some tracks and pictures.)
 

Attachments

  • basic.jpg
    basic.jpg
    44.8 KB · Views: 10
  • user_access.jpg
    user_access.jpg
    52.3 KB · Views: 4
I think the command you're looking for is umount not unmount :)
(But I could be mis-remembering my *nix commands ...)
C
 
It seems like I can only mount NFS shares into folders, which to me seems a little odd, but it seems to be working at least partially.

That is the way NFS works.
 
I've discovered (after accidentally using Fast User Switching) that all you need to do is relaunch the Finder to have NFS volumes appear on the desktop, cleanly with network server icon and all.
 
Some experiences i want to get rid of concerning Finder, NFS, and switching Interfaces.

I had the following problem:

I have a powerbook with WLAN an LAN connect and i am using NFS client on the powerbook with a OpenBSD server on the other side.

When i switch the network connect from WLAN to LAN or the other way round of course my NFS mounts are dead ... thats clear for me ... NFS is not built for things like that.
I am only mounting static with automounter to a fixed mountpoint so i have the following entries in my netinfo database:

eris:~ geeku$ nidump fstab . // btw thats how to get the info :)


kraftwerk:/home/users/geeku /Users/geeku/kraftwerk nfs -i,-w=8192,-s,-a=4,-3,-T,-b,-P,-g=32,nodev,-d,noatime,-r=8192,-I=8192 0 0
kraftwerk:/home/shared /Users/Shared/kraftwerk nfs -i,-w=8192,-s,-a=4,-3,-T,-b,-P,-g=32,nodev,-d,noatime,-r=8192,-I=8192 0 0

this works fine

I have the following solution for this issue:

to make nfs work after switching i have to restart the nfsd and automounter on my powerbook. i have 2 scripts to do this
one to umount when i am connected and then one to mount after the ip switching ...

first one to unmount and kill automounter:

#!/bin/bash

umount -a -t nfs

killall nfsiod
# killall nfsd ... only needed if my OS X is also a nfs server
# killall mountd ... only needed if my OS X is also a nfs server
killall automount

and then one to restart the whole nfs client things:

#!/bin/bash


nfsiod -n 4

automount -m /Network -nsl
automount -m /automount/Servers -fstab -mnt /private/var/automount/Network/Servers \
-m /automount/static -static -mnt /private/var/automount

that should do it ...

so hope i could help u ...
because it took me some reading and trying out to make this work

have fun
m.
 
Back
Top