NFS share creation from command line, NFS service not functioning

Hi,

I'm trying to resurrect an Xserve we've had for a bit that we haven't put to much use. Intent is to use it as an NFS server. I'm posting on the command line forum because I'd prefer to rely on the gui as little as possible.

serveradmin shows nfs functioning as far as I can tell:

risaac$ sudo serveradmin fullstatus nfs
nfs:failoverState = "NIFailoverNotConfigured"
nfs:portmap = "RUNNING"
nfs:rpc.statd = "RUNNING"
nfs:state = "RUNNING"
nfs:nsfd = "RUNNING"
nfs:mountd = "RUNNING"
nfs:readWriteSettingsVersion = 1
nfs:rpc.lockd = "RUNNING"

The shares are not accessible from a remote machine though:

<root|~> mount site-xserve:/Volumes/export_tftpboot /mnt
nfs mount: site-xserve:/Volumes/export_tftpboot: No such file or directory

showmount -e from the remote Solaris NFS client does see the shares:

<root|~> showmount -e site-xserve
export list for site-xserve:
/Volumes/export_tftpboot (everyone)
/Volumes/system_logs (everyone)
/Volumes/Group RTPProjects (everyone)

I had added the export_tftpboot via:

nidump -r /exports . > ~/exportfile
*edit exportfile*
{
"name" = ( "exports" );
CHILDREN = (
{
"name" = ( "/Volumes/system_logs" );
"opts" = ( "maproot=root" );
},
{
"name" = ( "/Volumes/Group RTPProjects" );
"opts" = ( "maproot=root" );
},
{
"name" = ( "/Volumes/export_tftpboot" );
"opts" = ( "maproot=root" );
}
)
}

Reincorporating the new edit with:

sudo niload -r /exports . < ./exportfile

New share shows up according to nicl:

risaac$ sudo nicl . -list /exports
Password:
106 /Volumes/system_logs
108 /Volumes/Group RTPProjects
144 /Volumes/export_tftpboot

Thinking I could just restart the nfsd service as I would in Linux with the service command or in Solaris with the /etc/init.d/nfs.server script, I try to run:

risaac$ sudo serveradmin stop nfs
Password:
nfs:error = "UNEXPECTED_COMMAND"

*doesn't work, try start*

risaac$ sudo serveradmin start nfs
nfs:error = "UNEXPECTED_COMMAND"

Not sure what to try/where to look from here. Any suggestions?

Thanks,

-Ramesh

XServe (RackMac1,2 from Hardware Overview), Mac OS X (10.4.7), XServe Raid attached to it

Posted on Oct 4, 2006 11:47 AM

Reply
6 replies

Oct 5, 2006 8:46 PM in response to Ramesh Isaac

Hi Ramesh,
I was hesitant to respond to your question because I'm not very experienced with the server version of OS X. I have configured an NFS server on other flavors of UNIX and with the OS X client but it's been a while. I don't know how to use Apple's fancy tools to do it but I assume that I know some of what those tools do.

Rather than poll the fancy tools, why don't you just check to see if the NFS daemon is running. The following command will tell you:

ps -auxww | grep nfs | grep -v grep

Then look in the /System/Library/LaunchDaemons/com.apple.portmap.plist property list and make sure that it's not disabled. Unfortunately, I'm not sure what it should look like on the server. You can also check the portmapper with the command:

rpcinfo -p

What do the your exports look like? I assume that if you used Apple's tools to configure the export, the information is stored in OD or NetInfo rather than being in the /etc/exports file. What do you get when you execute the following?

dscl / -list /exports
dscl / -list /NFS
dscl / -list /RPC

For those nodes that have contents, you might want to read the contents.
--
Gary
~~~~
Human resources are human first, and resources
second.
-- J. Garbers

Oct 6, 2006 11:08 AM in response to Gary Kerbaugh

Hey Gary,

Thank you for posting, even if it doesn't get the answer, I'm grateful to keep the discussion going.

Hi Ramesh,
I was hesitant to respond to your
question because I'm not very experienced with the
server version of OS X. I have configured an NFS
server on other flavors of UNIX and with the OS X
client but it's been a while. I don't know how to use
Apple's fancy tools to do it but I assume that I know
some of what those tools do.

Rather than poll the fancy tools,
why don't you just check to see if the NFS daemon is
running. The following command will tell you:

ps -auxww | grep nfs | grep -v grep


nfsd seems to be working:

risaac$ ps -auxww | grep nfs | grep -v grep
root 257 0.0 -0.0 29308 512 ?? Ss 25Aug06 0:00.00 nfsiod -n 4
root 396 0.0 -0.0 27244 564 ?? Ss 25Aug06 0:00.01 nfsd-master
root 397 0.0 -0.0 27244 396 ?? S 25Aug06 0:00.00 nfsd-server
root 398 0.0 -0.0 27244 396 ?? S 25Aug06 0:00.00 nfsd-server
root 400 0.0 -0.0 27244 400 ?? S 25Aug06 0:00.00 nfsd-server
root 401 0.0 -0.0 27244 396 ?? S 25Aug06 0:00.00 nfsd-server
root 402 0.0 -0.0 27244 400 ?? S 25Aug06 0:00.00 nfsd-server
root 403 0.0 -0.0 27244 400 ?? S 25Aug06 0:00.00 nfsd-server
root 404 0.0 -0.0 27244 400 ?? S 25Aug06 0:00.00 nfsd-server
root 405 0.0 -0.0 27244 404 ?? S 25Aug06 0:00.00 nfsd-server


Then look in the
/System/Library/LaunchDaemons/com.apple.portmap.plist
property list and make sure that it's not disabled.


This was an xml file. From what I could interpret, it didn't look like anything was disabled, there was no reference of "disable" in the file at least.

risaac$ grep -i disable /System/Library/LaunchDaemons/com.apple.portmap.plist
risaac$

Unfortunately, I'm not sure what it should look like
on the server. You can also check the portmapper with
the command:

rpcinfo -p


Looks about like what I'd expect:

risaac$ rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 1021 status
100024 1 tcp 1015 status
100021 0 udp 1008 nlockmgr
100021 1 udp 1008 nlockmgr
100021 3 udp 1008 nlockmgr
100021 4 udp 1008 nlockmgr
100021 0 tcp 1014 nlockmgr
100021 1 tcp 1014 nlockmgr
100021 3 tcp 1014 nlockmgr
100021 4 tcp 1014 nlockmgr
100005 1 udp 989 mountd
100005 3 udp 989 mountd
100005 1 tcp 1012 mountd
100005 3 tcp 1012 mountd
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs

What do the your exports look like?
I assume that if you used Apple's tools to configure
the export, the information is stored in OD or
NetInfo rather than being in the /etc/exports file.
What do you get when you execute the following?

dscl / -list /exports
dscl / -list /NFS
dscl / -list /RPC


risaac$ dscl / -list /exports
/Volumes/system_logs
/Volumes/export_tftpboot
/Volumes/Group RTPProjects

risaac$ dscl / -list /NFS
risaac$

risaac$ dscl / -list /RPC
risaac$

What should these last two have returned?


For those nodes that have contents, you might want to
read the contents.


Here are the directory permissions of the share points, is that what you were essentially asking?

risaac$ cd /Volumes
risaac$ ls -l
total 8
drwxrwxr-x 11 apple staff 476 Sep 1 10:30 Group RTPProjects
lrwxr-xr-x 1 root admin 1 Aug 25 08:23 Server Boot HD -> /
drwxrwxrwx 8 root wheel 306 Feb 28 2006 Server Data HD
drwxr-xr-x 11 apple staff 476 Sep 28 2005 system_logs
drwsrwsrwx 845 nobody staff 28832 May 9 02:31 export_tftpboot

Any ideas?

Thanks,

-Ramesh

Oct 6, 2006 3:00 PM in response to Ramesh Isaac

Hi Ramesh,
It certainly appears to be running. It's really a good sign that the rpcinfo returned all of that because it means that the portmapper is working. I see no problems with any of that.

My next question is whether or not the firewall is running. I don't trust the GUI, especially when it's giving you conflicting information about NFS. What do you get when you execute the following:

sudo ipfw -atdN list

Actually, the output from dscl is what I would expect. I included the /NFS simply because I'm unfamiliar with it but it appears to hold the directories that you want automounted. My experience has been that the directories to be exported were listed under /exports so it seems like your configuration should work whether there are other ways to do it or not. We should look at the exports nodes themselves if we can read them. When I suggested that you read the contents of those entries I was suggesting commands something like the following :

dscl / -read /exports/Volumes\\/system_logs
dscl / -read /exports/Volumes\\/export_tftpboot
dscl / -read /exports/Volumes\\/Group RTPProjects

That looks confusing because of the slash in the node name but it should work. Let me know what you get.

One last thing I'm concerned about is the location of these shares, in /Volumes. Are they disk partitions or are they themselves mounted network shares? The reason I ask is that you're not supposed to be able to "reshare shares" with NFS.
--
Gary
~~~~
Since when has the purpose of debian been to
appease the interests of the mass of unskilled
consumers?
-- Steve Shorter

Oct 17, 2006 11:56 AM in response to Gary Kerbaugh

Hey Gary,

Thanks again for your continued responses. Lost a contractor this last week, so it had been too busy for me to poke around with this.

Regarding what you had asked:

risaac$ sudo ipfw -atdN list
Password:
00001 2 122 Fri Aug 25 08:23:33 2006 allow udp from any asia to any dst-port asia
65535 3594 380055 Fri Aug 25 08:23:37 2006 allow ip from any to any

The dscl read command I couldn't get to work

risaac$ dscl / -read /exports/Volumes\\/export_tftpboot
read: Invalid Path

I tried replacing the "/" after dscl with a "." as I saw in some examples, leaving off exports and Volumes, adding more "\\", removing "\\", "\\"'ng the "_", but everything came back up as "Invalid Path".

The only dscl -read command I got a response from was on exports alone:

risaac$ dscl / -read /exports
name: dsRecTypeNative:exports

One last thing I'm concerned about
is the location of these shares, in /Volumes. Are
they disk partitions or are they themselves mounted
network shares? The reason I ask is that you're not
supposed to be able to "reshare shares" with NFS.


They are disk partitions:

risaac$ df -kl
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/disk0s9 180940124 51866400 128817724 29% /
/dev/disk1s9 180925912 50780 180875132 0% /Volumes/Server Data HD
/dev/disk3s3 301430104 64406860 237023244 21% /Volumes/export_tftpboot
/dev/disk3s5 301430104 90152 301339952 0% /Volumes/system_logs
/dev/disk3s7 301430056 9822328 291607728 3% /Volumes/Group RTPProjects

Any other ideas?

Thanks,

-Ramesh

Oct 17, 2006 1:41 PM in response to Ramesh Isaac

Hmm, kinda anti-climactic, but from the advice on http://xanana.ucsc.edu/~wgscott/xtal/wiki/index.php/NFS I made an /etc/exports file instead of the nidump -r method I had found elsewhere.

risaac$ cat /etc/exports
/Volumes/system_logs -maproot=root
/Volumes/export_tftpboot -maproot=root
/Volumes/Group RTPProjects -maproot=root

per wgscott's page:

root# rm -f /var/db/mountdexptab
*Instruction had been for /var/db/mountdtab, I removed this by accident by using file completion, but it seems to be the correct file to remove as it is recreated successfully at the end of the process*

root# mountd
root# nfsd -t -u -n 6


From remote Solaris client:

~# mount site-xserve:/Volumes/export_tftpboot /mnt
~# df /mnt
/mnt (site-xserve:/Volumes/export_tftpboot):474046480 blocks 59255811 files

The restart of nfsd could be a lot cleaner, adding an exportfs tool would seem fairly easy to add, and lacking from OS X. I found a script for one at http://xanana.ucsc.edu/Library/init/zsh/local-functions/darwin/exportfs
that I'll probably add to my own system.

Thanks again for the responses Gary, it was a big help in getting me to keep looking for an answer with the issue.

-Ramesh

Oct 17, 2006 8:12 PM in response to Ramesh Isaac

Hi Ramesh,
I probably should have sent you to Bill's site earlier; he uses NFS regularly in his lab. I'm glad you found it. An example of his knowledge is that he indicated that the /etc/export file works now. I believe that for a long time that file didn't work even if you configured the system to use flat files. It's good news to hear that it works.

I guess the dscl command that I wanted is:

dscl / -list /exports

However, I would guess from your "invalid path" that your exports directory wasn't populated which was probably the problem. I was thinking that if your server isn't using OD, we could populate the /exports directory in NetInfo with the command:

cat /etc/exports | sudo niload exports .

However, I found the following in the "niload" man page:
niload no longer supports loading NFS file share information into NetInfo.
I guess that since the /etc/exports file works now, they are moving away from storing the exports in a directory. It doesn't make sense to put it in OD because it's only the configuration of a single machine. However, I could see the advantage of having the configuration tied to a domain name.

I hope that you find the script useful; I collaborated on it. You'll find my name on the page to which you linked. However, using /etc/exports is easy so unless you can't afford to reboot to have changes take effect, you won't need the script.
--
Gary
~~~~
Talkers are no good doers.
-- William Shakespeare, "Henry VI"

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

NFS share creation from command line, NFS service not functioning

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.